liveBook · Manning

API gateway

As explained in Authorization in Action

An API gateway is a service that receives, routes, and often governs requests to backend APIs.

An API gateway receives requests entering a service environment and forwards them to backend APIs. It can also act as a central policy enforcement point (PEP): it checks each request with a policy decision point (PDP) and blocks calls that are not authorized. section 11.1.1 section 11.1.4

A manager requests salary data

A manager uses a dashboard to view team salaries. The gateway receives the dashboard’s call to the HR API and sends Cedar a request identifying the manager, the salary-viewing action, the department, and the calling service. Cedar permits access to the manager’s own department and denies access to other departments. The gateway forwards the API call only when Cedar allows it. section 11.1.1

Figure 11.1 API Gateway as a centralized enforcement point. Carol’s request moves through the Manager Dashboard to the HR API. The API Gateway functions as the PEP, forwarding a normalized PARC request to the Cedar engine (PDP). The HR API receives the call only if Cedar returns an allow decision.

The diagram traces the request from the dashboard through the gateway and Cedar to the HR API. section 11.1.1

The gateway normalizes request information into principal, action, resource, and context (PARC). The quality of the decision depends on the identity and context the gateway can reliably gather, as well as the policy it consults. section 11.1 section 11.1.1

For OAuth-protected APIs, a client presents an access token. The gateway validates its signature, issuer, audience, expiration, and scopes, then derives the principal from the token and enriches the request with resource and context information. Cedar evaluates the resulting PARC request; the gateway forwards an allowed call or blocks a denied one, usually with a 403 response. Token validation and fine-grained policy evaluation are complementary, not interchangeable. section 11.2.4

A gateway protects only traffic that passes through it. A service mesh can enforce policy on internal service-to-service calls, while per-service proxies can protect APIs outside the mesh. Together, these patterns can normalize, evaluate, enforce, and log decisions across more request paths. section 11.1.1 section 11.1.4

A gateway can also enforce global governance before a tenant-specific policy check: a global denial stops the request, while a permit sends it onward for tenant evaluation. Separate audit logs make both decisions traceable. Gateways or integration layers can likewise enforce policy before calls reach third-party services, without replacing those services’ native authorization. section 13.4.3 section 19.6

How Authorization in Action covers it

How deep it goes
Works through request normalization, token validation, policy evaluation, and enforcement, while contrasting gateway coverage with other deployment patterns.
Examples
Illustrates a manager’s salary request and OAuth-token calls from a delegated analytics client and a task integration.
What you can do after
Evaluate gateway enforcement by tracing token and policy decisions and identifying request paths that need additional protection.
How it connects
Connects API gateways to OAuth, Cedar, policy enforcement points, service meshes, and per-service proxies.

Also explained in

Compare how 7 books explain API gateway →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Authorization in Action. The section links point to the parts of the book it draws on.