Skip to content

Commit 0f5ff8c

Browse files
committed
Refactor nonce retrieval in OIDC user info handling to simplify logic and ensure proper token claims processing
1 parent 98bf6e1 commit 0f5ff8c

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/webserver/oidc.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -546,20 +546,10 @@ async fn get_authenticated_user_info(
546546
.with_context(|| format!("Invalid SQLPage auth cookie: {cookie_value:?}"))?;
547547

548548
// Try to get nonce from cookies if this is a callback request
549-
let nonce = if request.path() == SQLPAGE_REDIRECT_URI {
550-
if let Ok(_params) = Query::<OidcCallbackParams>::from_query(request.query_string()) {
551-
get_nonce_from_cookie(request).ok()
552-
} else {
553-
None
554-
}
555-
} else {
556-
None
557-
};
549+
let nonce = get_nonce_from_cookie(request)?;
558550

559551
log::debug!("Verifying id token: {id_token:?}");
560-
let claims = oidc_state
561-
.get_token_claims(id_token, nonce.as_ref())
562-
.await?;
552+
let claims = oidc_state.get_token_claims(id_token, Some(&nonce)).await?;
563553
log::debug!("The current user is: {claims:?}");
564554
Ok(Some(claims))
565555
}

0 commit comments

Comments
 (0)