aboutsummaryrefslogtreecommitdiff
path: root/backend/ExternalAuth.py
blob: e6837ecbfdc53bfe332c39f648bfb6e3fc167a3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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