Switch back to using proxy-based authentication
Signed-off-by: AKP <tom@tdpain.net>
This commit is contained in:
parent
cef2f8421e
commit
ff5ed1348c
1 changed files with 14 additions and 0 deletions
|
@ -29,6 +29,20 @@ def is_actor_authed(actor):
|
|||
return required_user_group in actor.get("groups", {})
|
||||
|
||||
|
||||
@hookimpl
|
||||
def actor_from_request(request):
|
||||
# This is designed to convert Authentik proxy provider headers into an actor.
|
||||
# We're assuming every request is authenticated because that's how that provider works.
|
||||
rh = request.headers
|
||||
return {
|
||||
"id": rh.get("x-authentik-uid"),
|
||||
"name": rh.get("x-authentik-name"),
|
||||
"username": rh.get("x-authentik-username"),
|
||||
"email": rh.get("x-authentik-email"),
|
||||
"groups": rh.get("x-authentik-groups", "").split("|"),
|
||||
}
|
||||
|
||||
|
||||
@hookimpl
|
||||
def permission_allowed(actor, action):
|
||||
if action == "execute-sql" or action == "permissions-debug" or action == "debug-menu":
|
||||
|
|
Reference in a new issue