mirror of
https://github.com/warp-tech/warpgate.git
synced 2024-09-20 06:46:17 +08:00
log precise SSO discovery errors
This commit is contained in:
parent
0c3567b300
commit
055a12ba32
|
@ -2,7 +2,10 @@ use std::borrow::Cow;
|
||||||
|
|
||||||
use openidconnect::core::{CoreAuthenticationFlow, CoreClient, CoreProviderMetadata};
|
use openidconnect::core::{CoreAuthenticationFlow, CoreClient, CoreProviderMetadata};
|
||||||
use openidconnect::reqwest::async_http_client;
|
use openidconnect::reqwest::async_http_client;
|
||||||
use openidconnect::{CsrfToken, Nonce, PkceCodeChallenge, RedirectUrl, Scope};
|
use openidconnect::{
|
||||||
|
CsrfToken, DiscoveryError, Nonce, PkceCodeChallenge, RedirectUrl,
|
||||||
|
Scope,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::config::SsoInternalProviderConfig;
|
use crate::config::SsoInternalProviderConfig;
|
||||||
use crate::request::SsoLoginRequest;
|
use crate::request::SsoLoginRequest;
|
||||||
|
@ -15,7 +18,12 @@ pub struct SsoClient {
|
||||||
pub async fn make_client(config: &SsoInternalProviderConfig) -> Result<CoreClient, SsoError> {
|
pub async fn make_client(config: &SsoInternalProviderConfig) -> Result<CoreClient, SsoError> {
|
||||||
let metadata = CoreProviderMetadata::discover_async(config.issuer_url()?, async_http_client)
|
let metadata = CoreProviderMetadata::discover_async(config.issuer_url()?, async_http_client)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| SsoError::Discovery(format!("{e}")))?;
|
.map_err(|e| {
|
||||||
|
SsoError::Discovery(match e {
|
||||||
|
DiscoveryError::Request(inner) => format!("Request error: {}", inner),
|
||||||
|
e => format!("{e}"),
|
||||||
|
})
|
||||||
|
})?;
|
||||||
Ok(CoreClient::from_provider_metadata(
|
Ok(CoreClient::from_provider_metadata(
|
||||||
metadata,
|
metadata,
|
||||||
config.client_id().clone(),
|
config.client_id().clone(),
|
||||||
|
|
Loading…
Reference in a new issue