summaryrefslogtreecommitdiffstats
path: root/aurweb/asgi.py
diff options
context:
space:
mode:
authorFrédéric Mangano-Tarumi <fmang@mg0.fr>2020-06-04 22:00:20 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2021-02-20 17:24:30 +0100
commit3b347d3989592293661a47a5bac7645afb8d61d6 (patch)
treeea3f86cadb041c46580e3c9ef7a3a2bb6a70a056 /aurweb/asgi.py
parentb1300117ac6fc0f5e9cf1048576db8fb97470bcc (diff)
downloadaur-3b347d3989592293661a47a5bac7645afb8d61d6.tar.gz
aur-3b347d3989592293661a47a5bac7645afb8d61d6.tar.xz
Crude OpenID Connect client using Authlib
Developers can go to /sso/login to get redirected to the SSO. On successful login, the ID token is displayed. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'aurweb/asgi.py')
-rw-r--r--aurweb/asgi.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/aurweb/asgi.py b/aurweb/asgi.py
index 9bb71ecc..60c7ade7 100644
--- a/aurweb/asgi.py
+++ b/aurweb/asgi.py
@@ -1,3 +1,16 @@
from fastapi import FastAPI
+from starlette.middleware.sessions import SessionMiddleware
+
+import aurweb.config
+
+from aurweb.routers import sso
app = FastAPI()
+
+session_secret = aurweb.config.get("fastapi", "session_secret")
+if not session_secret:
+ raise Exception("[fastapi] session_secret must not be empty")
+
+app.add_middleware(SessionMiddleware, secret_key=session_secret)
+
+app.include_router(sso.router)