1.1 --- a/examples/CGI/SimpleWithLoginHandler.py Thu Sep 27 22:39:03 2007 +0000
1.2 +++ b/examples/CGI/SimpleWithLoginHandler.py Thu Sep 27 22:39:38 2007 +0000
1.3 @@ -9,21 +9,36 @@
1.4
1.5 from WebStack.Adapters.CGI import deploy
1.6 from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator
1.7 +from WebStack.Resources.Login import LoginResource, LoginAuthenticator
1.8 +from WebStack.Resources.ResourceMap import MapResource
1.9 from Simple import SimpleResource
1.10
1.11 deploy(
1.12 - LoginRedirectResource(
1.13 - login_url="http://localhost/cgi/login", # Change this to be the exact URL on your server.
1.14 - # eg. http://localhost:8000/cgi/LoginHandler.py
1.15 - app_url="http://localhost", # Change this to be the URL base for your server.
1.16 - # eg. http://localhost:8000
1.17 - # Note that the login application can be placed on
1.18 - # a different server if desirable.
1.19 - resource=SimpleResource(),
1.20 - authenticator=LoginRedirectAuthenticator(secret_key="horses"),
1.21 - anonymous_parameter_name="anonymous",
1.22 - logout_parameter_name="logout"
1.23 - ),
1.24 + MapResource({
1.25 + "simple" :
1.26 + LoginRedirectResource(
1.27 + login_url="http://localhost/cgi/login", # Change this to be the exact URL on your server.
1.28 + # eg. http://localhost:8000/cgi/LoginHandler.py
1.29 + app_url="http://localhost", # Change this to be the URL base for your server.
1.30 + # eg. http://localhost:8000
1.31 + # Note that the login application can be placed on
1.32 + # a different server if desirable.
1.33 + resource=SimpleResource(),
1.34 + authenticator=LoginRedirectAuthenticator(secret_key="horses"),
1.35 + anonymous_parameter_name="anonymous",
1.36 + logout_parameter_name="logout"
1.37 + ),
1.38 + "login" :
1.39 + LoginResource(
1.40 + LoginAuthenticator(
1.41 + secret_key="horses",
1.42 + credentials=(
1.43 + ("badger", "abc"),
1.44 + ("vole", "xyz"),
1.45 + )
1.46 + )
1.47 + )
1.48 + }),
1.49 handle_errors=1
1.50 )
1.51
2.1 --- a/examples/JavaServlet/SimpleWithLoginApp.py Thu Sep 27 22:39:03 2007 +0000
2.2 +++ b/examples/JavaServlet/SimpleWithLoginApp.py Thu Sep 27 22:39:38 2007 +0000
2.3 @@ -1,20 +1,36 @@
2.4 #!/usr/bin/env python
2.5
2.6 from WebStack.Adapters.JavaServlet import deploy
2.7 +from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator
2.8 +from WebStack.Resources.Login import LoginResource, LoginAuthenticator
2.9 +from WebStack.Resources.ResourceMap import MapResource
2.10 from Simple import SimpleResource
2.11 -from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator
2.12
2.13 # NOTE: Not sure if the resource should be maintained in a resource pool.
2.14
2.15 -resource = LoginRedirectResource(
2.16 - login_url="http://localhost:8080/LoginApp/",
2.17 - app_url="http://localhost:8080",
2.18 - resource=SimpleResource(),
2.19 - authenticator=LoginRedirectAuthenticator(secret_key="horses"),
2.20 - anonymous_parameter_name="anonymous",
2.21 - logout_parameter_name="logout"
2.22 - )
2.23 -
2.24 -SimpleWithLoginApp = deploy(resource)
2.25 +SimpleWithLoginApp = deploy(
2.26 + MapResource({
2.27 + "simple" :
2.28 + LoginRedirectResource(
2.29 + login_url="http://localhost:8080/SimpleWithLoginApp/login",
2.30 + app_url="http://localhost:8080",
2.31 + resource=SimpleResource(),
2.32 + authenticator=LoginRedirectAuthenticator(secret_key="horses"),
2.33 + anonymous_parameter_name="anonymous",
2.34 + logout_parameter_name="logout"
2.35 + ),
2.36 + "login" :
2.37 + LoginResource(
2.38 + LoginAuthenticator(
2.39 + secret_key="horses",
2.40 + credentials=(
2.41 + ("badger", "abc"),
2.42 + ("vole", "xyz"),
2.43 + )
2.44 + )
2.45 + )
2.46 + }),
2.47 + handle_errors=1
2.48 +)
2.49
2.50 # vim: tabstop=4 expandtab shiftwidth=4