diff options
author | Frederick Muriuki Muriithi | 2024-07-18 16:48:18 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-07-31 09:30:19 -0500 |
commit | 284b5baaffdd26599224d9c69ecd8f202b7277cb (patch) | |
tree | 196ace91215e82a38fd682c7b87f05055fc392ad | |
parent | ca83384d5d5ad24a6a9df313aed6ffdfc31770b5 (diff) | |
download | gn-auth-284b5baaffdd26599224d9c69ecd8f202b7277cb.tar.gz |
Simplify jwks_directory() function
Pass in the app object rather than a path and compute the secrets
directory within the function.
-rw-r--r-- | gn_auth/auth/jwks.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gn_auth/auth/jwks.py b/gn_auth/auth/jwks.py index 7c091b8..1352b95 100644 --- a/gn_auth/auth/jwks.py +++ b/gn_auth/auth/jwks.py @@ -4,11 +4,13 @@ from pathlib import Path from typing import Any, Union from datetime import datetime +from flask import Flask from authlib.jose import JsonWebKey from pymonad.either import Left, Right, Either -def jwks_directory(appsecretsdir: Path) -> Path: +def jwks_directory(app: Flask) -> Path: """Compute the directory where the JWKs are stored.""" + appsecretsdir = Path(app.config["GN_AUTH_SECRETS"]).parent if appsecretsdir.exists() and appsecretsdir.is_dir(): jwksdir = Path(appsecretsdir, "jwks/") if not jwksdir.exists(): |