bugfix: Non-empty paths in OAuth2 Authorization Server Metadata URLs (#441)

* fix: support non-empty paths in OAuth2 Authorization Server Metadata URLs

* fix: address formatting errors
This commit is contained in:
Peter Nehrer 2025-09-17 01:02:37 -06:00 • committed by GitHub
commit 4ee2add899
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -209,7 +209,11 @@ impl AuthorizationManager {
pub async fn discover_metadata(&self) -> Result<AuthorizationMetadata, AuthError> {
// according to the specification, the metadata should be located at "/.well-known/oauth-authorization-server"
let mut discovery_url = self.base_url.clone();
discovery_url.set_path("/.well-known/oauth-authorization-server");
let path = discovery_url.path();
let path_suffix = if path == "/" { "" } else { path };
discovery_url.set_path(&format!(
"/.well-known/oauth-authorization-server{path_suffix}"
));
debug!("discovery url: {:?}", discovery_url);
let response = self
.http_client