Commit 2a0f8817 authored by Robin Sonnabend's avatar Robin Sonnabend

Support bytes as SECURITY_KEY

parent 93d19c52
......@@ -59,7 +59,9 @@ class UserManager:
class SecurityManager:
def __init__(self, key, max_duration=300):
self.maccer = hmac.new(key.encode("utf-8"), digestmod=hashlib.sha512)
if isinstance(key, str):
key = key.encode("utf-8")
self.maccer = hmac.new(key, digestmod=hashlib.sha512)
self.max_duration = max_duration
def hash_user(self, user):
......@@ -99,7 +101,7 @@ class StaticUserManager:
def __repr__(self):
users = [
(username, self.passwords[username], self.groups[username])
(username, self.passwords[username], self.group_map[username])
for username in self.passwords
]
return "StaticUserManager({})".format(users)
......
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