# HG changeset patch # User paulb # Date 1190932778 0 # Node ID 40c05879f66bff2fc1cf6b5448bbed92f48f139b # Parent 273a509657bfc347341cf5989cab4f291c048ff4 [project @ 2007-09-27 22:39:35 by paulb] Updated the simple with login example. diff -r 273a509657bf -r 40c05879f66b examples/CGI/SimpleWithLoginHandler.py --- a/examples/CGI/SimpleWithLoginHandler.py Thu Sep 27 22:39:03 2007 +0000 +++ b/examples/CGI/SimpleWithLoginHandler.py Thu Sep 27 22:39:38 2007 +0000 @@ -9,21 +9,36 @@ from WebStack.Adapters.CGI import deploy from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator +from WebStack.Resources.Login import LoginResource, LoginAuthenticator +from WebStack.Resources.ResourceMap import MapResource from Simple import SimpleResource deploy( - LoginRedirectResource( - login_url="http://localhost/cgi/login", # Change this to be the exact URL on your server. - # eg. http://localhost:8000/cgi/LoginHandler.py - app_url="http://localhost", # Change this to be the URL base for your server. - # eg. http://localhost:8000 - # Note that the login application can be placed on - # a different server if desirable. - resource=SimpleResource(), - authenticator=LoginRedirectAuthenticator(secret_key="horses"), - anonymous_parameter_name="anonymous", - logout_parameter_name="logout" - ), + MapResource({ + "simple" : + LoginRedirectResource( + login_url="http://localhost/cgi/login", # Change this to be the exact URL on your server. + # eg. http://localhost:8000/cgi/LoginHandler.py + app_url="http://localhost", # Change this to be the URL base for your server. + # eg. http://localhost:8000 + # Note that the login application can be placed on + # a different server if desirable. + resource=SimpleResource(), + authenticator=LoginRedirectAuthenticator(secret_key="horses"), + anonymous_parameter_name="anonymous", + logout_parameter_name="logout" + ), + "login" : + LoginResource( + LoginAuthenticator( + secret_key="horses", + credentials=( + ("badger", "abc"), + ("vole", "xyz"), + ) + ) + ) + }), handle_errors=1 ) diff -r 273a509657bf -r 40c05879f66b examples/JavaServlet/SimpleWithLoginApp.py --- a/examples/JavaServlet/SimpleWithLoginApp.py Thu Sep 27 22:39:03 2007 +0000 +++ b/examples/JavaServlet/SimpleWithLoginApp.py Thu Sep 27 22:39:38 2007 +0000 @@ -1,20 +1,36 @@ #!/usr/bin/env python from WebStack.Adapters.JavaServlet import deploy +from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator +from WebStack.Resources.Login import LoginResource, LoginAuthenticator +from WebStack.Resources.ResourceMap import MapResource from Simple import SimpleResource -from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator # NOTE: Not sure if the resource should be maintained in a resource pool. -resource = LoginRedirectResource( - login_url="http://localhost:8080/LoginApp/", - app_url="http://localhost:8080", - resource=SimpleResource(), - authenticator=LoginRedirectAuthenticator(secret_key="horses"), - anonymous_parameter_name="anonymous", - logout_parameter_name="logout" - ) - -SimpleWithLoginApp = deploy(resource) +SimpleWithLoginApp = deploy( + MapResource({ + "simple" : + LoginRedirectResource( + login_url="http://localhost:8080/SimpleWithLoginApp/login", + app_url="http://localhost:8080", + resource=SimpleResource(), + authenticator=LoginRedirectAuthenticator(secret_key="horses"), + anonymous_parameter_name="anonymous", + logout_parameter_name="logout" + ), + "login" : + LoginResource( + LoginAuthenticator( + secret_key="horses", + credentials=( + ("badger", "abc"), + ("vole", "xyz"), + ) + ) + ) + }), + handle_errors=1 +) # vim: tabstop=4 expandtab shiftwidth=4