Skip to content

Commit

Permalink
make sure we have refresh_token before refreshing
Browse files Browse the repository at this point in the history
we are not guaranteed to have it
  • Loading branch information
martenson committed Jan 16, 2025
1 parent 2832aa3 commit 6b390e5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/galaxy/authnz/custos_authnz.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def refresh(self, trans, custos_authnz_token):
# do not refresh tokens if the id_token didn't reach its half-life
if int(id_token_decoded["iat"]) + int(id_token_decoded["exp"]) > 2 * int(time.time()):
return False
if not custos_authnz_token.refresh_token:
return False
refresh_token_decoded = self._decode_token_no_signature(custos_authnz_token.refresh_token)
# do not attempt to use refresh token that is already expired
if int(refresh_token_decoded["exp"]) > int(time.time()):
Expand Down

0 comments on commit 6b390e5

Please sign in to comment.