Skip to content

Commit 1682a5f

Browse files
committed
More robust.
1 parent 5cc042f commit 1682a5f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cryptojwt/jwt.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,11 @@ def unpack(self, token, timestamp=None):
395395
if self.msg_cls:
396396
_msg_cls = self.msg_cls
397397
else:
398+
_msg_cls = None
398399
# try to find an issuer specific message class
399-
_msg_cls = self.iss2msg_cls.get(_info["iss"])
400-
if not _msg_cls and 'typ' in _jws_header:
400+
if "iss" in _info:
401+
_msg_cls = self.iss2msg_cls.get(_info["iss"])
402+
if not _msg_cls and _jws_header and 'typ' in _jws_header:
401403
_msg_cls = self.typ2msg_cls.get(_jws_header['typ'])
402404

403405
timestamp = timestamp or utc_time_sans_frac()

0 commit comments

Comments
 (0)