From 7e49f130847ef5b7c201bad6c1335e73a6a27e2e Mon Sep 17 00:00:00 2001 From: Eugene Date: Fri, 4 Oct 2024 17:22:40 +0200 Subject: [PATCH] #1056 - auto-strip .well-known/openid-configuration from OIDC URLs --- warpgate-sso/src/config.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/warpgate-sso/src/config.rs b/warpgate-sso/src/config.rs index 7676acd70..ca18311a1 100644 --- a/warpgate-sso/src/config.rs +++ b/warpgate-sso/src/config.rs @@ -153,7 +153,16 @@ impl SsoInternalProviderConfig { SsoInternalProviderConfig::Azure { tenant, .. } => { IssuerUrl::new(format!("https://login.microsoftonline.com/{tenant}/v2.0"))? } - SsoInternalProviderConfig::Custom { issuer_url, .. } => issuer_url.clone(), + SsoInternalProviderConfig::Custom { issuer_url, .. } => { + let mut url = issuer_url.url().clone(); + let path = url.path(); + let path = path + .strip_suffix(".well-known/openid-configuration") + .unwrap_or(path) + .to_owned(); + url.set_path(&path); + IssuerUrl::from_url(url) + } }) }