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

Skip verification of JWT's iat claim #394

Merged
merged 1 commit into from
Aug 29, 2024
Merged
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
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ development source code and as such may not be routinely kept up to date.

# __NEXT__

## Bug fixes

* JWT authentication (e.g. `nextstrain login`) no longer verifies the issued at
(iat) claim. This should resolve issues for users who's system time was
slightly lagged and who were thus unable to login.
([#394](https://github.com/nextstrain/cli/pull/394))

# 8.5.2 (27 August 2024)

Expand Down
7 changes: 5 additions & 2 deletions nextstrain/cli/authn/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,8 @@ def verify_tokens(self, *, id_token, access_token, refresh_token):

def _verify_id_token(self, token):
"""
Verifies all aspects of the given ID *token* (a signed JWT).
Verifies all aspects of the given ID *token* (a signed JWT) except for the iat
(issued at claim, see <https://github.com/nextstrain/cli/issues/307>)

Assertions about expected algorithms, audience, issuer, and token use
follow guidelines from
Expand All @@ -656,7 +657,9 @@ def _verify_id_token(self, token):
algorithms = ["RS256"],
audience = self.client_configuration["client_id"],
issuer = self.openid_configuration["issuer"],
options = { "require": ["exp"] })
options = { "require": ["exp"],
"verify_iat": False,
})

except jwt.exceptions.ExpiredSignatureError:
raise ExpiredTokenError(use)
Expand Down
Loading