Repository navigation
Description
Problem Statement *
Right now, only a single target audience mapping is possible via a config that looks like this, which is baked into the authbridge at startup.
apiVersion: v1
kind: Secret
metadata:
name: auth-proxy-config
stringData:
TARGET_AUDIENCE: "auth-target" # <-- This is the target audience
TARGET_SCOPES: "openid auth-target-aud"
TOKEN_URL: "http://keycloak.keycloak.svc.cluster.local/realms/demo/protocol/openid-connect/token"
We should allow for route based configuration, to support token exchange across varying services.
This approach is still limited in that it cannot support downscoping. But it does give us more surface area to build prototypes with for now.
This should also support a passthough option, so that users can disable token exchange.
Proposed Solution *
Configuration via ConfigMap, e.g.,
kind: ConfigMap
metadata:
name: authbridge-routes
data:
routes.yaml: |
- host: "github.mcp.local"
target_audience: "https://api.github.com"
token_scopes: ...
token_url: ....
- host: "slack.mcp.local"
target_audience: "https://slack.com/api"
token_scopes: ....
token_url: ....
- host: "*.internal.svc.cluster.local"
passthrough: true
Alternatives Considered
Header based configuration. Where headers carry dynamic config information. This may still be a good followup to allow for overrides and testing. It does break the 'transparent' nature of the AuthBridge however, so is not a priority.
Additional Context
In the future, integration with a service capable of downscoping tokens as described in RFC 8693 will remain an ideal longterm outcome. However, this approach could remain indefinitely as a fallback for simplified architectures.
Priority
None
Contribution
- I am willing to submit a pull request for this feature
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
usize commentedon Jan 14, 2026
Open questions:
Hostfield in the header?huang195 commentedon Jan 21, 2026
@usize this is a crucial limitation that we currently have, and there isn't any specific solution that seems to be better than others. Ultimately, we want to minimize user inputs to improve user experience while guaranteeing fine-grained security. Will continue on this issue once we have some concrete proposals.
To answer your questions above:
According to Envoy's default behavior, it returns 404. However, we can add a "catch-all" route, so the request gets routed so the app can log that error.
Route order matters to Envoy, and the first one that matches win.
Using
Hostnamefield in the HTTP header is definitely a possible solution.huang195 commentedon Jan 23, 2026
One alternative to using configmap to hold the mapping information is to store this information in the IDP itself. Since we need to do token exchange to get the proper access token for the next hop, information about
audienceandscopeshould be stored in some form somewhere. In the case of IDP being Keycloak, we can use audience mapper to find the appropriate audience from aHost. There should also be similar ways to mapHostto scopes.If we assume something/someone is configuring IDP appropriately to assign identities and set authn/authz, we should be able to find this information without having to maintain a separate configmap and having to keep things in sync in case there are changes in the environment.
usize commentedon Jan 24, 2026
I experimented with having a mapping on the AuthBridge side. It's true that right away it runs into issues of config sprawl between AuthBridge and Keycloak. experiment branch
I could imagine us using attributes to store information about host -> client mappings.
The downside is that this requires admin credentials to do the attribute lookup at runtime. It would ensure that our mapping is always in sync with the KC configuration, but it's also pretty clunky and introduces additional round trips per request / requires us to add some sort of cache.
--
Configuring the mapping based on a resource parameter
Would be the ideal solution.
There is support for this being discussed and worked on:
keycloak/keycloak#36870
keycloak/keycloak#35711
It seems we really just need an interim solution.
My proposal:
We wrap the mapping logic up in a
AudienceResolverabstraction.For now, keep the mapping local and use a simple python script to handle syncing, similar to how we setup keycloak for the demo.
Then we can use the resolver to pivot to a different solution, or to easily cleanup once we have real resource parameter support.
This also has the advantage of letting us experiment with other IDPs that have different levels of support for RFC 8693.
For the scopes I think we can derive them from the subject's roles/permissions?
What do you think?
huang195 commentedon Jan 26, 2026
Sounds good to me. Let's have an interim solution based on local mapping, and then iterate on creating better solutions once upstream Keycloak capabilities are available.