-
-
Notifications
You must be signed in to change notification settings - Fork 687
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
Allow list of valid audiences (#205 continued) #306
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d50e53b
Resolved issue #205, Allow a list of valid audiences to be configured
0bc8ad9
Take care of review comments related to audience list.
fcf32b3
Merge branch 'master' into master
vinod-teamrubrics dd3df0f
check type of audience parameter in old place
34a33f3
Merge remote-tracking branch 'upstream/master'
db5951e
update changelog
02b8162
fix linter errors
c3d9437
fix changelog
r-springer 504f63c
- support Iterable for audience instead of just list to be more generic
r-springer 6fa0f74
check for audience claims not being valid instead of being valid and …
r-springer 0a0a423
spell iterable without capital I, remove unnecessary return
r-springer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,5 @@ Patches and Suggestions | |
- Wouter Bolsterlee <[email protected]> | ||
|
||
- Michael Davis <[email protected]> <[email protected]> | ||
|
||
- Vinod Gupta <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import binascii | ||
import json | ||
import warnings | ||
|
||
from collections import Mapping | ||
|
||
from .algorithms import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
|
||
import json | ||
|
||
from decimal import Decimal | ||
|
||
from jwt.algorithms import Algorithm | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
|
||
import json | ||
import time | ||
|
||
from calendar import timegm | ||
from datetime import datetime, timedelta | ||
from decimal import Decimal | ||
|
@@ -92,7 +91,7 @@ def test_decode_with_invalid_audience_param_throws_exception(self, jwt): | |
jwt.decode(example_jwt, secret, audience=1) | ||
|
||
exception = context.value | ||
assert str(exception) == 'audience must be a string or None' | ||
assert str(exception) == 'audience must be a string, Iterable, or None' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's probably ok to just say |
||
|
||
def test_decode_with_nonlist_aud_claim_throws_exception(self, jwt): | ||
secret = 'secret' | ||
|
@@ -281,6 +280,23 @@ def test_check_audience_when_valid(self, jwt): | |
token = jwt.encode(payload, 'secret') | ||
jwt.decode(token, 'secret', audience='urn:me') | ||
|
||
def test_check_audience_list_when_valid(self, jwt): | ||
payload = { | ||
'some': 'payload', | ||
'aud': 'urn:me' | ||
} | ||
token = jwt.encode(payload, 'secret') | ||
jwt.decode(token, 'secret', audience=['urn:you', 'urn:me']) | ||
|
||
def test_raise_exception_invalid_audience_list(self, jwt): | ||
payload = { | ||
'some': 'payload', | ||
'aud': 'urn:me' | ||
} | ||
token = jwt.encode(payload, 'secret') | ||
with pytest.raises(InvalidAudienceError): | ||
jwt.decode(token, 'secret', audience=['urn:you', 'urn:him']) | ||
|
||
def test_check_audience_in_array_when_valid(self, jwt): | ||
payload = { | ||
'some': 'payload', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import os | ||
import struct | ||
|
||
from calendar import timegm | ||
from datetime import datetime | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
return
is extraneous since we're at the end of the function, right?