1.1 --- a/examples/JavaServlet/SimpleWithLoginApp.py Sat May 24 15:21:53 2008 +0000
1.2 +++ b/examples/JavaServlet/SimpleWithLoginApp.py Sun Aug 24 20:51:10 2008 +0200
1.3 @@ -1,36 +1,26 @@
1.4 #!/usr/bin/env python
1.5
1.6 from WebStack.Adapters.JavaServlet import deploy
1.7 -from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator
1.8 -from WebStack.Resources.Login import LoginResource, LoginAuthenticator
1.9 -from WebStack.Resources.ResourceMap import MapResource
1.10 -from Simple import SimpleResource
1.11 +from SimpleWithLogin import get_site_map
1.12 +
1.13 +# Change this to be the exact URL.
1.14 +# eg. http://localhost:8000/cgi/myapp/requestid
1.15 +
1.16 +login_url = "http://localhost:8080/SimpleWithLoginApp/login"
1.17 +
1.18 +# Change this to be the URL base for your server.
1.19 +# eg. http://localhost:8000
1.20 +
1.21 +app_url = "http://localhost:8080" # No trailing "/"!
1.22 +
1.23 +# Must match the key used elsewhere.
1.24 +
1.25 +secret_key = "horses"
1.26 +
1.27 +resource = get_site_map(app_url, login_url, secret_key)
1.28
1.29 # NOTE: Not sure if the resource should be maintained in a resource pool.
1.30
1.31 -SimpleWithLoginApp = deploy(
1.32 - MapResource({
1.33 - "simple" :
1.34 - LoginRedirectResource(
1.35 - login_url="http://localhost:8080/SimpleWithLoginApp/login",
1.36 - app_url="http://localhost:8080",
1.37 - resource=SimpleResource(),
1.38 - authenticator=LoginRedirectAuthenticator(secret_key="horses"),
1.39 - anonymous_parameter_name="anonymous",
1.40 - logout_parameter_name="logout"
1.41 - ),
1.42 - "login" :
1.43 - LoginResource(
1.44 - LoginAuthenticator(
1.45 - secret_key="horses",
1.46 - credentials=(
1.47 - ("badger", "abc"),
1.48 - ("vole", "xyz"),
1.49 - )
1.50 - )
1.51 - )
1.52 - }),
1.53 - handle_errors=0
1.54 -)
1.55 +SimpleWithLoginApp = deploy(resource, handle_errors=0)
1.56
1.57 # vim: tabstop=4 expandtab shiftwidth=4