Mercurial > hg > bitsyauth
annotate bitsyauth/factory.py @ 52:aabc968611bc
STUB: bitsyauth/__init__.py
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 23 Feb 2014 17:08:13 -0800 |
parents | 73b2b5bccd52 |
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 |