Skip to content

Commit

Permalink
Add VERIFY_ISSUER and VERIFY_AUDIENCE
Browse files Browse the repository at this point in the history
  • Loading branch information
lnagel committed Oct 9, 2019
1 parent 0e39ca4 commit 9712023
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ Full list of settings parameters with their defaults::
'DECODE_ALGORITHMS': None,
'VERIFY_SIGNATURE': True,
'VERIFY_EXPIRATION': True,
'VERIFY_ISSUER': True,
'VERIFY_AUDIENCE': True,
'VERIFY_SESSION_TOKEN': True,
'EXPIRATION_LEEWAY': 0,
'SESSION_EXPIRATION': None,
Expand Down
2 changes: 2 additions & 0 deletions rest_framework_sso/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
"DECODE_ALGORITHMS": None,
"VERIFY_SIGNATURE": True,
"VERIFY_EXPIRATION": True,
"VERIFY_ISSUER": True,
"VERIFY_AUDIENCE": True,
"VERIFY_SESSION_TOKEN": True,
"EXPIRATION_LEEWAY": 0,
"SESSION_EXPIRATION": None,
Expand Down
6 changes: 5 additions & 1 deletion rest_framework_sso/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ def decode_jwt_token(token):

public_key, key_id = get_public_key_and_key_id(issuer=unverified_issuer, key_id=unverified_key_id)

options = {"verify_exp": api_settings.VERIFY_EXPIRATION, "verify_aud": True, "verify_iss": True}
options = {
"verify_exp": api_settings.VERIFY_EXPIRATION,
"verify_iss": api_settings.VERIFY_ISSUER,
"verify_aud": api_settings.VERIFY_AUDIENCE,
}

payload = jwt.decode(
jwt=token,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setup(
name="djangorestframework-sso",
version="0.2.2",
version="0.2.3",
packages=find_packages(exclude=["tests"]),
include_package_data=True,
license="MIT License",
Expand Down

0 comments on commit 9712023

Please sign in to comment.