API Manager maintains every API as an instance in an environment. Policies are applied to this instance, the contracts with the applications that are allowed to use it are created there, and the usage data comes together there. The implementation remains separate, so a rule can be changed or added without redeploying the application. API Manager manages the rules, and a gateway applies them by checking every request before it reaches the API.
API Manager in Mule 4 and how the runtime enforces policies
For this purpose, the Mule gateway is embedded in the Mule runtime. Through API autodiscovery, a Mule 4 application connects to its instance in API Manager, downloads the assigned policies, and supplies data for analytics. The prerequisite is a flow with an HTTP Listener. For APIs and services outside the Mule runtime, Omni Gateway (formerly Flex Gateway) takes on the same task. In Connected Mode, it is also configured from API Manager.
Policies in Mule 4 and what is included
MuleSoft ships ready-made policies that can be configured in API Manager and assigned to an instance. When it comes to securing APIs (API security), six tasks take priority. For each one, we list the policies by their name from the documentation.
- Identify applications · Client ID Enforcement, access only with a contract
- Validate tokens · JWT Validation and OpenID Connect OAuth 2.0 Access Token Enforcement
- Set quotas · Rate Limiting and Rate Limiting SLA-based
- Protect back ends · Spike Control queues requests during load peaks
- Limit payloads · JSON Threat Protection and XML Threat Protection
- Restrict access · IP Allowlist and IP Blocklist
A policy is attached to the API instance. That way a rule can be changed without touching the application.
Ordering policies and prescribing them for all APIs
You define the order of an API's policies in API Manager. The documentation names two exceptions. The CORS policy always runs first, and automated policies run before the policies of the individual API. Automated policies are the means for rules that should apply across an entire environment. They are configured once and take effect for the APIs of that environment, provided their runtime version is covered.
During setup, we record which policy applies to which API, in which order, and with which values. The audit log of the Anypoint Platform shows who applies, changes, or removes a policy. On request, we review an existing configuration and hand over findings with problem, cause, and next step. This is the form in which we handed over the findings of a platform audit for a food manufacturer in 2019.