2004-05-30 | paulb | file changeset files shortlog | [project @ 2004-05-30 15:33:55 by paulb] Renamed the simple with login example module. Introduced anonymous user details into the login application. |
paulb@125 | 1 | #!/usr/bin/env python |
paulb@125 | 2 | |
paulb@125 | 3 | from WebStack.Adapters import BaseHTTPRequestHandler |
paulb@125 | 4 | from Login import LoginResource, LoginAuthenticator |
paulb@125 | 5 | import BaseHTTPServer |
paulb@125 | 6 | |
paulb@125 | 7 | # Special magic incantation. |
paulb@125 | 8 | |
paulb@125 | 9 | handler = BaseHTTPRequestHandler.HandlerFactory( |
paulb@129 | 10 | LoginResource( |
paulb@129 | 11 | LoginAuthenticator( |
paulb@129 | 12 | secret_key="horses", |
paulb@129 | 13 | credentials=( |
paulb@129 | 14 | ("badger", "abc"), |
paulb@129 | 15 | ("vole", "xyz"), |
paulb@129 | 16 | ) |
paulb@147 | 17 | ), |
paulb@147 | 18 | anonymous_parameter_name="anonymous" |
paulb@129 | 19 | ) |
paulb@125 | 20 | ) |
paulb@125 | 21 | address = ("", 8081) |
paulb@125 | 22 | server = BaseHTTPServer.HTTPServer(address, handler) |
paulb@129 | 23 | print "Serving..." |
paulb@125 | 24 | server.serve_forever() |
paulb@125 | 25 | |
paulb@125 | 26 | # vim: tabstop=4 expandtab shiftwidth=4 |