summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auth.wsgi26
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/auth.wsgi b/tests/auth.wsgi
index 39b6304..58e655b 100644
--- a/tests/auth.wsgi
+++ b/tests/auth.wsgi
@@ -1,6 +1,30 @@
def check_password(environ, user, password):
+ print('USER', user, environ['REQUEST_URI'])
if user == 'spy':
if password == 'secret':
- return 'grumpy'
+ return True
return False
+ elif user == 'witness':
+ if password == 'secret':
+ return 'protected'
+ return False
+ return None
return None
+
+import md5
+
+def get_realm_hash(environ, user, realm):
+ print('USER', user, environ['REQUEST_URI'])
+ if user == 'spy':
+ value = md5.new()
+ # user:realm:password
+ value.update('%s:%s:%s' % (user, realm, 'secret'))
+ hash = value.hexdigest()
+ return hash
+ return None
+
+def groups_for_user(environ, user):
+ print('GROUP', user, environ['REQUEST_URI'])
+ if user == 'spy':
+ return ['secret-agents']
+ return ['']