Add Policy Templates using Policy Manager

API proxy administrators can use the Policy Manager to convert a policy fragment into an encapsulated assertion and add it to the API proxy. Once converted, they can allow
Layer7 API Developer Portal
to discover and publish the assertion, at which point it becomes a "policy template".
The API proxy administrator can add input and output arguments to the encapsulated assertion. For information about the encapsulated assertions, see the topic "Encapsulated Assertions" in the online documentation for the Layer7 API Gateway.
  • We strongly recommend that only API proxy administrators with experience developing policies on the API Gateway create policy templates.
  • To create modular policy templates that API publishers can combine is challenging, so keep them simple.
  • Policy templates are available only to APIs published on
    API Portal
    .
  • Each template needs at least one input argument that is displayed in
    API Portal
    .
Follow these steps:
  1. In the Policy Manager, connect to the API proxy.
  2. On the Tasks menu, select
    Create Policy
    .
  3. In the Policy Properties dialog, enter a name and select
    OK
    . The policy fragment appears on the Policy Manager Services and Policies list and Policy Development window.
  4. Open the Internal Assertions palette, and then drag the
    Set as Portal Publishable Fragment
    to the policy fragment in the Policy Development window.
  5. In the Policy Development window, construct the policy.
  6. In the Services and Policies list, right-click the policy fragment, and then select
    Create Encapsulated Assertion
    .
  7. Confirm the auto-population of inputs and outputs. The Encapsulated Assertion Configuration Properties dialog opens.
  8. Enter a template name and a description.
  9. On the
    Palette Folder
    menu, select a palette.
    API Portal
    displays the name and description. Ensure that the description clearly describes to API publishers how they can use the template alone or with other templates.
  10. Add input and output arguments to the encapsulated assertion. Do not include periods in the names of input arguments, such as "test.email".
    To display an input argument, assign the string, integer, decimal, or Boolean type to the argument, and then select the checkbox next to the
    Show in assertion properties dialog
    .
    To make a displayed input argument mandatory, add an asterisk to the end of the input argument label.
  11. Select
    OK
    . The dialog closes.
  12. Select
    Save and Activate
    .
Verify That a Policy Template is in
API Portal
Follow these steps:
  1. Log in to
    API Portal
    as a Portal Admin.
  2. From the menu bar, select
    Manage
    ,
    APIs
    .
  3. Select
    Add API
    , or select an existing API, and then select
    Actions
    ,
    Edit API Details
    .
    The
    Details
    page appears.
  4. Enter or confirm the API details, then select
    Save & Next
    . Alternatively, you can select the
    Policy Templates
    tab.
    A list of applied policy templates display on the
    Policy Templates
    page, as well as the Select Policy Template dropdown.
  5. Click the dropdown to verify that the added policy template is available.
  6. Click the
    +
    icon to add the policy template, and expand it to verify that the template displays any fields that were configured to appear.
Edit a Policy Template in Policy Manager
Follow these steps:
  1. In the Policy Manager, connect to the API proxy.
  2. Edit the template policy:
    1. Open the policy in the Policy Development window.
    2. Edit the policy.
    3. Select
      Save and Activate
      .
  3. Edit the template's encapsulated assertion:
    1. Open the encapsulated assertion in the Encapsulated Assertions Property dialog.
    2. Optional:
      Edit the name and description of the encapsulated assertion.
    3. Optional:
      Add, edit, or delete arguments.
      Do not include periods in the names of input arguments, such as "test.email".
Delete A Policy Template in Policy Manager
Follow these steps:
  1. In the Policy Manager, connect to the API proxy.
  2. On the Tasks menu, select
    Manage Encapsulated Assertions
    . The Manage Encapsulated Assertion Configurations dialog opens.
  3. Select the template's encapsulated assertion, and then select
    Remove
    . Close the dialog.
  4. In the Policy Manager's Services and Policies list, right-click the policy fragment, and then select
    Delete Policy
    .
  5. Use the preceding policy template verification procedure to confirm that the deleted template does not appear in
    API Portal
    .