Skip to content

Commit d3ddc09

Browse files
authored
fix: do not manually construct fallback authorization metadata (#507)
1 parent 04e0590 commit d3ddc09

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

crates/rmcp/src/transport/auth.rs

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -251,29 +251,9 @@ impl AuthorizationManager {
251251
return Ok(metadata);
252252
}
253253

254-
warn!("No valid authorization metadata found, falling back to default endpoints");
255-
256-
// fallback to default endpoints
257-
let mut auth_base = self.base_url.clone();
258-
// discard the path part, only keep scheme, host, port
259-
auth_base.set_path("");
260-
261-
// Helper function to create endpoint URL
262-
let create_endpoint = |path: &str| -> String {
263-
let mut url = auth_base.clone();
264-
url.set_path(path);
265-
url.to_string()
266-
};
267-
268-
Ok(AuthorizationMetadata {
269-
authorization_endpoint: create_endpoint("authorize"),
270-
token_endpoint: create_endpoint("token"),
271-
registration_endpoint: None,
272-
issuer: None,
273-
jwks_uri: None,
274-
scopes_supported: None,
275-
additional_fields: HashMap::new(),
276-
})
254+
// No valid authorization metadata found - return error instead of guessing
255+
// OAuth endpoints must be discovered from the server, not constructed by the client
256+
Err(AuthError::NoAuthorizationSupport)
277257
}
278258

279259
/// get client id and credentials

0 commit comments

Comments
 (0)