Create a policy

Create a Basic Auth Policy and apply it to the Hello World Service endpoint.

This is step 3 of 5 in the Hello world tutorial.

After creating the Service, add a policy so that you can test the endpoint by supplying a username and password for basic authorization:

  1. From the left navigation pane, select Policy catalog.
  2. Click New Policy. The New policy panel opens:

    New policy panel

  3. Change the name to Tutorial Basic Auth.
  4. Click Authenticate.
  5. Select Basic Authentication.
    Important: Snaplexes must be running on version 4.42 or later to use this rule.
  6. Leave the When this policy should be applied field empty.
  7. Click Validate & save.
  8. Click Save to save the Policy.
  9. Select the project where you created the Hello World Service and click Save.
    Tip: Select the same project as the Hello World Service so the Policy appears in the selection list when you apply it.

Apply the Policy

Applying the Policy at the Service level applies it to all endpoints. To demonstrate that different Policies can apply to different endpoints, we'll apply it at the endpoint level instead.

Apply the Policy to the endpoint:

  1. From the left navigation pane, click Service catalog.
  2. Navigate to the Hello World Service version and open it.
  3. Click the Policies tab.
  4. In the Endpoint policies section, click the plus icon.
  5. Navigate to the project where you saved the Policy and select it.

From the Service Documentation tab, you can add images and instructions for using the Service, as described in Add documentation and categories. The tutorial won't cover that.

What's next?

Test and publish.