Skip to content

Commit

Permalink
Warn about missing algorithms arg only when verify is True
Browse files Browse the repository at this point in the history
Since no signature verification will occur, passing in `algorithms` does
not make much sense.
  • Loading branch information
suligap committed Jul 4, 2017
1 parent 74399b1 commit 9e63858
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jwt/api_jws.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def encode(self, payload, key, algorithm='HS256', headers=None,
def decode(self, jws, key='', verify=True, algorithms=None, options=None,
**kwargs):

if not algorithms:
if verify and not algorithms:
warnings.warn(
'It is strongly recommended that you pass in a ' +
'value for the "algorithms" argument when calling decode(). ' +
Expand Down
2 changes: 1 addition & 1 deletion jwt/api_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def encode(self, payload, key, algorithm='HS256', headers=None,
def decode(self, jwt, key='', verify=True, algorithms=None, options=None,
**kwargs):

if not algorithms:
if verify and not algorithms:
warnings.warn(
'It is strongly recommended that you pass in a ' +
'value for the "algorithms" argument when calling decode(). ' +
Expand Down

0 comments on commit 9e63858

Please sign in to comment.