Five policy enforcement points, one set of policies
A policy enforcement point sits in the request path. It asks Keymate's decision point whether a request is allowed, then lets it through or stops it. Keymate offers five enforcement points under the same policies, and three of them need no code in your application: the Access Gateway, an API gateway plugin and a service mesh filter.
The request path, step by step
A protected request goes through five steps between the client and your application. The diagram shows them for the Access Gateway, the usual way in. The other four enforcement points send their checks through the Access Gateway when one is deployed. Otherwise they ask the decision point directly.
- The request arrives with a token. A user or a service signs in through Keymate's Keycloak build, and the token they receive says who they are, which organization is active and how strongly they signed in. Their requests for the application are routed through the Access Gateway, which sits in the application's request path.
- The token is checked. The gateway verifies the token and, when the token is bound to a key, the DPoP proof that comes with the request. Services behind the gateway receive a normal token and need no change to support DPoP.
- The gateway asks the decision point. It passes who is asking, the action, the resource and the context of the request.
- The decision point answers allow or deny. It evaluates the policies that apply, built from roles, attributes, relationships and risk. It records which policy decided, which condition was met or missed, and the policy version in force. The models a policy can use are in the fine-grained authorization deep dive.
- Allowed requests are forwarded; denied requests stop at the gateway. The application receives only requests that passed.
Sign-in happens once, but steps 2 to 5 run again for every request. If a right is revoked at 10:02, the request at 10:03 is denied.
Policy decision point and policy enforcement point
A policy decision point (PDP) evaluates a request against your policies and answers allow or deny. A policy enforcement point (PEP) sits in the request path and acts on the answer. Keeping the two apart puts the policies in one place, where they cover many applications.
A zero trust policy enforcement point checks every request on its own, whatever network it came from. It never trusts a caller just because it is inside the perimeter. Keymate's enforcement points work that way. On a protected route, service or topic, a call from a service inside your cluster is checked against the same policies as a call from the internet. The PDP and PEP architecture page shows how the decision point, the enforcement points and the audit pipeline fit together.
Five policy enforcement points and where each one sits
All five ask the same decision point. What changes is where the check runs and what your team has to set up:
| Enforcement point | Where it sits | What you set up | Change to your application |
|---|---|---|---|
| Access Gateway | In the request path, before the application | Route the application's traffic through the gateway | None |
| API gateway plugins (APISIX, Kong) | In the API gateway you already run | Install the plugin and enable it on the routes to protect | None |
| Service mesh (Istio, Envoy) | Between services, inside the mesh | Enable the Keymate check in the mesh | None |
| SDK (TypeScript, Java, .NET) | Inside the application | Add the SDK to the application | A few lines per check |
| Event streams (Kafka) | On the streams of events | Turn on event-stream authorization for the topics to protect | None |
Access Gateway
The Access Gateway is Keymate's own gateway, built on Apache APISIX and Envoy, placed in the request path of an application or a group of applications. It checks every request and forwards only the ones the decision point allows, so the application never sees a denied request.
API gateway plugins: APISIX and Kong
If your APIs already sit behind Apache APISIX or Kong, Keymate adds a plugin to that gateway instead of placing a second one in front. The gateway asks Keymate before forwarding each call. No API needs its own authorization code. In this Keycloak API gateway integration, Keymate issues the token and decides whether the call goes through.
Service mesh: Istio and Envoy
With Istio or Envoy, Keymate checks calls between services inside the mesh. A service that is never exposed to the outside still cannot be called by a service without the right to call it. When Keymate's Keycloak build issues the tokens and Istio carries the calls, the rule for which service may call which moves out of each service's code and into Keymate's policies.
A service needs no code change, as long as it runs in the mesh.
SDK: TypeScript, Java and .NET
The SDK is for decisions that depend on data only the application holds, such as the amount on an invoice it has just loaded. Its check goes through the Access Gateway when one is deployed, or straight to the decision point when not. The application then acts on the answer. The decision is recorded as it would be at the gateway, with the policy that decided and the version in force.
Event streams: Kafka
Event-stream authorization decides which application may publish to, or read from, which stream of events. Keymate does it for Kafka, using the same policies as web requests.
Which enforcement point to use for each application
You can use more than one enforcement point, chosen per application by where its traffic already flows.
| If the application | Start with |
|---|---|
| Is a web application or API reached from outside | The Access Gateway |
| Already sits behind APISIX or Kong | The plugin for that gateway |
| Is a set of microservices calling each other inside the cluster | The service mesh |
| Needs a decision that depends on data it loads itself | The SDK, next to one of the above |
| Talks to other applications through Kafka topics | Event-stream authorization |
Authorization for microservices usually combines two enforcement points: the Access Gateway or an API gateway plugin at the edge, and the service mesh between services. The SDK is added only where a rule needs data that no gateway can see.
A policy is written once in the admin console and applies wherever the request is checked. A rule that denies a call at the gateway also denies it in the mesh or in an SDK check. Every decision is recorded with the policy version in force. If you require an approver, a policy change is approved once in Authorization Governance, not once per enforcement point.
Keycloak's policy enforcer and Keymate's enforcement points
Keycloak's own policy enforcer is a library inside a Java application. It intercepts that application's requests and asks Keycloak Authorization Services for a decision. Keymate keeps Authorization Services available and moves enforcement out of the application. The Access Gateway, the API gateway plugins and the service mesh check requests for applications in any language, with no library to add.
If your applications are Java services and your rules fit Keycloak's resources, scopes and policies, the policy enforcer may be all you need. How Keycloak decides permit or deny is explained in Keycloak Authorization Services.
Further reading
- DPoP proof of possession: how we implemented DPoP end to end with Keycloak, the Access Gateway and an APISIX plugin that validates proofs at the edge.
- Keycloak Authorization Services: how Keycloak's own engine decides permit or deny, and where its policy enforcer sits.
- Fine-grained authorization for AI agents: the approach our engineers presented at Java Day Istanbul 2026, in which the Access Gateway evaluates declarative access rules in a demo where an AI agent calls it through an MCP (Model Context Protocol) server, and why a route or scope check alone is not enough.
Questions
How do I enforce authorization in front of my APIs without changing application code?
Put a policy enforcement point in the request path of the APIs. With Keymate that is the Access Gateway, or a plugin in the API gateway you already run (APISIX or Kong); calls between services can be checked in the Istio or Envoy service mesh. Each one asks the decision point before forwarding the call, so the API receives only allowed requests and its code does not change.
What is a policy enforcement point in Keycloak?
In Keycloak itself, the policy enforcement point is the policy enforcer: a library inside a Java application that asks Keycloak Authorization Services for each decision. In Keymate, the policy enforcement point sits outside the application: the Access Gateway, a plugin in your API gateway or the service mesh, with an SDK for checks only the application can make.
Can Keymate work with the API gateway we already run?
Yes, if it is Apache APISIX or Kong: a Keymate plugin makes that gateway ask the decision point before forwarding each call, so no API needs its own authorization code. You keep one gateway, and the policies are the same ones the Access Gateway and the service mesh apply.
Do I have to choose one enforcement point for the whole company?
No. You choose an enforcement point per application, and you can mix them: the gateway at the edge, the service mesh between services and the SDK where a rule needs the application's own data. All of them get their answer from the same decision point.
How do I authorize MCP servers and AI agents?
Put an enforcement point between the agent and the APIs it calls, so each call is decided outside the agent. With Keymate today, an agent signs in as a service with the OAuth client credentials grant, like any other software client, and each of its requests passes an enforcement point and is decided against the same policies as anyone else's. Authorizing MCP (Model Context Protocol) tool calls and governing agents as identities are on the Roadmap.