refac
This commit is contained in:
@@ -536,15 +536,20 @@ class OAuthClientManager:
|
|||||||
'server_metadata_url': (oauth_client_info.issuer if oauth_client_info.issuer else None),
|
'server_metadata_url': (oauth_client_info.issuer if oauth_client_info.issuer else None),
|
||||||
}
|
}
|
||||||
|
|
||||||
if oauth_client_info.server_metadata and oauth_client_info.server_metadata.code_challenge_methods_supported:
|
# Default to S256 for OAuth 2.1 (PKCE is mandatory per RFC 9700)
|
||||||
if (
|
kwargs['code_challenge_method'] = 'S256'
|
||||||
isinstance(
|
|
||||||
oauth_client_info.server_metadata.code_challenge_methods_supported,
|
# Only remove PKCE if metadata explicitly excludes S256
|
||||||
list,
|
if (
|
||||||
)
|
oauth_client_info.server_metadata
|
||||||
and 'S256' in oauth_client_info.server_metadata.code_challenge_methods_supported
|
and oauth_client_info.server_metadata.code_challenge_methods_supported
|
||||||
):
|
and isinstance(
|
||||||
kwargs['code_challenge_method'] = 'S256'
|
oauth_client_info.server_metadata.code_challenge_methods_supported,
|
||||||
|
list,
|
||||||
|
)
|
||||||
|
and 'S256' not in oauth_client_info.server_metadata.code_challenge_methods_supported
|
||||||
|
):
|
||||||
|
del kwargs['code_challenge_method']
|
||||||
|
|
||||||
self.clients[client_id] = {
|
self.clients[client_id] = {
|
||||||
'client': self.oauth.register(**kwargs),
|
'client': self.oauth.register(**kwargs),
|
||||||
|
|||||||
Reference in New Issue
Block a user