From bd2c554e44e7d77f4d18cfd47453766ad22fef65 Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Mon, 20 Oct 2025 18:07:12 -0400 Subject: [PATCH] Move authorize method from deprecated AzureProvider to AzureDCRProvider The authorize method with scope prefixing and resource filtering belongs on the main AzureDCRProvider class, not just the deprecated alias. --- src/fastmcp/server/auth/providers/azure.py | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/fastmcp/server/auth/providers/azure.py b/src/fastmcp/server/auth/providers/azure.py index 19cc81495..e6b022a71 100644 --- a/src/fastmcp/server/auth/providers/azure.py +++ b/src/fastmcp/server/auth/providers/azure.py @@ -254,23 +254,6 @@ class AzureDCRProvider(OAuthDCRProxy): f" and identifier_uri {self.identifier_uri}" if self.identifier_uri else "", ) - -# Deprecated alias for backwards compatibility -class AzureProvider(AzureDCRProvider): - """Deprecated: Use AzureDCRProvider instead. - - This alias is provided for backwards compatibility and will be removed in a future version. - """ - - def __init__(self, **kwargs): - if settings_module.settings.deprecation_warnings: - warnings.warn( - "AzureProvider is deprecated, use AzureDCRProvider instead", - DeprecationWarning, - stacklevel=2, - ) - super().__init__(**kwargs) - async def authorize( self, client: OAuthClientInformationFull, @@ -322,3 +305,20 @@ class AzureProvider(AzureDCRProvider): def _add_prefix_to_scopes(self, scopes: list[str]) -> list[str]: """Add Application ID URI prefix for authorization request.""" return [f"{self.identifier_uri}/{scope}" for scope in scopes] + + +# Deprecated alias for backwards compatibility +class AzureProvider(AzureDCRProvider): + """Deprecated: Use AzureDCRProvider instead. + + This alias is provided for backwards compatibility and will be removed in a future version. + """ + + def __init__(self, **kwargs): + if settings_module.settings.deprecation_warnings: + warnings.warn( + "AzureProvider is deprecated, use AzureDCRProvider instead", + DeprecationWarning, + stacklevel=2, + ) + super().__init__(**kwargs)