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

Fix incorrect documentation for jwt #651

Merged
merged 4 commits into from Apr 28, 2021

Conversation

johachi
Copy link
Contributor

@johachi johachi commented Apr 27, 2021

Description

  • Fix incorrect default values in the documentation. (0b537a4): verify_aud, verify_iat, verify_exp, and verify_iss is True by default

    pyjwt/jwt/api_jwt.py

    Lines 26 to 35 in 3993ce1

    def _get_default_options() -> Dict[str, Union[bool, List[str]]]:
    return {
    "verify_signature": True,
    "verify_exp": True,
    "verify_nbf": True,
    "verify_iat": True,
    "verify_aud": True,
    "verify_iss": True,
    "require": [],
    }

    pyjwt/jwt/api_jwt.py

    Lines 98 to 100 in 3993ce1

    if options["verify_signature"]:
    merged_options = {**self.options, **options}
    self._validate_claims(payload, merged_options, **kwargs)
  • Add missing option verify_nbf to documentation (e92ef3d)

    pyjwt/jwt/api_jwt.py

    Lines 132 to 133 in 3993ce1

    if "nbf" in payload and options["verify_nbf"]:
    self._validate_nbf(payload, now, leeway)
  • Set require to be list (692adae)

    pyjwt/jwt/api_jwt.py

    Lines 144 to 147 in 3993ce1

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

@jpadilla jpadilla added the docs label Apr 28, 2021
Copy link
Owner

@jpadilla jpadilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ thanks!

@jpadilla jpadilla merged commit 0da4223 into jpadilla:master Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants