Skip to content

Add IdTokenVerifier::set_max_age to check auth_time - #254

Open
Executioner1939 wants to merge 1 commit into
ramosbugs:mainfrom
Executioner1939:fix/max-age-auth-time
Open

Executioner1939 wants to merge 1 commit into
ramosbugs:mainfrom
Executioner1939:fix/max-age-auth-time

Conversation

@Executioner1939

Copy link
Copy Markdown

Fixes #249.

This adds IdTokenVerifier::set_max_age, to go with AuthorizationRequest::set_max_age. When it's set, verification fails with InvalidAuthTime if the ID token has no auth_time, or if more than max_age has passed since it. OpenID Connect Core 1.0 §3.1.2.1 says the ID token MUST include auth_time when max_age is used, and step 13 of §3.1.3.7 says the client SHOULD check it. It uses the verifier's time_fn, and runs after any set_auth_time_verifier_fn function.

I added three cases to test_id_token_verified_claims: a missing auth_time, one older than max_age, and one within it. With the check taken out, both refusals come back Ok. 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_age over from the request automatically, since that would change authorize_url.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

set_max_age sends max_age, but the default IdTokenVerifier accepts an ID Token with no auth_time or a stale one (Core §3.1.3.7 step 13)

1 participant