Repository navigation
Pass the upstream auth_time through to Dex's ID token
#5071
R0flcopt3r
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What we want to do
We run Dex in front of Microsoft Entra ID for an internal web app. Most actions are fine with the normal session. A few sensitive ones (approving or rejecting a change) must follow a recent interactive sign-in at the upstream IdP, for example within the last 15 minutes. The app must be able to verify that from Dex's ID token, and send the user to sign in again (with
prompt=login) when it is too old.Dex is a great fit otherwise: our app trusts only Dex's issuer, and test environments use
staticPasswordswith groups, so the app has a single code path.What Dex does today (v2.46.0, as far as we can read the code)
prompt=loginandmax_ageonly affect Dex's own session (new in v2.46.0, behindDEX_SESSIONS_ENABLED). They are not passed to the connector:CallbackConnector.LoginURLtakes only scopes, callback URL and state (connector.go).auth_timein Dex's ID token is Dex's clock when the connector callback completes (finalize.go), not the upstreamauth_time.microsoftconnector sends a staticpromptType(microsoft.go) and builds the identity from Graph/me, so it never sees Entra'sauth_time. Theoidcconnector only sendspromptwithoffline_access(No "prompt" param in oidc connection URL even when "promptType" is set #3740).So the closest we can get is a second connector with
promptType: login, restricted to a dedicated client withallowedConnectors. That works, but thepromptvalue travels in a browser redirect: a user can strip it, the upstream signs them in silently, and nothing downstream can tell.Proposal (open to a different shape)
auth_timeinto Dex'sauth_timewhen the connector has it, instead of the time of the callback. For theoidcconnector this is a claim of the upstream ID token it already verifies; formicrosoftit would mean also validating the ID token from the token response (auth_timeis an optional claim in Entra). The client app then checks the age itself, against whatever limit it needs.maxUpstreamAuthAge: 15m. The connector verifies the upstreamauth_time(andnonce) and fails the login if it is missing or older. Simpler for client apps, but one limit per connector rather than per action.prompt=login/max_ageto connectors that support them, so a single connector can serve both normal and step-up logins.Either (1) or (2) closes the gap for us. The age comes from the upstream's signed ID token, so stripping
promptfrom the redirect no longer helps: a silent sign-in returns the oldauth_time, and the check fails.Related
auth_timein id_token claimsmax_agefrom per-session auth timepromptnot sent by the oidc connectorQuestions for maintainers
prompt/max_agethrough the connector interface?microsoftconnector validating the ID token in addition to calling Graph?We are happy to write the PR, with tests, if the direction is agreed.
All reactions