You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b44a73c
Browse filesBrowse the repository at this point in the historyBrowse files
Validate the issuer of machine-to-machine providers as an issuer URL
## Motivation and Context
`issuer:` on `ClientCredentialsProvider` and `CrossAppAccessProvider` accepted any non-empty String.
A value that is not an issuer URL can never match the metadata of an authorization server,
so such credentials were refused at the first request with a message about a different authorization server,
far from the configuration that caused it. The flow accepts an authorization server over HTTPS,
or over HTTP on a loopback address, and the option is now held to the same rule at construction,
where a mistake is reported with the value that was given. Since the issuer of the metadata is compared as a String,
a URI object or a Symbol could never equal it either, nor could an issuer with a query or fragment,
which RFC 8414 rules out; both are refused the same way. The Python SDK requires an http(s) scheme on its `issuer`;
the rule here is the stricter one the flow already applies to every authorization server URL.
## How Has This Been Tested?
test/mcp/client/oauth/client_credentials_provider_test.rb and test/mcp/client/oauth/cross_app_access_provider_test.rb:
a bare host, a non-HTTP scheme, a URL without a host, a plain HTTP URL off the loopback, a query, a fragment,
a URI object and a Symbol are refused with the new message, and HTTPS and loopback HTTP issuers
(IPv6 and an uppercase scheme included) are kept; before the change the String values among them were accepted.
## Breaking Changes
None for an `issuer:` that names an authorization server. A value that could never have matched a compliant one
(RFC 8414 forbids a query or fragment in an issuer) is refused at construction instead of at the first request.
Copy file name to clipboardExpand all lines: docs/_client/authorization.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -321,10 +321,12 @@ Keyword arguments:
321
321
-`private_key`, `signing_algorithm`: Required with `private_key_jwt` - the key (a PEM string
322
322
or `OpenSSL::PKey::PKey`, never written to `storage`) signs the client assertion with `"ES256"`
323
323
or `"RS256"`; `client_secret` must not be set, because the private key is the credential.
324
-
-`issuer`: Optional. The issuer identifier of the authorization server the credentials belong to. A different authorization server raises `Flow::AuthorizationError`.
324
+
-`issuer`: Optional. The issuer identifier of the authorization server the credentials belong to, spelled as its metadata states it:
325
+
an `https` URL (`http` only on a loopback address) without query or fragment. A different authorization server raises `Flow::AuthorizationError`.
325
326
A single trailing slash difference is accepted, as in the TypeScript SDK. When the protected resource metadata lists several authorization servers,
326
-
the one naming `issuer:` is used. Omitting `issuer:` is deprecated and emits a warning at construction. Without it, credentials go to whichever authorization server
327
-
the MCP server names, as before. To use credentials for another authorization server, construct a provider with that server's `issuer:` and credentials.
327
+
the one naming `issuer:` is used. Omitting `issuer:` is deprecated and emits a warning at construction.
328
+
Without it, credentials go to whichever authorization server the MCP server names, as before. To use credentials for another authorization server,
329
+
construct a provider with that server's `issuer:` and credentials.
328
330
-`scope`, `storage`, `authorization_request_validator`, `token_request_params`, `http_client_customizer`: Optional, same meaning as on `Provider`.
329
331
Use `token_request_params` for a parameter the authorization server requires on the `client_credentials` grant, such as Auth0's `audience`.
0 commit comments