|
Revision 93
(checked in by thejimmyg, 1 year ago)
|
Adding a config example and tests
|
| Line | |
|---|
| 1 |
from authkit.authenticate import middleware, sample_app |
|---|
| 2 |
from authkit.authenticate.digest import digest_password |
|---|
| 3 |
|
|---|
| 4 |
def digest(environ, realm, username): |
|---|
| 5 |
password = username |
|---|
| 6 |
return digest_password(realm, username, password) |
|---|
| 7 |
|
|---|
| 8 |
config = { |
|---|
| 9 |
'authkit.setup.method':'digest', |
|---|
| 10 |
'authkit.digest.realm':'Test Realm', |
|---|
| 11 |
'authkit.digest.authenticate.function':digest, |
|---|
| 12 |
'authkit.setup.enable':'True', |
|---|
| 13 |
} |
|---|
| 14 |
|
|---|
| 15 |
app = middleware( |
|---|
| 16 |
sample_app, |
|---|
| 17 |
app_conf = config |
|---|
| 18 |
) |
|---|
| 19 |
|
|---|
| 20 |
if __name__ == '__main__': |
|---|
| 21 |
from paste.httpserver import serve |
|---|
| 22 |
serve(app, host='0.0.0.0', port=8080) |
|---|
| 23 |
|
|---|