Gateway Integration
In production, a gateway (reverse proxy, ingress controller, or service mesh) often sits in front of the NeMo Platform. This page explains the recommended enforced gateway path for bearer-token authentication, what headers the gateway must set, and which paths skip authorization.
For the security architecture, see Security Model.
Overview
NeMo Platform services trust identity headers only after a bearer token has been validated. In gateway deployments, the recommended path is:
- The gateway calls
/apis/auth/authenticatebefore forwarding protected API requests. - The auth service validates the bearer token and returns trusted
X-NMP-Principal-*andX-NMP-Scopesheaders. - The gateway forwards those trusted headers to NeMo Platform services.
- Services run their normal PDP authorization checks using the trusted principal and scopes.
This callout can validate any bearer token accepted by the auth service: OIDC access tokens when auth.oidc.enabled=true, Scoped Access Keys when auth.access_keys.enabled=true, and workload tokens when workload identity is enabled.
If gateway enforcement is not required, the gateway can forward bearer tokens unchanged and let service middleware validate them directly. This page focuses on the enforced gateway path.
Gateway Bearer-Auth Callout
To use gateway bearer-auth callout, configure your gateway to call the NeMo Platform auth service with the original Authorization header. On success, forward only the trusted headers returned by the auth service. This keeps token validation and NeMo claim mapping inside the auth service instead of duplicating them in static gateway JWT config.
For IdP-issued tokens, enforce your IdP’s revocation policy before setting NeMo headers. Do not rely on a gateway rule that only maps JWT claims into headers, such as Envoy claim_to_headers, when immediate revocation must be honored.
Security Requirement: Your ingress/gateway must strip the following headers from all incoming external requests before forwarding to NeMo Platform:
X-NMP-Principal-Id,X-NMP-Principal-Email,X-NMP-Principal-Groups,X-NMP-Principal-On-Behalf-OfX-NMP-Scopes
If external clients can set these headers, they can forge any identity or bypass authorization entirely. The gateway should also block external access to /internal/* paths (used for service-to-service communication).
Required Headers (Gateway Bearer-Auth Callout)
When the gateway has authenticated the bearer token, it must forward:
Header names are case-insensitive; services normalize them.
Bypass Paths
The following are not subject to authorization checks; they are always allowed:
- Health and readiness:
/health,/healthz,/ready,/readyz,/health/live,/health/ready,/metrics - Discovery:
/apis/auth/discovery(for CLI/SDK OIDC discovery) - PDP endpoints: Paths under
/apis/auth/v2/authz/are restricted to service principals only. The middleware rejects external and regular-user requests automatically. - Studio: Paths under
/studio(the Studio UI handles its own OIDC login)
Configure the gateway so these paths are not sent to /apis/auth/authenticate when using gateway bearer-auth callout.
Gateway Configuration Examples
Envoy Auth-Service Callout
Envoy ext_authz filter configuration
Replace placeholder values before applying this configuration.
Envoy HTTP ext_authz callouts preserve the original request method and build the check URL from path_prefix plus the original request path. For example, DELETE /apis/entities/v2/workspaces/default is checked as DELETE /apis/auth/authenticate/apis/entities/v2/workspaces/default. NeMo accepts that prefixed callout URL, validates only the bearer token, and returns trusted principal headers. The original request path is still authorized later by the service PDP check after Envoy forwards the request.
Header Stripping
Configure your gateway to remove NeMo Platform auth headers from incoming external requests. This prevents clients from forging identities.
Envoy header stripping
Add request_headers_to_remove to your route configuration:
Testing Gateway Auth
After configuring gateway bearer-auth callout, verify:
- Headers are set correctly — Make a request through the gateway and check that
X-NMP-Principal-IdandX-NMP-Scopesare present on the service side when the token contains scopes. - Headers are stripped from external requests — Try sending
X-NMP-Principal-IdorX-NMP-Scopesfrom outside; verify they are stripped by the gateway.
Related
- Auth Configuration — Enabling auth and PDP provider (embedded vs OPA).
- Security Model — Trust boundaries and gateway trust model.
- Production Hardening — Security checklist including gateway requirements.