aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/__init__.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-04-25 08:01:15 +0300
committerFrederick Muriuki Muriithi2024-04-25 08:01:15 +0300
commit118c15bd84c2bccc8419a914b6bf3d84890e4fdb (patch)
tree1f0cc43b8560980ff40a08216e11ed9e5f938707 /gn_auth/__init__.py
parent9a53bf35e1a5165f8af8669cb3d2dfe2917f4d3d (diff)
downloadgn-auth-118c15bd84c2bccc8419a914b6bf3d84890e4fdb.tar.gz
Make `CLIENTS_SSL_PUBLIC_KEYS_DIR` explicitly a config setting.
Diffstat (limited to 'gn_auth/__init__.py')
-rw-r--r--gn_auth/__init__.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/gn_auth/__init__.py b/gn_auth/__init__.py
index 895f593..b3df070 100644
--- a/gn_auth/__init__.py
+++ b/gn_auth/__init__.py
@@ -24,7 +24,7 @@ def check_mandatory_settings(app: Flask) -> None:
undefined = tuple(
setting for setting in (
"SECRET_KEY", "SQL_URI", "AUTH_DB", "AUTH_MIGRATIONS",
- "OAUTH2_SCOPE", "SSL_PRIVATE_KEY", "UPLOADS_DIR")
+ "OAUTH2_SCOPE", "SSL_PRIVATE_KEY", "CLIENTS_SSL_PUBLIC_KEYS_DIR")
if not ((setting in app.config) and bool(app.config[setting])))
if len(undefined) > 0:
raise ConfigurationError(
@@ -57,10 +57,8 @@ def parse_ssl_keys(app):
with open(keypath) as _sslkey:# pylint: disable=[unspecified-encoding]
return JsonWebKey.import_key(_sslkey.read())
- key_storage_dir = Path(app.config["UPLOADS_DIR"]).joinpath(
- "clients-ssl-keys")
+ key_storage_dir = Path(app.config["CLIENTS_SSL_PUBLIC_KEYS_DIR"])
key_storage_dir.mkdir(exist_ok=True)
- app.config["CLIENTS_SSL_PUBLIC_KEYS_DIR"] = key_storage_dir
app.config["SSL_PUBLIC_KEYS"] = {
_key.as_dict()["kid"]: _key for _key in (
__parse_key__(Path(key_storage_dir).joinpath(key))