From 8e1efcf16b6a0982ceaae14b47c853e4c4468019 Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Fri, 7 Feb 2025 17:32:03 -0600 Subject: [PATCH] Remove `required_authorizer_expiration_time` This deprecated parameter has no effect. For users who are broken by the update, they should just remove any use of the parameter. --- ..._172718_sirosen_remove_deprecated_parameter.rst | 6 ++++++ src/globus_action_provider_tools/authentication.py | 14 +------------- tests/test_authentication.py | 13 ------------- 3 files changed, 7 insertions(+), 26 deletions(-) create mode 100644 changelog.d/20250207_172718_sirosen_remove_deprecated_parameter.rst diff --git a/changelog.d/20250207_172718_sirosen_remove_deprecated_parameter.rst b/changelog.d/20250207_172718_sirosen_remove_deprecated_parameter.rst new file mode 100644 index 0000000..0918bde --- /dev/null +++ b/changelog.d/20250207_172718_sirosen_remove_deprecated_parameter.rst @@ -0,0 +1,6 @@ +Breaking changes +---------------- + +* The ``required_authorizer_expiration_time`` parameter for + ``AuthState.get_authorizer_for_scope`` has been removed. In recent + releases it had no effect and emitted deprecation warnings. diff --git a/src/globus_action_provider_tools/authentication.py b/src/globus_action_provider_tools/authentication.py index e4e523d..40d2b17 100644 --- a/src/globus_action_provider_tools/authentication.py +++ b/src/globus_action_provider_tools/authentication.py @@ -231,11 +231,7 @@ def get_dependent_tokens( self.dependent_tokens_cache[self._dependent_token_cache_key] = resp return resp - def get_authorizer_for_scope( - self, - scope: str, - required_authorizer_expiration_time: int | None = None, - ) -> AccessTokenAuthorizer: + def get_authorizer_for_scope(self, scope: str) -> AccessTokenAuthorizer: """ Get dependent tokens for the caller's token, then retrieve token data for the requested scope and attempt to build an authorizer from that data. @@ -244,18 +240,10 @@ def get_authorizer_for_scope( building authorizers succeeds. :param scope: The scope for which an authorizer is being requested - :param required_authorizer_expiration_time: Deprecated parameter. Has no effect. :raises ValueError: If the dependent token data for the caller does not match the requested scope. """ - if required_authorizer_expiration_time is not None: - warnings.warn( - "`required_authorizer_expiration_time` has no effect and will be removed in a future version.", - DeprecationWarning, - stacklevel=2, - ) - retrieved_from_cache, dependent_tokens = self._get_cached_dependent_tokens() # if the dependent token data (which could have been cached) failed to meet diff --git a/tests/test_authentication.py b/tests/test_authentication.py index 3644f3a..0ad2bda 100644 --- a/tests/test_authentication.py +++ b/tests/test_authentication.py @@ -122,19 +122,6 @@ def test_auth_state_caching_across_instances( assert len(mocked_responses.calls) == 1 -def test_(auth_state): - load_response("token-introspect", case="success") - load_response("token", case="success") - with pytest.warns( - DeprecationWarning, - match="`required_authorizer_expiration_time` has no effect and will be removed", - ): - auth_state.get_authorizer_for_scope( - "urn:globus:auth:scope:groups.api.globus.org:view_my_groups_and_memberships", - required_authorizer_expiration_time=60, - ) - - def test_invalid_grant_exception(auth_state): load_response("token-introspect", case="success") load_response("token", case="invalid-grant")