Repository navigation
Add IdTokenVerifier::set_max_age to check auth_time - #254
Open
Executioner1939 wants to merge 1 commit into
Open
Executioner1939 wants to merge 1 commit into
Executioner1939 wants to merge 1 commit into
Conversation
AuthorizationRequest::set_max_age sends max_age, but nothing checked the ID token's auth_time against it unless the caller restated the value in set_auth_time_verifier_fn. OpenID Connect Core 1.0 Section 3.1.2.1 says the ID token MUST include auth_time when max_age is used, and step 13 of Section 3.1.3.7 says the client SHOULD check it. With set_max_age, verification fails with InvalidAuthTime when auth_time is missing or more than max_age old. The default is unchanged. Fixes ramosbugs#249
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.
Fixes #249.
This adds
IdTokenVerifier::set_max_age, to go withAuthorizationRequest::set_max_age. When it's set, verification fails withInvalidAuthTimeif the ID token has noauth_time, or if more thanmax_agehas passed since it. OpenID Connect Core 1.0 §3.1.2.1 says the ID token MUST includeauth_timewhenmax_ageis used, and step 13 of §3.1.3.7 says the client SHOULD check it. It uses the verifier'stime_fn, and runs after anyset_auth_time_verifier_fnfunction.I added three cases to
test_id_token_verified_claims: a missingauth_time, one older thanmax_age, and one within it. With the check taken out, both refusals come backOk. All 68 lib tests and the doc tests pass, and fmt and clippy report nothing new.The default doesn't change. I didn't carry
max_ageover from the request automatically, since that would changeauthorize_url.