From f1265a14a6ecdfb1b661c78ba8410bab2a91b53e Mon Sep 17 00:00:00 2001 From: Niko Lindroos Date: Wed, 28 Aug 2024 14:41:01 +0300 Subject: [PATCH] fix: oidc debug extra usage KK-1168 --- kukkuu/oidc.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/kukkuu/oidc.py b/kukkuu/oidc.py index 4e359360..00f02ebb 100644 --- a/kukkuu/oidc.py +++ b/kukkuu/oidc.py @@ -72,7 +72,9 @@ def _validate_symmetrically_signed_jwt(self, jwt: JWT): The `helusers` always uses a issuer specific `OIDCConfig` that fetches the keys from a server (from a path "/.well-known/openid-configuration"). """ - logger.debug("Validating a symmetrically signed test JWT", extra=jwt) + logger.debug( + "Validating a symmetrically signed test JWT", extra={"jwt_str": str(jwt)} + ) try: jwt.validate_issuer() except ValidationError as e: @@ -118,9 +120,15 @@ def authenticate_test_user(self, jwt: JWT): """ logger.info("Authenticating with a test JWT!") self._validate_symmetrically_signed_jwt(jwt) - logger.debug("The symmetrically signed JWT was valid.", extra=jwt) + logger.debug( + "The symmetrically signed JWT was valid.", extra={"jwt_str": str(jwt)} + ) user = get_or_create_user(jwt.claims, oidc=True) - logger.debug("The user %s returned from get_or_create_user", user, extra=user) + logger.debug( + "The user %s returned from get_or_create_user", + user, + extra={"user_dict": user.__dict__ if user else None}, + ) return UserAuthorization(user, jwt.claims) def authenticate(self, request):