No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dummy_auth.py 746B

123456789101112131415161718192021
  1. #-*- coding: utf-8 -*-
  2. from Lodel.user import authentication_method, identification_method, UserIdentity
  3. @authentication_method
  4. def dummy_auth(identifier, proof):
  5. print("Trying to authenticate user %s" % identifier)
  6. if identifier == proof:
  7. print("%s authenticated" % identifier)
  8. return UserIdentity(identifier, identifier, "User %s" % identifier, authenticated = True)
  9. return False
  10. @identification_method
  11. def dummy_identify(client_infos):
  12. print("Trying to identify client with %s" % client_infos)
  13. if 'ip' in client_infos:
  14. ip = client_infos['ip']
  15. if ip in ['localhost', '127.0.0.1', 'local']:
  16. return UserIdentity(0, 'localuser', 'local user', identifier = True)
  17. return False