custom claim which holds the "teams" value #5655
|
We want to use a custom plugin to extract the teams value out of a custom claim field of our IDP issued access token. We're not able to update the configuration of the IDP to add the teams name into a claim called "teams" of the JWT token. |
Replies: 1 comment
|
Short version: you probably don't need a plugin at all, and the hook you're aiming at wouldn't work anyway. The gateway never extracts a Why the resolve-user hook approach won't workTwo things in the code rule it out:
And for your specific case,
So the claim in your token is never consulted for team scoping. It goes through What actually maps your custom claim to teamsThe same function reuses the browser-SSO normalization and provisioning path, which is exactly where your custom claim can be picked up. Two provider fields do the work:
Set both via the admin API: After that the flow is: your token's Caveats worth knowing before you try it
If your claim is nested rather than top-level, say so and that's a different (and more interesting) conversation. |
Short version: you probably don't need a plugin at all, and the hook you're aiming at wouldn't work anyway. The gateway never extracts a
teamsclaim from an IdP-issued access token, so there is no "before" point to hook into.Why the resolve-user hook approach won't work
Two things in the code rule it out:
_resolve_plugin_authenticated_user_syncinmcpgateway/auth.pyis what consumes whatever yourhttp_auth_resolve_userplugin returns. It keys offemail, looks the user up in the DB, and returns the DB record (falling back to a non-admin virtual user only whenREQUIRE_USER_IN_DB=false). Teams are not read from the hook result at all, so there is nothing you can set there to influence team…