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

Test impact of adding claims to JWT #4821

Closed
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
11 changes: 10 additions & 1 deletion tests/infra/jwt_issuer.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,16 @@ def start_openid_server(self, port=0, kid=TEST_JWT_KID):
return self.server

def issue_jwt(self, kid=TEST_JWT_KID, claims=None):
return infra.crypto.create_jwt(claims or {}, self.key_priv_pem, kid)
claims = claims or {}
# JWT times format NumericDate, which is a JSON numeric value counting seconds sine the epoch
now = int(time.time())
if "nbf" not in claims:
# Insert default Not Before claim, valid from ~10 seconds ago
claims["nbf"] = now - 10
if "exp" not in claims:
# Insert default Expiration Time claim, valid for ~1hr
claims["exp"] = now + 3600
return infra.crypto.create_jwt(claims, self.key_priv_pem, kid)

def wait_for_refresh(self, network, kid=TEST_JWT_KID):
timeout = self.refresh_interval * 3
Expand Down