diff options
author | Munyoki Kilyungi | 2024-08-13 14:42:05 +0300 |
---|---|---|
committer | BonfaceKilz | 2024-08-13 14:44:47 +0300 |
commit | 737631b7106d0916dfca75cd5971a9914659bfa7 (patch) | |
tree | eb1b38fddb4a821d7200d33cbc64749560b0aaba /gn3/oauth2 | |
parent | 1ec001c4490a5c78075c3fa434fa4e8cd9aaa1a8 (diff) | |
download | genenetwork3-737631b7106d0916dfca75cd5971a9914659bfa7.tar.gz |
Fix pylint errors.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn3/oauth2')
-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: |