providers/oauth2: handle attribute errors when validation JWK contains private key

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-05-25 22:23:05 +02:00
parent e42386b150
commit 0e0dd2437b

View file

@ -311,8 +311,10 @@ class TokenParams:
"verify_aud": False,
},
)
except (InvalidTokenError, ValueError, TypeError) as last_exc:
LOGGER.warning("failed to validate jwt", last_exc=last_exc)
# AttributeError is raised when the configured JWK is a private key
# and not a public key
except (InvalidTokenError, ValueError, TypeError, AttributeError) as exc:
LOGGER.warning("failed to validate jwt", exc=exc)
if not token:
LOGGER.warning("No token could be verified")