mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-31 09:18:28 +00:00
fix(iam): improve OIDC token exchange diagnostics (#4232)
This commit is contained in:
+10
-2
@@ -22,7 +22,8 @@ use crate::oidc_state::{OidcAuthSession, OidcLogoutSession, OidcStateStore};
|
|||||||
use openidconnect::core::{CoreAuthenticationFlow, CoreClient, CoreIdToken};
|
use openidconnect::core::{CoreAuthenticationFlow, CoreClient, CoreIdToken};
|
||||||
use openidconnect::{
|
use openidconnect::{
|
||||||
AsyncHttpClient, Audience, AuthType, AuthorizationCode, ClientId, ClientSecret, CsrfToken, IssuerUrl, LogoutRequest, Nonce,
|
AsyncHttpClient, Audience, AuthType, AuthorizationCode, ClientId, ClientSecret, CsrfToken, IssuerUrl, LogoutRequest, Nonce,
|
||||||
PkceCodeChallenge, PkceCodeVerifier, PostLogoutRedirectUrl, ProviderMetadataWithLogout, RedirectUrl, Scope,
|
PkceCodeChallenge, PkceCodeVerifier, PostLogoutRedirectUrl, ProviderMetadataWithLogout, RedirectUrl, RequestTokenError,
|
||||||
|
Scope,
|
||||||
};
|
};
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
use rustfs_config::oidc::*;
|
use rustfs_config::oidc::*;
|
||||||
@@ -569,7 +570,14 @@ impl OidcSys {
|
|||||||
.set_redirect_uri(Cow::Owned(redirect))
|
.set_redirect_uri(Cow::Owned(redirect))
|
||||||
.request_async(&self.http_client)
|
.request_async(&self.http_client)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| format!("token exchange failed: {e}"))?;
|
.map_err(|e| match &e {
|
||||||
|
RequestTokenError::Parse(parse_err, body) => format!(
|
||||||
|
"token exchange failed: {e}: parse_error_path={}, response_body_len={}",
|
||||||
|
parse_err.path(),
|
||||||
|
body.len()
|
||||||
|
),
|
||||||
|
_ => format!("token exchange failed: {e}"),
|
||||||
|
})?;
|
||||||
|
|
||||||
// Verify the ID token (signature, issuer, audience, expiry, nonce)
|
// Verify the ID token (signature, issuer, audience, expiry, nonce)
|
||||||
let id_token = token_response
|
let id_token = token_response
|
||||||
|
|||||||
Reference in New Issue
Block a user