@@ -200,16 +200,15 @@ impl OidcState {
200200 /// Validate and decode the claims of an OIDC token, without refreshing the client.
201201 async fn get_token_claims (
202202 & self ,
203- id_token : & OidcToken ,
203+ id_token : OidcToken ,
204204 state : Option < & OidcLoginState > ,
205205 ) -> anyhow:: Result < OidcClaims > {
206206 let client = & self . get_client ( ) . await ;
207207 let verifier = self . config . create_id_token_verifier ( client) ;
208208 let nonce_verifier = |nonce : Option < & Nonce > | check_nonce ( nonce, state) ;
209209 let claims: OidcClaims = id_token
210- . claims ( & verifier, nonce_verifier)
211- . with_context ( || format ! ( "Could not verify the ID token: {id_token:?}" ) ) ?
212- . clone ( ) ;
210+ . into_claims ( & verifier, nonce_verifier)
211+ . with_context ( || format ! ( "Could not verify the ID token" ) ) ?;
213212 Ok ( claims)
214213 }
215214}
@@ -472,7 +471,7 @@ async fn set_auth_cookie(
472471 . id_token ( )
473472 . context ( "No ID token found in the token response. You may have specified an oauth2 provider that does not support OIDC." ) ?;
474473
475- let claims = oidc_state. get_token_claims ( id_token, None ) . await ?;
474+ let claims = oidc_state. get_token_claims ( id_token. clone ( ) , None ) . await ?;
476475 let expiration = claims. expiration ( ) ;
477476 let max_age_seconds = expiration. signed_duration_since ( Utc :: now ( ) ) . num_seconds ( ) ;
478477
@@ -528,7 +527,8 @@ async fn get_authenticated_user_info(
528527 . with_context ( || format ! ( "Invalid SQLPage auth cookie: {cookie_value:?}" ) ) ?;
529528
530529 let state = get_state_from_cookie ( request) ?;
531- let claims = oidc_state. get_token_claims ( & id_token, Some ( & state) ) . await ?;
530+ log:: debug!( "Verifying id token: {id_token:?}" ) ;
531+ let claims = oidc_state. get_token_claims ( id_token, Some ( & state) ) . await ?;
532532 log:: debug!( "The current user is: {claims:?}" ) ;
533533 Ok ( Some ( claims) )
534534}
0 commit comments