From 284b5baaffdd26599224d9c69ecd8f202b7277cb Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 18 Jul 2024 16:48:18 -0500 Subject: Simplify jwks_directory() function Pass in the app object rather than a path and compute the secrets directory within the function. --- gn_auth/auth/jwks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gn_auth') 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(): -- cgit v1.2.3