Mercurial > hg > bitsyauth
annotate bitsyauth/factory.py @ 9:73b2b5bccd52
* allow logout to pass through instead of failing
* add a basic filter factory for single-user bitsyauth wrapper which reads bitsyblog users directory as format (this needs to be factored apart later)
author | egj@socialplanning.org |
---|---|
date | Mon, 04 Jan 2010 03:14:01 +0000 |
parents | c958eb9300da |
children |
rev | line source |
---|---|
8 | 1 from bitsyauth import BitsyAuth |
2 from paste.auth import digest | |
3 | |
9
73b2b5bccd52
* allow logout to pass through instead of failing
egj@socialplanning.org
parents:
8
diff
changeset
|
4 def passworder_factory(username, database): |
8 | 5 def passwords(): |
9
73b2b5bccd52
* allow logout to pass through instead of failing
egj@socialplanning.org
parents:
8
diff
changeset
|
6 passwords = database.passwords() |
73b2b5bccd52
* allow logout to pass through instead of failing
egj@socialplanning.org
parents:
8
diff
changeset
|
7 password = passwords[username] |
8 | 8 return {username: password} |
9 return passwords | |
9
73b2b5bccd52
* allow logout to pass through instead of failing
egj@socialplanning.org
parents:
8
diff
changeset
|
10 |
8 | 11 def filter_factory(global_conf, **app_conf): |
12 | |
13 user = app_conf['user'] | |
14 site = app_conf.get('site', 'bitsyauth') | |
15 secret = app_conf.get('secret', 'secret') | |
9
73b2b5bccd52
* allow logout to pass through instead of failing
egj@socialplanning.org
parents:
8
diff
changeset
|
16 |
73b2b5bccd52
* allow logout to pass through instead of failing
egj@socialplanning.org
parents:
8
diff
changeset
|
17 from bitsyblog.user import FilespaceUsers |
73b2b5bccd52
* allow logout to pass through instead of failing
egj@socialplanning.org
parents:
8
diff
changeset
|
18 |
73b2b5bccd52
* allow logout to pass through instead of failing
egj@socialplanning.org
parents:
8
diff
changeset
|
19 users_directory = FilespaceUsers( |
73b2b5bccd52
* allow logout to pass through instead of failing
egj@socialplanning.org
parents:
8
diff
changeset
|
20 app_conf['users_directory']) |
73b2b5bccd52
* allow logout to pass through instead of failing
egj@socialplanning.org
parents:
8
diff
changeset
|
21 |
73b2b5bccd52
* allow logout to pass through instead of failing
egj@socialplanning.org
parents:
8
diff
changeset
|
22 passwords = passworder_factory(user, users_directory) |
8 | 23 |
24 def filter(app): | |
9
73b2b5bccd52
* allow logout to pass through instead of failing
egj@socialplanning.org
parents:
8
diff
changeset
|
25 ret = BitsyAuth( |
8 | 26 app, |
27 global_conf, | |
28 passwords, | |
29 newuser=None, | |
30 site=site, | |
31 secret=secret) | |
9
73b2b5bccd52
* allow logout to pass through instead of failing
egj@socialplanning.org
parents:
8
diff
changeset
|
32 return ret |
8 | 33 return filter |