diff options
author | Frederick Muriuki Muriithi | 2024-11-04 16:08:26 -0600 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-11-04 16:09:12 -0600 |
commit | 578a8ebe14bcc116c8cf12736a06cd56595b80fb (patch) | |
tree | f32a546484961796e601e8b381f5bd4cefd7f078 /gn2/wqflask | |
parent | fb98c5389836c71f206c03f061b95ad0c0d1761c (diff) | |
download | genenetwork2-578a8ebe14bcc116c8cf12736a06cd56595b80fb.tar.gz |
Add debug logging: Figure out how keys are loaded on production.
Diffstat (limited to 'gn2/wqflask')
-rw-r--r-- | gn2/wqflask/oauth2/jwks.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gn2/wqflask/oauth2/jwks.py b/gn2/wqflask/oauth2/jwks.py index efd04997..08dfd8c4 100644 --- a/gn2/wqflask/oauth2/jwks.py +++ b/gn2/wqflask/oauth2/jwks.py @@ -8,6 +8,8 @@ from flask import Flask from authlib.jose import JsonWebKey from pymonad.either import Left, Right, Either +from gn2.debug import __pk__ + def jwks_directory(app: Flask, configname: str) -> Path: """Compute the directory where the JWKs are stored.""" appsecretsdir = Path(app.config[configname]).parent @@ -44,10 +46,11 @@ def pem_to_jwk(filepath: Path) -> JsonWebKey: def __sorted_jwks_paths__(storagedir: Path) -> tuple[tuple[float, Path], ...]: """A sorted list of the JWK file paths with their creation timestamps.""" - return tuple(sorted(((os.stat(keypath).st_ctime, keypath) - for keypath in (Path(storagedir, keyfile) - for keyfile in os.listdir(storagedir) - if keyfile.endswith(".pem"))), + all_files = tuple(__pk__("STORAGE DIRECTORY ===========>", storagedir).iterdir()) + return tuple(sorted(((os.stat(keypath).st_ctime, __pk__("FOUND KEY ==========>", keypath)) + for keypath in (keyfile + for keyfile in __pk__("DIRECTORY CONTENT", all_files) + if __pk__("KEYFILE SUFFIX ========>", keyfile.suffix) == ".pem")), key=lambda tpl: tpl[0])) |