Skip to content

Commit

Permalink
Merge pull request #4538 from zenoss/ZING-35683
Browse files Browse the repository at this point in the history
ZING-35683: Fix issue with users receiving Unauthorized error rather than being sent to log back in
  • Loading branch information
joshw authored Sep 10, 2024
2 parents 94d812d + 0771979 commit 2c8d64f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Products/ZenUtils/Auth0/Auth0.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,15 @@ def challenge(self, request, response):
# It's possible for a fresh start to get here, but ZC has already
# logged us in. If we have a JWT token, try to use that before
# redirecting to ZC.
sessionInfo = request.SESSION.get(Auth0.session_key)
if not sessionInfo:
token = request.cookies.get(Auth0.zc_token_key, None)
if token:
token = request.cookies.get(Auth0.zc_token_key, None)
if token:
sessionInfo = request.SESSION.get(Auth0.session_key)
if not sessionInfo:
sessionInfo = self.storeToken(token, request, conf)
else:
# If we don't have a token cookie, disregard any previous sessionInfo.
# The user no longer has a valid session.
sessionInfo = None

if not sessionInfo:
# There is no valid access token, so we must redirect back to auth0 to obtain one.
Expand Down

0 comments on commit 2c8d64f

Please sign in to comment.