diff options
-rw-r--r-- | gn3/oauth2/authorisation.py | 2 | ||||
-rw-r--r-- | gn3/oauth2/jwks.py | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/gn3/oauth2/authorisation.py b/gn3/oauth2/authorisation.py index 3864455..b2dd1ae 100644 --- a/gn3/oauth2/authorisation.py +++ b/gn3/oauth2/authorisation.py @@ -1,12 +1,12 @@ """Handle authorisation with auth server.""" from functools import wraps -from authlib.jose import jwt from flask import request, jsonify, current_app as app from gn3.oauth2 import jwks from gn3.oauth2.errors import TokenValidationError + def require_token(func): """Check for and verify bearer token.""" @wraps(func) diff --git a/gn3/oauth2/jwks.py b/gn3/oauth2/jwks.py index adaa3e9..8798a3f 100644 --- a/gn3/oauth2/jwks.py +++ b/gn3/oauth2/jwks.py @@ -16,6 +16,8 @@ def fetch_jwks(authserveruri: str, path: str = "auth/public-jwks") -> KeySet: if response.status_code == 200: return KeySet([ JsonWebKey.import_key(key) for key in response.json()["jwks"]]) + # XXXX: TODO: Catch specific exception we need. + # pylint: disable=W0703 except Exception as _exc: app.logger.debug("There was an error fetching the JSON Web Keys.", exc_info=True) @@ -26,7 +28,6 @@ def fetch_jwks(authserveruri: str, path: str = "auth/public-jwks") -> KeySet: def validate_token(token: str, keys: KeySet) -> dict: """Validate the token against the given keys.""" for key in keys.keys: - kd = key.as_dict() try: return JsonWebToken(["RS256"]).decode(token, key=key) except BadSignatureError as _bse: |