Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove required_authorizer_expiration_time #207

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.
14 changes: 1 addition & 13 deletions src/globus_action_provider_tools/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
13 changes: 0 additions & 13 deletions tests/test_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading