paulb@139 | 1 | #!/usr/bin/env python |
paulb@139 | 2 | |
paulb@570 | 3 | # Uncomment and adjust the paths below if WebStack is not installed somewhere |
paulb@570 | 4 | # on the PYTHONPATH. |
paulb@139 | 5 | |
paulb@570 | 6 | #import sys |
paulb@570 | 7 | #sys.path.append("/home/paulb/Software/Python/WebStack") |
paulb@570 | 8 | #sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common") |
paulb@139 | 9 | |
paulb@324 | 10 | from WebStack.Adapters.CGI import deploy |
paulb@154 | 11 | from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator |
paulb@666 | 12 | from WebStack.Resources.Login import LoginResource, LoginAuthenticator |
paulb@666 | 13 | from WebStack.Resources.ResourceMap import MapResource |
paulb@139 | 14 | from Simple import SimpleResource |
paulb@139 | 15 | |
paulb@324 | 16 | deploy( |
paulb@666 | 17 | MapResource({ |
paulb@666 | 18 | "simple" : |
paulb@666 | 19 | LoginRedirectResource( |
paulb@666 | 20 | login_url="http://localhost/cgi/login", # Change this to be the exact URL on your server. |
paulb@666 | 21 | # eg. http://localhost:8000/cgi/LoginHandler.py |
paulb@666 | 22 | app_url="http://localhost", # Change this to be the URL base for your server. |
paulb@666 | 23 | # eg. http://localhost:8000 |
paulb@666 | 24 | # Note that the login application can be placed on |
paulb@666 | 25 | # a different server if desirable. |
paulb@666 | 26 | resource=SimpleResource(), |
paulb@666 | 27 | authenticator=LoginRedirectAuthenticator(secret_key="horses"), |
paulb@666 | 28 | anonymous_parameter_name="anonymous", |
paulb@666 | 29 | logout_parameter_name="logout" |
paulb@666 | 30 | ), |
paulb@666 | 31 | "login" : |
paulb@666 | 32 | LoginResource( |
paulb@666 | 33 | LoginAuthenticator( |
paulb@666 | 34 | secret_key="horses", |
paulb@666 | 35 | credentials=( |
paulb@666 | 36 | ("badger", "abc"), |
paulb@666 | 37 | ("vole", "xyz"), |
paulb@666 | 38 | ) |
paulb@666 | 39 | ) |
paulb@666 | 40 | ) |
paulb@666 | 41 | }), |
paulb@716 | 42 | handle_errors=0 |
paulb@139 | 43 | ) |
paulb@139 | 44 | |
paulb@139 | 45 | # vim: tabstop=4 expandtab shiftwidth=4 |