fix: do not manually construct fallback authorization metadata (#507)

This commit is contained in:
Alex Hancock 2025-11-03 12:08:32 -05:00 • committed by GitHub
commit d3ddc09e52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -251,29 +251,9 @@ impl AuthorizationManager {
return Ok(metadata);
}
warn!("No valid authorization metadata found, falling back to default endpoints");
// fallback to default endpoints
let mut auth_base = self.base_url.clone();
// discard the path part, only keep scheme, host, port
auth_base.set_path("");
// Helper function to create endpoint URL
let create_endpoint = |path: &str| -> String {
let mut url = auth_base.clone();
url.set_path(path);
url.to_string()
};
Ok(AuthorizationMetadata {
authorization_endpoint: create_endpoint("authorize"),
token_endpoint: create_endpoint("token"),
registration_endpoint: None,
issuer: None,
jwks_uri: None,
scopes_supported: None,
additional_fields: HashMap::new(),
})
// No valid authorization metadata found - return error instead of guessing
// OAuth endpoints must be discovered from the server, not constructed by the client
Err(AuthError::NoAuthorizationSupport)
}
/// get client id and credentials