Skip to content

Commit

Permalink
Merge pull request #224 from NickolausDS/remove-token-check
Browse files Browse the repository at this point in the history
fix: Remove un-used validate_token() function
  • Loading branch information
NickolausDS committed Jun 17, 2024
2 parents 272a9ff + 20e59ff commit 07b0323
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
4 changes: 2 additions & 2 deletions globus_portal_framework/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from globus_portal_framework.gclients import (
load_auth_client, load_transfer_client, load_search_client,
load_globus_client, load_globus_access_token, validate_token,
load_globus_client, load_globus_access_token,
)

from globus_portal_framework.gsearch import (
Expand All @@ -35,7 +35,7 @@
'GroupsException', 'PortalAuthException',

'load_auth_client', 'load_transfer_client', 'load_search_client',
'load_globus_client', 'load_globus_access_token', 'validate_token',
'load_globus_client', 'load_globus_access_token',

'post_search', 'get_subject', 'get_index', 'get_template',
'process_search_data', 'get_pagination',
Expand Down
12 changes: 0 additions & 12 deletions globus_portal_framework/gclients.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,6 @@
log = logging.getLogger(__name__)


def validate_token(tok):
"""Validate if the given token is active.
:returns: True if active
:raises globus_sdk.ExpiredGlobusToken: if token has expired."""
ac = globus_sdk.ConfidentialAppAuthClient(
settings.SOCIAL_AUTH_GLOBUS_KEY,
settings.SOCIAL_AUTH_GLOBUS_SECRET
)
return ac.oauth2_validate_token(tok).get('active', False)


def revoke_globus_tokens(user):
"""
Revoke all of a user's Globus tokens.
Expand Down
4 changes: 1 addition & 3 deletions globus_portal_framework/gtransfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
PreviewPermissionDenied, PreviewServerError, PreviewException,
PreviewBinaryData, PreviewNotFound, ExpiredGlobusToken,

load_transfer_client, load_globus_access_token, validate_token
load_transfer_client, load_globus_access_token
)

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -196,8 +196,6 @@ def preview(user, url, scope, chunk_size=512):
# formats), this should always work.
return '\n'.join(chunk.split('\n')[:-1])
elif r.status_code == 401:
if not validate_token(token):
raise ExpiredGlobusToken(token_name=scope)
raise PreviewPermissionDenied()
elif r.status_code == 403:
raise PreviewPermissionDenied()
Expand Down

0 comments on commit 07b0323

Please sign in to comment.