File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
crates/rmcp/src/transport Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -374,7 +374,14 @@ impl AuthorizationManager {
374374
375375 let config = OAuthClientConfig {
376376 client_id : reg_response. client_id ,
377- client_secret : reg_response. client_secret ,
377+ // Some IdP returns a response where the field 'client_secret' is present but with empty string value.
378+ // In that case, the interpretation is that the client is a public client and does not have a secret during the
379+ // registration phase here, e.g. dynamic client registrations.
380+ //
381+ // Even though whether or not the empty string is valid is outside of the scope of Oauth2 spec,
382+ // we should treat it as no secret since otherwise we end up authenticating with a valid client_id with an empty client_secret
383+ // as a password, which is not a goal of the client secret.
384+ client_secret : reg_response. client_secret . filter ( |s| !s. is_empty ( ) ) ,
378385 redirect_uri : redirect_uri. to_string ( ) ,
379386 scopes : vec ! [ ] ,
380387 } ;
You can’t perform that action at this time.
0 commit comments