A simple authorization for authenticating users with known credentials.
@author: Craig Allwardt
def __init__(self, user_map):
Expected usermap of
self.users = user_map
[docs] def authenticate(self, username, password):
""" Authenticate that the user is known to the system.
Return groups of the user if the user is known otherwise returns None.
:return: list(groups) or None
if username in self.users.keys():
# Do a naive hash of the user supplied password and if success return
# the groups that the user holds.
if self.users[username]['password'] == hashlib.sha512(password).hexdigest():