For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.
Cross App Access (ID-JAG)
Call a downstream API as the authenticated end user with the OAuth Identity Assertion Authorization Grant.
Set up Cross App Access (ID-JAG) with an EnterpriseAgentgatewayPolicy.
About
The crossAppAccess backend authentication method implements the OAuth Identity Assertion Authorization Grant, also called “ID-JAG” or “Cross App Access” (XAA). With this method, agentgateway calls a downstream API as the authenticated end user, without requiring the user to interactively log in to that downstream app. This pattern is common in agentic scenarios where an agent calls other apps’ APIs on behalf of the user, such as per-user access to MCP servers (MCP enterprise-managed authorization).
The gateway acts as a confidential OAuth client and performs a two-leg exchange on each backend call:
- Authenticate the user. The inbound request carries the user’s OIDC ID token, validated by a route-level JWT authentication policy. The validated token is the subject of the exchange. The JWT policy must validate an OIDC ID token, not an arbitrary access token, because the identity provider expects an ID token as the subject.
- Exchange the token. The gateway performs two sequential exchanges:
- RFC 8693 token exchange. The gateway calls the user’s identity provider (IdP) authorization server with an RFC 8693 token exchange and receives an ID-JAG assertion that is bound to the resource authorization server.
- RFC 7523 JWT-bearer grant. The gateway presents the ID-JAG to the resource’s authorization server with an RFC 7523 JWT-bearer grant and receives a Bearer access token that is scoped to the downstream API.
- Attach and cache. The Bearer token is added as
Authorization: Bearer <token>to the upstream request and cached until shortly before it expires.
flowchart LR
Client -- ID token --> AGW[Agentgateway]
AGW -- "(a) token exchange" --> IdP[Identity provider]
IdP -- ID-JAG --> AGW
AGW -- "(b) jwt-bearer grant" --> RAS[Resource authorization server]
RAS -- access token --> AGW
AGW -- "Authorization: Bearer<br>access token" --> API[Downstream API]
Cross App Access differs from OAuth token exchange in that it crosses a trust boundary: the IdP and the resource’s authorization server are separate parties, so the gateway performs two exchanges and holds two client registrations, one at each token endpoint. For a single-leg exchange at one authorization server, use oauthTokenExchange instead.
Note
To keep the demo self-contained, a single Keycloak instance acts as both parties: the user’s IdP and the resource authorization server. In production, these parties are typically separate trust domains. For examples against separate providers, review the traffic-cross-app-access examples in the upstream agentgateway repository. That example uses xaa-dev (hosted IdenX IdP + hosted resource authorization server) and okta-auth0 (Okta IdP + Auth0 resource authorization server). These IdPs illustrate the two-party topology, but note that the configs are written for standalone mode, not Kubernetes.
Before you begin
Follow the Get started guide to install agentgateway.
Follow the Sample app guide to create a gateway proxy with an HTTP listener and deploy the httpbin sample app.
Get the external address of the gateway and save it in an environment variable.
Tip
Kind cluster? Kind does not support
LoadBalancerservices by default. To use this option with a Kind cluster, install and runcloud-provider-kind.export INGRESS_GW_ADDRESS=$(kubectl get svc -n agentgateway-system agentgateway-proxy -o jsonpath="{.status.loadBalancer.ingress[0]['hostname','ip']}") echo $INGRESS_GW_ADDRESSkubectl port-forward deployment/agentgateway-proxy -n agentgateway-system 8080:80
Deploy Keycloak
Deploy a Keycloak authorization server into your cluster to act as both the user’s identity provider and the resource authorization server. This walkthrough uses a single Keycloak that performs both legs of the exchange.
Issuing and consuming an ID-JAG requires the experimental identity-assertion-jwt Keycloak feature, which is not in a stock Keycloak release. The demo uses the ceposta/keycloak:id-jag image, which bakes in the feature.
Deploy Keycloak and its Service into the
httpbinnamespace. TheKC_HOSTNAMEvariable pins the token issuer to the in-cluster DNS name, so that the ID token you mint through a port-forward and the gateway’s in-cluster exchange calls agree on the issuer (iss). The ID-JAG’s issuer must be stable, because the resource authorization server validates it against the same issuer.kubectl apply -f- <<EOF apiVersion: apps/v1 kind: Deployment metadata: name: keycloak namespace: httpbin spec: replicas: 1 selector: matchLabels: app: keycloak template: metadata: labels: app: keycloak spec: containers: - name: keycloak image: ceposta/keycloak:id-jag args: ["start-dev", "--http-port=8080"] env: - name: KC_BOOTSTRAP_ADMIN_USERNAME value: admin - name: KC_BOOTSTRAP_ADMIN_PASSWORD value: admin - name: KC_HOSTNAME value: "http://keycloak.httpbin.svc.cluster.local:8080" - name: KC_HOSTNAME_STRICT value: "false" - name: KC_HOSTNAME_BACKCHANNEL_DYNAMIC value: "false" ports: - containerPort: 8080 # Report ready only once Keycloak is actually serving, so that later # steps (realm configuration, JWKS fetch) do not race its startup. readinessProbe: httpGet: path: /realms/master port: 8080 initialDelaySeconds: 15 periodSeconds: 5 failureThreshold: 60 --- apiVersion: v1 kind: Service metadata: name: keycloak namespace: httpbin spec: selector: app: keycloak ports: - name: http port: 8080 targetPort: 8080 EOFWait for Keycloak to be ready. The readiness probe reports the pod ready only after Keycloak serves requests, so this command returns when Keycloak is available to configure. Startup can take a few minutes.
kubectl rollout status deployment/keycloak -n httpbin --timeout=300sConfigure the
idjag-demorealm with a script from the agentgateway repository. Clone the repository and go to the example setup scripts.git clone https://github.com/agentgateway/agentgateway.git cd agentgateway/examples/traffic-cross-app-access/keycloakRun the configuration script against the in-cluster Keycloak. The
KCADMvariable runs the Keycloak admin CLI inside the running pod, andSERVERpoints at the in-cluster hostname so that the realm’s self-referential identity provider uses the same issuer asKC_HOSTNAME. The script creates theidjag-demorealm, thealice/aliceuser, anagent-client(the gateway’s requesting client, which mints the ID-JAG through token exchange), and aresource-client(the resource authorization server client, which consumes the ID-JAG through the JWT-bearer grant).POD=$(kubectl get pod -n httpbin -l app=keycloak -o jsonpath='{.items[0].metadata.name}') KCADM="kubectl exec -i -n httpbin $POD -- /opt/keycloak/bin/kcadm.sh" \ SERVER="http://keycloak.httpbin.svc.cluster.local:8080" \ KC_AGENT_SECRET=agent-secret KC_RESOURCE_SECRET=resource-secret \ ./configure-keycloak.shExample output:
Keycloak configured: realm : idjag-demo user : alice / alice agent-client : agent-secret (requesting app; mints ID-JAG via token exchange) resource-client: resource-secret (resource AS; consumes ID-JAG via jwt-bearer) IdP : self-idjag (self-referential JWT_AUTHORIZATION_GRANT)
Configure Cross App Access
Configure agentgateway to validate the inbound ID token and perform the two-leg exchange.
Create an EnterpriseAgentgatewayBackend for the token endpoint, pointing at the in-cluster Keycloak Service. Both legs of the exchange use the same Keycloak, so they share this EnterpriseAgentgatewayBackend.
kubectl apply -f- <<EOF apiVersion: enterpriseagentgateway.solo.io/v1alpha1 kind: EnterpriseAgentgatewayBackend metadata: name: keycloak-token-endpoint namespace: httpbin spec: static: host: keycloak.httpbin.svc.cluster.local port: 8080 EOFCreate Kubernetes Secrets with the two OAuth client secrets, one for each leg. These match the client secrets that the configuration script created.
kubectl apply -f- <<EOF apiVersion: v1 kind: Secret metadata: name: agent-oauth-client namespace: httpbin type: Opaque stringData: clientSecret: agent-secret --- apiVersion: v1 kind: Secret metadata: name: resource-oauth-client namespace: httpbin type: Opaque stringData: clientSecret: resource-secret EOFCreate a route-level EnterpriseAgentgatewayPolicy that validates the inbound OIDC ID token. The
audiencesvalue matches theagent-clientthat mints the user’s ID token, and the validated token becomes the subject of the exchange.kubectl apply -f- <<EOF apiVersion: enterpriseagentgateway.solo.io/v1alpha1 kind: EnterpriseAgentgatewayPolicy metadata: name: jwt-idtoken namespace: httpbin spec: targetRefs: - group: gateway.networking.k8s.io kind: HTTPRoute name: httpbin traffic: jwtAuthentication: mode: Strict providers: - issuer: "http://keycloak.httpbin.svc.cluster.local:8080/realms/idjag-demo" audiences: - agent-client jwks: remote: jwksPath: "/realms/idjag-demo/protocol/openid-connect/certs" cacheDuration: "5m" backendRef: group: "" kind: Service name: keycloak namespace: httpbin port: 8080 EOFCreate a backend-level EnterpriseAgentgatewayPolicy that attaches the
crossAppAccessmethod to thehttpbinService. TheidentityProviderleg authenticates asagent-clientto mint the ID-JAG, and theresourceAuthorizationServerleg authenticates asresource-clientto exchange the ID-JAG for a backend access token. Theaudiencemust equal the resource identifier thatresource-clientis registered with. ThesubjectToken.sourcereads the inbound ID token as the subject of the exchange. Because the route-level JWT policy validates and strips theAuthorizationheader, this example reads the validated token from thejwt.rawTokenCEL variable instead of the header.kubectl apply -f- <<EOF apiVersion: enterpriseagentgateway.solo.io/v1alpha1 kind: EnterpriseAgentgatewayPolicy metadata: name: backend-cross-app-access namespace: httpbin spec: targetRefs: - group: "" kind: Service name: httpbin backend: auth: crossAppAccess: identityProvider: backendRef: group: enterpriseagentgateway.solo.io kind: EnterpriseAgentgatewayBackend name: keycloak-token-endpoint path: /realms/idjag-demo/protocol/openid-connect/token clientAuth: clientId: agent-client method: ClientSecretBasic secretRef: name: agent-oauth-client resourceAuthorizationServer: backendRef: group: enterpriseagentgateway.solo.io kind: EnterpriseAgentgatewayBackend name: keycloak-token-endpoint path: /realms/idjag-demo/protocol/openid-connect/token clientAuth: clientId: resource-client method: ClientSecretBasic secretRef: name: resource-oauth-client subjectToken: source: expression: jwt.rawToken.unredacted() audience: https://resource.idjag.demo scopes: - todos.read EOFReview the following table to understand this configuration. For more information, see the API docs.
Field Description identityProviderThe user’s IdP authorization server token endpoint, referenced as an EnterpriseAgentgatewayBackend through backendRef, with the token endpointpath. Agentgateway sends the validated ID token as the RFC 8693subject_tokenon this leg.resourceAuthorizationServerThe resource authorization server token endpoint, in the same shape as identityProvider. This leg uses the RFC 7523 JWT-bearer grant, with the ID-JAG from the IdP leg sent as the assertion. This is a separate client registration from the IdP one.clientAuthClient authentication for each token endpoint. methodisClientSecretBasic(default),ClientSecretPost, orPrivateKeyJwt. UsesecretRefto read the client secret from a Kubernetes Secret.subjectTokenOptional source of the subject token for the exchange. sourcedefaults to theAuthorizationBearer header. When a route-level JWT policy validates the inbound token, it strips theAuthorizationheader, so setsource.expressionto thejwt.rawToken.unredacted()CEL expression to read the validated token instead. For more information about other forms of sources, such as headers, query parameters, or cookies, see Choose where the subject token is read from.audienceRequired identifier of the resource authorization server. The issued ID-JAG is bound to this value. resourcesOptional protected resource or API identifiers (RFC 8707), sent on the token exchange leg. Configure these explicitly when the authorization server expects them. scopesOptional scopes to request on the identity provider leg. The authorization server might grant a subset. These scopes are the ceiling for the ID-JAG. accessTokenScopesOptional scopes to request on the resource authorization server leg, when the ID-JAG is exchanged for the access token. Omit the field to send scopeson both legs. Set it to an empty list to send noscopeparameter on this leg. Naming a scope that is not inscopesis likely to be rejected asinvalid_scope, because the ID-JAG is granted only the scopes inscopes. For more information, see Scope the access token separately.cacheOptional token cache configuration. Defaults to an in-memory cache with 8192 entries. Set cache.defaultTtlas a fallback for when the token response omitsexpires_in(defaults to300s), andcache.maxEntries: 0to disable caching. The cache duration is capped by the subject token’s JWTexpclaim when present.
Verify the exchange
Mint alice’s ID token, send a request through agentgateway with it, and verify that the downstream API receives a different, backend-scoped access token.
Port-forward the Keycloak Service so that you can reach its token endpoint locally.
kubectl port-forward -n httpbin svc/keycloak 8080:8080In another terminal, mint
alice’s OIDC ID token from Keycloak asagent-client. This token is the inbound credential and the subject of the exchange. Tokens expire, so re-mint if you come back later.export ID_TOKEN=$(curl -s -X POST "http://localhost:8080/realms/idjag-demo/protocol/openid-connect/token" \ -d grant_type=password -d client_id=agent-client -d client_secret=agent-secret \ -d username=alice -d password=alice -d scope=openid | jq -r .id_token) echo "${ID_TOKEN:0:40}..."Send a request to the httpbin
/headersendpoint through the gateway, with the ID token. The gateway validates the token, performs the two-leg exchange at Keycloak, and forwards the request to httpbin with the resulting access token. Because httpbin reflects the request headers, the command decodes the token that the backend received.curl -s "http://$INGRESS_GW_ADDRESS:80/headers" -H "host: www.example.com" \ -H "Authorization: Bearer $ID_TOKEN" | python3 -c ' import sys,json,base64 h=json.load(sys.stdin)["headers"] tok=(h.get("Authorization") or h.get("authorization")) tok=(tok[0] if isinstance(tok,list) else tok).split()[1] p=json.loads(base64.urlsafe_b64decode(tok.split(".")[1]+"==")) print("backend received a", p["typ"], "token for", p["preferred_username"], "| azp:", p["azp"], "| scope:", p["scope"])'In the example output, the backend received a Bearer access token for
alicethat is authorized for theresource-clientparty (azp) with thetodos.readscope. The inbound ID token was stripped and never reached the backend.backend received a Bearer token for alice | azp: resource-client | scope: email todos.read profileConfirm that the gateway rejects requests without a valid ID token before any exchange happens.
curl -s -o /dev/null -w "no token -> %{http_code}\n" "http://$INGRESS_GW_ADDRESS:80/headers" -H "host: www.example.com" curl -s -o /dev/null -w "bad token -> %{http_code}\n" "http://$INGRESS_GW_ADDRESS:80/headers" -H "host: www.example.com" -H "Authorization: Bearer not.a.jwt"Example output:
no token -> 401 bad token -> 401
Choose where the subject token is read from
The subjectToken.source field selects where the gateway reads the subject credential from. Set one of the following four forms. A policy that sets none of them, or several of them, is rejected when you apply it, with the message exactly one of the fields in [header queryParameter cookie expression] must be set.
| Form | Reads the credential from |
|---|---|
header | The name of the request header. |
queryParameter | The name of the query parameter in the request URL. |
cookie | The name of the cookie. |
expression | A CEL expression that the gateway evaluates against the validated request, such as a claim of a JWT that a JWT authentication policy validated. |
When you omit subjectToken, the gateway reads the credential from the Authorization header with the Bearer prefix. The gateway does not fall back to another location.
If the configured source yields no credential, the request fails with a 400 and the message invalid request, and the gateway does not call the identity provider. However, the policy can still report Accepted: True in that case, because an expression that names a missing claim is still well formed. Check the response code as well as the policy status after you change the source.
You can also configure the location where the gateway checks for the subject token. Whichever form you choose, the gateway sends the credential to the identity provider as an ID token, with subject_token_type set to urn:ietf:params:oauth:token-type:id_token.
After the exchange, the gateway removes the credential from the location that you configured, and forwards the remaining cookies and parameters unchanged. It then writes the exchanged access token to the Authorization header, replacing any credential that the client sent there. The backend therefore receives only the exchanged token, never the subject credential.
Note
On MCP routes, the queryParameter form never matches, because the request that the policy inspects carries no query string. The exchange fails even when the parameter is present on the incoming request. Use a header, a cookie, or a CEL expression instead. Plain HTTP routes are not affected.
Read the subject token from a claim
A client does not always present an ID token directly. In an MCP OAuth setup, for example, the client authenticates with an OAuth access token that carries the ID token as a claim. Validate the incoming token with a route-level JWT authentication policy, then point the subject source at the claim that carries the ID token, using the claim name that your authorization server issues.
backend:
auth:
crossAppAccess:
subjectToken:
source:
expression: jwt.id_tokenThe jwt variable holds the claims of the token that the JWT authentication policy validated, so an expression can read only a claim that arrived signed. The gateway exchanges the ID token that it extracts from the claim. The access token that the client presented is not sent to either token endpoint.
Scope the access token separately
Cross App Access sends scope on both exchanges by default: to the identity provider when it asks for the ID-JAG, and to the resource authorization server when it redeems that ID-JAG for an access token. Authorization servers disagree about whether the second scope is welcome. Keycloak uses it to request optional client scopes, as in the example on this page. Others, including Okta Custom Authorization Server, reject a redemption request that carries a scope parameter at all, because the ID-JAG’s own scope claim is already authoritative.
Set accessTokenScopes to control the second leg on its own.
accessTokenScopes | The gateway sends |
|---|---|
| Omitted | scopes on both legs. This is the default. |
[] | No scope parameter on the redemption leg. Use this form with an authorization server that rejects the parameter. |
| A list of scopes | Those scopes on the redemption leg, and scopes on the identity provider leg. |
In the following example, the gateway requests todos.read from the identity provider and sends no scope when it redeems the ID-JAG.
crossAppAccess:
audience: https://resource.idjag.demo
scopes:
- todos.read
accessTokenScopes: []The ID-JAG is granted only the scopes that the identity provider approved from scopes, and that set is the ceiling for the redemption leg. Asking for more is likely to fail with invalid_scope. The gateway logs a warning at startup when accessTokenScopes names a scope that is absent from scopes, but it does not reject the configuration, because the identity provider is free to grant more than was requested.
Private key JWT client authentication
Enterprise IdPs such as Okta commonly require the PrivateKeyJwt client authentication method, in which the gateway authenticates with a signed JWT assertion instead of a client secret. Store the PEM-encoded signing key in a Kubernetes Secret and reference it with signingKeyRef. Because token endpoints are configured as backend references rather than raw URLs, PrivateKeyJwt requires an explicit assertionAudience.
clientAuth:
clientId: gateway-at-chat
method: PrivateKeyJwt
privateKeyJwt:
signingKeyRef:
name: gateway-signing-key
alg: RS256 # one of RS256/RS384/RS512/ES256/ES384
kid: my-signing-key # optional `kid` header
assertionAudience: https://chat.example.com/oauth2/tokenLimitations
The following parts of the Identity Assertion Authorization Grant draft are not yet supported:
- DPoP sender-constrained tokens (RFC 9449).
.well-knownendpoint discovery (RFC 8414, endpoints must be configured explicitly).- SAML and refresh-token subject types. Only an OIDC ID token can be the subject of the exchange.
Cleanup
You can remove the resources that you created in this guide.kubectl delete EnterpriseAgentgatewayPolicy backend-cross-app-access jwt-idtoken -n httpbin
kubectl delete EnterpriseAgentgatewayBackend keycloak-token-endpoint -n httpbin
kubectl delete secret agent-oauth-client resource-oauth-client -n httpbin
kubectl delete deployment keycloak -n httpbin
kubectl delete service keycloak -n httpbinNext steps
- Exchange the incoming credential for a per-backend token at a single authorization server with OAuth token exchange.
- Validate incoming JWTs with the JWT authentication policy.
SAML 2.0 assertion subjects
The open source crossAppAccess method requires the inbound credential to be an OIDC ID token. Many enterprises authenticate users with Security Assertion Markup Language (SAML) single sign-on (SSO) instead, where no ID token exists. Notably, Okta’s Cross App Access, the primary real-world XAA implementation, currently supports only SAML subjects.
To cover these environments, Solo Enterprise for agentgateway adds an entCrossAppAccess backend policy that accepts a base64-encoded SAML 2.0 assertion as the bearer credential and carries it through to a backend access token.
How the SAML flow differs
A SAML assertion cannot be exchanged for an ID-JAG directly, because no identity provider implements that exchange. Instead, the ID-JAG draft’s SAML flow adds a bootstrap hop in front of the two-leg exchange, for three legs in total.
flowchart LR
Client([Client]) -->|"SAML assertion"| AGW["agentgateway"]
AGW -->|"1. assertion for refresh token"| IdP["Identity provider"]
AGW -->|"2. refresh token for ID-JAG"| IdP
AGW -->|"3. ID-JAG for access token"| RAS["Resource<br/>authorization server"]
AGW -->|"Authorization: Bearer<br/>access token"| API["Downstream API"]
classDef accent fill:#7734be,stroke:#7734be,color:#fff;
class AGW accent;
The numbered legs in the diagram correspond to the following flow:
- Bootstrap exchange (RFC 8693). The gateway sends the assertion to the identity provider’s token endpoint as a
saml2subject token and requests a refresh token, with thebootstrapScopesvalues as the requested scopes. - ID-JAG exchange (RFC 8693). The gateway exchanges that refresh token for an ID-JAG assertion that is bound to the
audienceof the resource authorization server. - JWT-bearer grant (RFC 7523). The gateway presents the ID-JAG to the resource authorization server and receives a Bearer access token that is scoped to the downstream API, which it attaches to the upstream request.
The resulting access token is cached, keyed on a digest of the assertion, so that repeat requests skip all three legs.
What each leg sends
Before you choose an identity provider, confirm that it supports the exchange that the gateway performs. The gateway posts the following form parameters on each leg, in addition to the client authentication that clientAuth sets for that endpoint.
Leg 1, the bootstrap exchange, goes to the
identityProviderendpoint. This leg sends noaudienceand noresource. If you omitbootstrapScopes, the gateway sends noscopeparameter. The provider must return a refresh token in either theaccess_tokenor therefresh_tokenfield of the response.grant_type=urn:ietf:params:oauth:grant-type:token-exchange subject_token=<the assertion, exactly as the gateway received it> subject_token_type=urn:ietf:params:oauth:token-type:saml2 requested_token_type=urn:ietf:params:oauth:token-type:refresh_token scope=<the bootstrapScopes values, space-delimited>Leg 2, the ID-JAG exchange, goes to the same
identityProviderendpoint. The provider must setissued_token_typetourn:ietf:params:oauth:token-type:id-jagin the response. The provider must also omittoken_type, or set it toN_A. Any other value fails the exchange with a500.grant_type=urn:ietf:params:oauth:grant-type:token-exchange subject_token=<the refresh token from leg 1> subject_token_type=urn:ietf:params:oauth:token-type:refresh_token requested_token_type=urn:ietf:params:oauth:token-type:id-jag audience=<the audience value> scope=<the scopes values, space-delimited> resource=<one parameter for each resources value>Leg 3, the JWT-bearer grant, goes to the
resourceAuthorizationServerendpoint. The response to leg 3 supplies the Bearer access token for the downstream API. The gateway removes the header thatsubjectToken.sourcenames, so the backend receives the exchanged token only, never the assertion.grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer assertion=<the ID-JAG from leg 2> scope=<the scopes values, space-delimited>
How the assertion is validated
The gateway does not validate the SAML assertion itself, and it does not perform XML signature verification. The identity provider validates the assertion’s signature, audience, and expiry during the bootstrap exchange, which matches how the draft treats ID tokens. Because re-encoding the assertion could break signature verification, the gateway forwards the assertion bytes exactly as it received them.
Keep the following consequences in mind:
- No edge validation of the credential. A SAML assertion is not a JWT, so the route-level
jwtAuthenticationpolicy cannot validate it. Delete that policy before you use a SAML subject, as described in Configure a SAML subject. The identity provider checks the credential for the first time on the bootstrap exchange. - Rejections surface from the exchange. When the identity provider rejects the credential with
invalid_grant, such as for an expired or tampered assertion, the gateway returns a 401 with aWWW-Authenticate: Bearer error="invalid_token"header so that clients know to re-authenticate. Gateway-side misconfiguration, such asinvalid_clientorinvalid_scope, returns a 400 or 500 instead.
Before you begin
If you followed the previous Cross App Access section, delete the route-level jwt-idtoken policy that the preceding walkthrough creates. If that policy stays attached to the route, the gateway rejects every request with a 401 and the message authentication failure: no bearer token found, and the exchange never runs.
kubectl delete EnterpriseAgentgatewayPolicy jwt-idtoken -n httpbinConfigure a SAML subject
To use a SAML subject, replace the backend.auth.crossAppAccess policy from the preceding walkthrough with a backend.entCrossAppAccess policy. This field takes the same shape as the open source policy, plus the subjectToken.tokenType and bootstrapScopes settings.
Note
The following example points identityProvider at an Okta token endpoint, because Okta’s Cross App Access is the primary implementation of SAML subjects. The Keycloak instance from the preceding steps cannot take that role. Keycloak’s token endpoint rejects a saml2 subject token with an invalid_request error, and reports that the subject_token parameter supports access tokens only. Keycloak can still act as the assertion issuer and as the resource authorization server.
kubectl apply -f- <<EOF
apiVersion: enterpriseagentgateway.solo.io/v1alpha1
kind: EnterpriseAgentgatewayPolicy
metadata:
name: backend-cross-app-access-saml
namespace: httpbin
spec:
targetRefs:
- group: ""
kind: Service
name: httpbin
backend:
entCrossAppAccess:
identityProvider:
backendRef:
group: enterpriseagentgateway.solo.io
kind: EnterpriseAgentgatewayBackend
name: okta-token-endpoint
path: /oauth2/v1/token
clientAuth:
clientId: agent-client
method: ClientSecretBasic
secretRef:
name: agent-oauth-client
resourceAuthorizationServer:
backendRef:
group: enterpriseagentgateway.solo.io
kind: EnterpriseAgentgatewayBackend
name: resource-token-endpoint
path: /oauth2/v1/token
clientAuth:
clientId: resource-client
method: ClientSecretBasic
secretRef:
name: resource-oauth-client
audience: https://resource-as.example.com
scopes:
- todos.read
subjectToken:
source:
header:
name: x-saml-assertion
tokenType: Saml2
bootstrapScopes:
- openid
- offline_access
- email
EOFReview the following table to understand this configuration. For more information, see the API docs.
| Field | Description |
|---|---|
subjectToken.source | Optional location to read the assertion from in the request. Defaults to the Authorization header with the Bearer prefix. Set header.name to read the assertion from a different header, such as x-saml-assertion, so that the assertion does not collide with another bearer credential. A SAML subject takes the same four source forms as an ID token subject, described in Choose where the subject token is read from. |
subjectToken.tokenType | The type of the subject credential, either IdToken (default) or Saml2. Saml2 expects a base64-encoded SAML 2.0 assertion. With IdToken, this policy behaves the same as the open source auth.crossAppAccess policy. |
bootstrapScopes | Optional scopes to request on the bootstrap exchange that converts the assertion into a refresh token, such as openid, offline_access, and email. Providers differ in what they require to issue a refresh token, so set these values to match your identity provider. If you omit this field, the bootstrap exchange sends no scope parameter. The scopes field applies to the ID-JAG exchange and the JWT-bearer grant instead, not to the bootstrap exchange. Valid only with a Saml2 subject token. The API server rejects the policy otherwise. |
Note
On the same policy, entCrossAppAccess is mutually exclusive with the auth, tokenExchange, entTokenExchange, and workloadIdentity backend fields. For an OIDC ID token subject, continue to use the open source auth.crossAppAccess policy.