Skip to content

Commit

Permalink
added if statement for py3 or py2 in verify_token
Browse files Browse the repository at this point in the history
  • Loading branch information
bjinwright committed Apr 24, 2017
1 parent 27cd48f commit 25e3b67
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion warrant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import boto3
import datetime
import requests
import six

from envs import env
from jose import jwk, jwt
Expand Down Expand Up @@ -153,7 +154,10 @@ def verify_token(self,token,id_name,token_use):
hmac_key = self.get_key(kid)
key = jwk.construct(hmac_key)
message, encoded_sig = token.rsplit('.', 1)
decoded_sig = base64url_decode(str(encoded_sig))
if six.PY3:
decoded_sig = base64url_decode(six.b(encoded_sig))
else:
decoded_sig = base64url_decode(str(encoded_sig))
verified = key.verify(message, decoded_sig)
if verified:
setattr(self,id_name,token)
Expand Down

0 comments on commit 25e3b67

Please sign in to comment.