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

Prefer direct indexing over options.get() #552

Merged
merged 1 commit into from
Dec 18, 2020
Merged
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
12 changes: 6 additions & 6 deletions jwt/api_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,23 +126,23 @@ def _validate_claims(

now = timegm(datetime.utcnow().utctimetuple())

if "iat" in payload and options.get("verify_iat"):
if "iat" in payload and options["verify_iat"]:
self._validate_iat(payload, now, leeway)

if "nbf" in payload and options.get("verify_nbf"):
if "nbf" in payload and options["verify_nbf"]:
self._validate_nbf(payload, now, leeway)

if "exp" in payload and options.get("verify_exp"):
if "exp" in payload and options["verify_exp"]:
self._validate_exp(payload, now, leeway)

if options.get("verify_iss"):
if options["verify_iss"]:
self._validate_iss(payload, issuer)

if options.get("verify_aud"):
if options["verify_aud"]:
self._validate_aud(payload, audience)

def _validate_required_claims(self, payload, options):
for claim in options.get("require", []):
for claim in options["require"]:
if payload.get(claim) is None:
raise MissingRequiredClaimError(claim)

Expand Down