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