Skip to content

Commit 6d7eb6a

Browse files
committed
chore: JWT warnings on failed JWT ops
I'd like to have a warning meggase on failing JWT validations, or may use a debug for that and not a warning?
1 parent ec79b98 commit 6d7eb6a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/cryptojwt/jwt.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,11 +372,12 @@ def unpack(self, token):
372372
if self.msg_cls:
373373
_msg_cls = self.msg_cls
374374
else:
375-
try:
376-
# try to find a issuer specific message class
377-
_msg_cls = self.iss2msg_cls[_info["iss"]]
378-
except KeyError:
379-
_msg_cls = None
375+
_msg_cls = self.iss2msg_cls.get(_info["iss"], None)
376+
if not _msg_cls:
377+
LOGGER.warning(
378+
"Exception unpacking a received JWT "
379+
f"for the issuer {_info['iss']}"
380+
)
380381

381382
if _msg_cls:
382383
vp_args = {"skew": self.skew}

0 commit comments

Comments
 (0)