Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1355

Show
Ignore:
Timestamp:
09/11/06 15:05:25
Author:
lawouach
Message:

Basic encryption now defaults to md5 if not provided. It means that by default passwords should be stored encrypted on the server.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/lib/auth.py

    r1354 r1355  
     1import md5 
    12import cherrypy 
    23 
     
    1314 
    1415        if not encrypt: 
    15             encrypt = lambda x: x 
     16            encrypt = lambda x: md5.new(x).hexdigest() 
    1617 
    1718        if callable(users): 
     
    3738    users: a dict of the form: {username: password} or a callable returning a dict. 
    3839    encrypt: callable used to encrypt the password returned from the user-agent. 
     40             if None it defaults to a md5 encryption. 
    3941    """ 
    4042    if check_auth(users, encrypt): 
  • trunk/cherrypy/test/test_httpauth.py

    r1354 r1355  
    2323        index.exposed = True 
    2424 
    25     def md5_encrypt(data): 
    26         return md5.new(data).hexdigest() 
    27  
    2825    def fetch_users(): 
    2926        return {'test': 'test'} 
     
    3431            '/basic': {'tools.basicauth.on': True, 
    3532                       '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()}}} 
    3834    root = Root() 
    3935    root.digest = DigestProtected() 

Hosted by WebFaction

Log in as guest/cpguest to create tickets