feat: Support IPSIE session_expiry claim#245
Draft
tanya732 wants to merge 2 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for the IPSIE SL1
session_expiryID token claim, which represents an absolute upper bound (Unix timestamp in seconds) on a session's lifetime.The claim is asserted by the upstream IdP and emitted by Auth0 when the enterprise connection has
id_token_session_expiry_supported: true.Since this library is a stateless core (it does not own or manage application sessions), it provides the primitives required to enforce the session ceiling while leaving session persistence and redirect behavior to the application.
Specifically, this PR:
session_expiryclaim during the Authorization Code flow.Tokens.Tokens.getSessionExpiresAt()Tokens.isSessionExpired()Tokens.isSessionExpired(long leeway)isSessionExpired()whenever a session is read, integrating with their existing redirect-to-login flow.Changes
TokenssessionExpiresAtfield.getSessionExpiresAt()isSessionExpired()isSessionExpired(long leeway)DEFAULT_SESSION_EXPIRY_LEEWAY.serialVersionUIDremains unchanged, so previously serialized sessions deserialize withsessionExpiresAt == null, preserving backward compatibility.RequestProcessorReads
session_expiryfrom the verified ID token after token merge and validates it before stamping it ontoTokens.Validation rules:
>= 10_000_000_000) are ignored to prevent a Post-Login Action that accidentally emits milliseconds from silently disabling enforcement.session_expiry <= iat, login fails instead of creating an already-expired session.IdentityVerificationExceptionAdded:
a0.session_expiry_in_pasterror codeisSessionExpiryError()helperDocumentation
Updated
EXAMPLES.mdwith an IPSIEsession_expirysection covering:Tests
Added coverage for:
RequestProcessorTestiatvalidation failureTokensTestSemantics
nullmeans no session ceiling and is never considered expired, making rollout backward compatible.session_expiryis independent of both:expclaimOut of Scope / Follow-up
Refresh token enforcement
This library does not currently expose a refresh-token API, so the session ceiling is enforced only:
A
TODOhas been added toAuthenticationControllerdocumenting the intended behavior once the MRRT renewal flow is implemented:grant_type=refresh_tokenrequests once the session ceiling has passed, returningsession_expired.session_expiryacross refreshes (write once; never re-derive it from refresh responses).Documentation
Cross-linking from the session management documentation is not included in this PR.