aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-12-31 11:31:00 -0600
committerFrederick Muriuki Muriithi2024-12-31 11:31:00 -0600
commit788953b146fd70a82da4d2bc6019387630b4db0e (patch)
treef3476890c6ef93d042e3d3f0ec5095f951f04cbc
parent9c05cb79e9404f481090ec3fb4ad8c07bb70f863 (diff)
downloadgn-auth-788953b146fd70a82da4d2bc6019387630b4db0e.tar.gz
Log out exceptions with the application's loggerHEADmain
-rw-r--r--gn_auth/auth/authentication/oauth2/models/oauth2client.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/gn_auth/auth/authentication/oauth2/models/oauth2client.py b/gn_auth/auth/authentication/oauth2/models/oauth2client.py
index 79b6e53..c7e1c90 100644
--- a/gn_auth/auth/authentication/oauth2/models/oauth2client.py
+++ b/gn_auth/auth/authentication/oauth2/models/oauth2client.py
@@ -1,6 +1,5 @@
"""OAuth2 Client model."""
import json
-import logging
import datetime
from uuid import UUID
from functools import cached_property
@@ -8,6 +7,7 @@ from dataclasses import asdict, dataclass
from typing import Any, Sequence, Optional
import requests
+from flask import current_app as app
from requests.exceptions import JSONDecodeError
from authlib.jose import KeySet, JsonWebKey
from authlib.oauth2.rfc6749 import ClientMixin
@@ -65,7 +65,7 @@ class OAuth2Client(ClientMixin):
jwksuri = self.client_metadata.get("public-jwks-uri")
__pk__(f"PUBLIC JWKs link for client {self.client_id}", jwksuri)
if not bool(jwksuri):
- logging.debug("No Public JWKs URI set for client!")
+ app.logger.debug("No Public JWKs URI set for client!")
return KeySet([])
try:
## IMPORTANT: This can cause a deadlock if the client is working in
@@ -76,13 +76,13 @@ class OAuth2Client(ClientMixin):
jwksuri,
allow_redirects=True).json()["jwks"]])
except requests.ConnectionError as _connerr:
- logging.debug(
+ app.logger.debug(
"Could not connect to provided URI: %s", jwksuri, exc_info=True)
except JSONDecodeError as _jsonerr:
- logging.debug(
+ app.logger.debug(
"Could not convert response to JSON", exc_info=True)
except Exception as _exc:# pylint: disable=[broad-except]
- logging.debug(
+ app.logger.debug(
"Error retrieving the JWKs for the client.", exc_info=True)
return KeySet([])