aboutsummaryrefslogtreecommitdiff
path: root/backend/ExternalAuth.py
diff options
context:
space:
mode:
Diffstat (limited to 'backend/ExternalAuth.py')
-rw-r--r--backend/ExternalAuth.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/backend/ExternalAuth.py b/backend/ExternalAuth.py
new file mode 100644
index 0000000..e6837ec
--- /dev/null
+++ b/backend/ExternalAuth.py
@@ -0,0 +1,22 @@
+import config
+import utils
+
+# This authentication provider assumes that the actual authentication is done in
+# an upstream component such as the serving httpd.
+# The authorized user is expected to be passed in the uwsgi environment variable REMOTE_USER.
+
+def login(env, post):
+ user = get(env)
+ if not User:
+ return utils.redirect(config.homepage)
+
+ utils.ensure_user(user["user"])
+ return utils.redirect("/admin")
+
+def get(env):
+ if env.get('REMOTE_USER', ''):
+ return {"user": env.get('REMOTE_USER', ''), "expire": None}
+ return None
+
+def logout():
+ return False