Changeset 1355
- Timestamp:
- 09/11/06 15:05:25
- Files:
-
- trunk/cherrypy/lib/auth.py (modified) (3 diffs)
- trunk/cherrypy/test/test_httpauth.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/lib/auth.py
r1354 r1355 1 import md5 1 2 import cherrypy 2 3 … … 13 14 14 15 if not encrypt: 15 encrypt = lambda x: x16 encrypt = lambda x: md5.new(x).hexdigest() 16 17 17 18 if callable(users): … … 37 38 users: a dict of the form: {username: password} or a callable returning a dict. 38 39 encrypt: callable used to encrypt the password returned from the user-agent. 40 if None it defaults to a md5 encryption. 39 41 """ 40 42 if check_auth(users, encrypt): trunk/cherrypy/test/test_httpauth.py
r1354 r1355 23 23 index.exposed = True 24 24 25 def md5_encrypt(data):26 return md5.new(data).hexdigest()27 28 25 def fetch_users(): 29 26 return {'test': 'test'} … … 34 31 '/basic': {'tools.basicauth.on': True, 35 32 'tools.basicauth.realm': 'localhost', 36 'tools.basicauth.users': {'test': md5_encrypt('test')}, 37 'tools.basicauth.encrypt': md5_encrypt}} 33 'tools.basicauth.users': {'test': md5.new('test').hexdigest()}}} 38 34 root = Root() 39 35 root.digest = DigestProtected()

