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
Allows multiple values for 'iss' #31
Conversation
Current coverage is 95.78% (diff: 100%)@@ master #31 diff @@
==========================================
Files 7 7
Lines 496 498 +2
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 475 477 +2
Misses 21 21
Partials 0 0
|
""" | ||
|
||
if issuer is not None: | ||
if claims.get('iss') != issuer: | ||
if isinstance(issuer, string_types): | ||
issuer = [issuer] |
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.
Since we don't need to mutate this, can we construct this as a tuple instead of a list?
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.
Good point. I changed jws._get_keys()
to use a tuple as well, for consistency. (I do think 1-element tuples are kind of ugly, though)
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.
I can't disagree that they are ugly.
lgtm |
Apparently Google may send either
https://accounts.google.com
oraccounts.google.com
for their 'iss' value, so it's necessary to check both.This pull request allows passing a list or tuple to
jwt.decode(issuer=
so, for example, you can check against both valid Google values, instead of having to catch an exception and re-validate.