Commit f8939ef5 authored by Robin Sonnabend's avatar Robin Sonnabend

Add static user backend for testing purposes

parent 6c92b00d
......@@ -135,6 +135,30 @@ class ADManager:
for result in
class StaticUserManager:
def __init__(self, users):
self.passwords = {
username: password
for (username, password, groups) in users
self.groups = {
username: groups
for (username, password, groups) in users
def authenticate(self, username, password):
return (username in self.passwords
and self.passwords[username] == password)
def groups(self, username, password=None):
if username in self.groups:
yield from self.groups[username]
def all_groups(self):
return list(set(group for group in groups.values()))
class SecurityManager:
def __init__(self, key, max_duration=300):
self.maccer ="utf-8"), digestmod=hashlib.sha512)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment