diff options
author | Frederick Muriuki Muriithi | 2024-04-18 20:19:56 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-04-23 11:49:07 +0300 |
commit | 3838adf514ce0a5a1dc056521e0282d95ea619c9 (patch) | |
tree | 2d4818f81f3e341cbfb616a33685da760916ef28 | |
parent | 4516c4f77af4f8da1dbc89c294c4733b7f28d65b (diff) | |
download | genenetwork2-3838adf514ce0a5a1dc056521e0282d95ea619c9.tar.gz |
SSL_KEY_PAIR_PUBLIC_KEY: New setting
Define a new setting named SSL_KEY_PAIR_PUBLIC_KEY to hold the path
to the SSL key-pair's public key, used with the JWTs.
-rw-r--r-- | gn2/wqflask/__init__.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gn2/wqflask/__init__.py b/gn2/wqflask/__init__.py index 1f69c085..40953522 100644 --- a/gn2/wqflask/__init__.py +++ b/gn2/wqflask/__init__.py @@ -10,6 +10,7 @@ from urllib.parse import urljoin, urlparse import redis import jinja2 from flask_session import Session +from authlib.jose import JsonWebKey from authlib.integrations.requests_client import OAuth2Session from flask import g, Flask, flash, session, url_for, redirect, current_app @@ -107,6 +108,9 @@ except StartupError as serr: server_session = Session(app) +with open(app.config["SSL_KEY_PAIR_PUBLIC_KEY"]) as _sslkey: + app.config["JWT_PUBLIC_KEY"] = JsonWebKey.import_key(_sslkey.read()) + @app.before_request def before_request(): g.request_start_time = time.time() |