Create a Policy
After creating the Service, we need to add a policy so that we can test the endpoint by supplying a username and password for basic authorization:
- From the left navigation panel, select Policy catalog.
- Click New Policy. The New policy panel opens:
- Click in the name field and change the name to Tutorial Basic Auth.
- Click Authenticate.
- Select Basic Authentication.
Important: Snaplexes must be running on version 4.42 or later to use this rule.
- Leave the When this policy should be applied field empty.
- Click Validate & save.
- Click Save to save the rule.
- Select the project where you created the Hello World Service and click Save.
Apply the Policy
We could apply the Policy to the Service and it would apply to all endpoints. To demonstrate that different Policies can apply to different endpoints, we'll apply it to the endpoint.
Next, apply the Policy to the endpoint:
- From the left navigation pane, click Service catalog.
- Navigate to the Hello World Service version and open it.
- Click the Policies tab.
- In the Endpoint Policies section, click the plus icon.
- Navigate to the project where you saved the Policy and select it.
From the Service Documentation tab, we could add an image and instructions for using the service, as described in Add documentation. Since this is just an example, we'll skip that step and move on to testing and publishing.