From 737631b7106d0916dfca75cd5971a9914659bfa7 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Tue, 13 Aug 2024 14:42:05 +0300 Subject: Fix pylint errors. Signed-off-by: Munyoki Kilyungi --- gn3/oauth2/authorisation.py | 2 +- gn3/oauth2/jwks.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'gn3/oauth2') 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: -- cgit v1.2.3