It is fairly easy to apply policies to your proxied API hosted in Anypoint Platform: you just create a proxy and then apply runtime policies as the platform manages some things for you. What about applying policies but without using a proxy?
In one of our projects, we needed to apply HTTP Basic Authentication policy to the endpoint. The solution consists of two steps:
- Use Auto-Discovery element to link your flows with the created API in Anypoint Platform
- Link your application running in Anypoint Platform with your Anypoint Organization
- Get your client_id, client_secret as described in Step 1 here
- Go to Runtime Manager in Anypoint Platform
- Choose your application from the list and click Manage Application button
- Click Properties tab
- Enter following data:
anypoint.platform.client_id=<YOUR_CLIENT_ID>
anypoint.platform.client_secret=<YOUR_CLIENT_SECRET> - Redeploy your application