# HG changeset patch # User paulb # Date 1190933356 0 # Node ID 1d26a9057390d4b1e6583b15b532f80b1f63d065 # Parent 0e4413739a51eff165fa3499e92e3831760a845c [project @ 2007-09-27 22:49:13 by paulb] Updated example of integrated login. diff -r 0e4413739a51 -r 1d26a9057390 examples/Webware/SimpleWithLoginApp/__init__.py --- a/examples/Webware/SimpleWithLoginApp/__init__.py Thu Sep 27 22:48:48 2007 +0000 +++ b/examples/Webware/SimpleWithLoginApp/__init__.py Thu Sep 27 22:49:16 2007 +0000 @@ -8,18 +8,33 @@ from WebStack.Adapters.Webware import WebStackServletFactory from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator +from WebStack.Resources.Login import LoginResource, LoginAuthenticator +from WebStack.Resources.ResourceMap import MapResource from Simple import SimpleResource # NOTE: Initialising a shared resource. -resource = LoginRedirectResource( - login_url="http://localhost/webkit/app.login", - app_url="http://localhost", - resource=SimpleResource(), - authenticator=LoginRedirectAuthenticator(secret_key="horses"), - anonymous_parameter_name="anonymous", - logout_parameter_name="logout" -) +resource = MapResource({ + "simple" : + LoginRedirectResource( + login_url="http://localhost/webkit/app.login", + app_url="http://localhost", + 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"), + ) + ) + ) + }) def InstallInWebKit(appServer): global resource diff -r 0e4413739a51 -r 1d26a9057390 examples/Webware/SimpleWithLoginContext/__init__.py --- a/examples/Webware/SimpleWithLoginContext/__init__.py Thu Sep 27 22:48:48 2007 +0000 +++ b/examples/Webware/SimpleWithLoginContext/__init__.py Thu Sep 27 22:49:16 2007 +0000 @@ -6,18 +6,34 @@ from WebStack.Adapters.Webware 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 # NOTE: Initialising a shared resource. -resource = LoginRedirectResource( - login_url="http://localhost/webkitcvs/login", - app_url="http://localhost", - resource=SimpleResource(), - authenticator=LoginRedirectAuthenticator(secret_key="horses"), - anonymous_parameter_name="anonymous", - logout_parameter_name="logout" -) +resource = MapResource({ + "simple" : + LoginRedirectResource( + login_url="http://localhost/webkitcvs/login", + app_url="http://localhost", + 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"), + ) + ) + ) + }) + urlParser = deploy(resource, handle_errors=1) # vim: tabstop=4 expandtab shiftwidth=4 diff -r 0e4413739a51 -r 1d26a9057390 examples/Zope/SimpleWithLoginProduct/__init__.py --- a/examples/Zope/SimpleWithLoginProduct/__init__.py Thu Sep 27 22:48:48 2007 +0000 +++ b/examples/Zope/SimpleWithLoginProduct/__init__.py Thu Sep 27 22:49:16 2007 +0000 @@ -4,6 +4,8 @@ from Simple import SimpleResource from WebStack.Resources.LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator +from WebStack.Resources.Login import LoginResource, LoginAuthenticator +from WebStack.Resources.ResourceMap import MapResource from WebStack.Adapters.Zope import WebStackAdapterProduct from Globals import InitializeClass @@ -11,15 +13,28 @@ meta_type = "Simple with login product" def __init__(self, id): WebStackAdapterProduct.__init__(self, id, - LoginRedirectResource( - login_url="http://localhost:9080/tests/login", - app_url="http://localhost:9080", - resource=SimpleResource(), - authenticator=LoginRedirectAuthenticator(secret_key="horses"), - anonymous_parameter_name="anonymous", - logout_parameter_name="logout" + MapResource({ + "simple" : + LoginRedirectResource( + login_url="http://localhost:9080/tests/login", + app_url="http://localhost:9080", + 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"), + ) + ) + ) + }) ) - ) InitializeClass(SimpleWithLoginProduct)