1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/examples/CGI/LoginHandler.py Sat May 29 23:07:08 2004 +0000 1.3 @@ -0,0 +1,23 @@ 1.4 +#!/usr/bin/env python 1.5 + 1.6 +# NOTE: Path manipulation requires manual customisation. 1.7 + 1.8 +import sys 1.9 +sys.path.append("/home/paulb/Software/Python/WebStack") 1.10 +sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common") 1.11 + 1.12 +from WebStack.Adapters import CGI 1.13 +from Login import LoginResource, LoginAuthenticator 1.14 + 1.15 +resource = LoginResource( 1.16 + LoginAuthenticator( 1.17 + secret_key="horses", 1.18 + credentials=( 1.19 + ("badger", "abc"), 1.20 + ("vole", "xyz"), 1.21 + ) 1.22 + ) 1.23 +) 1.24 +CGI.respond(resource) 1.25 + 1.26 +# vim: tabstop=4 expandtab shiftwidth=4
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/examples/CGI/SimpleWithLoginHandler.py Sat May 29 23:07:08 2004 +0000 2.3 @@ -0,0 +1,22 @@ 2.4 +#!/usr/bin/env python 2.5 + 2.6 +# NOTE: Path manipulation requires manual customisation. 2.7 + 2.8 +import sys 2.9 +sys.path.append("/home/paulb/Software/Python/WebStack") 2.10 +sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common") 2.11 + 2.12 +from WebStack.Adapters import CGI 2.13 +from Simple import SimpleResource 2.14 +from LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 2.15 + 2.16 +resource = LoginRedirectResource( 2.17 + login_url="http://localhost/cgi/login", 2.18 + app_url="http://localhost", 2.19 + resource=SimpleResource(), 2.20 + authenticator=LoginRedirectAuthenticator(secret_key="horses"), 2.21 + anonymous_parameter_name="anonymous" 2.22 +) 2.23 +CGI.respond(resource) 2.24 + 2.25 +# vim: tabstop=4 expandtab shiftwidth=4
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/examples/ModPython/LoginApp/LoginHandler.py Sat May 29 23:07:08 2004 +0000 3.3 @@ -0,0 +1,29 @@ 3.4 +#!/usr/bin/env python 3.5 + 3.6 +# NOTE: Path manipulation requires manual customisation. 3.7 + 3.8 +import sys 3.9 +sys.path.append("/home/paulb/Software/Python/WebStack") 3.10 +sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common") 3.11 + 3.12 +from WebStack.Adapters import ModPython 3.13 +from Login import LoginResource, LoginAuthenticator 3.14 + 3.15 +# NOTE: Not sure if the resource should be maintained in a resource pool. 3.16 + 3.17 +resource = LoginResource( 3.18 + LoginAuthenticator( 3.19 + secret_key="horses", 3.20 + credentials=( 3.21 + ("badger", "abc"), 3.22 + ("vole", "xyz"), 3.23 + ) 3.24 + ), 3.25 + use_redirect=0 3.26 +) 3.27 + 3.28 +def handler(req): 3.29 + global resource 3.30 + return ModPython.respond(req, resource, debug=1) 3.31 + 3.32 +# vim: tabstop=4 expandtab shiftwidth=4
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/examples/ModPython/SimpleWithLoginApp/SimpleWithLoginHandler.py Sat May 29 23:07:08 2004 +0000 4.3 @@ -0,0 +1,27 @@ 4.4 +#!/usr/bin/env python 4.5 + 4.6 +# NOTE: Path manipulation requires manual customisation. 4.7 + 4.8 +import sys 4.9 +sys.path.append("/home/paulb/Software/Python/WebStack") 4.10 +sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common") 4.11 + 4.12 +from WebStack.Adapters import ModPython 4.13 +from Simple import SimpleResource 4.14 +from LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 4.15 + 4.16 +# NOTE: Not sure if the resource should be maintained in a resource pool. 4.17 + 4.18 +resource = LoginRedirectResource( 4.19 + login_url="http://localhost/login/app.login", 4.20 + app_url="http://localhost", 4.21 + resource=SimpleResource(), 4.22 + authenticator=LoginRedirectAuthenticator(secret_key="horses"), 4.23 + anonymous_parameter_name="anonymous" 4.24 +) 4.25 + 4.26 +def handler(req): 4.27 + global resource 4.28 + return ModPython.respond(req, resource, debug=1) 4.29 + 4.30 +# vim: tabstop=4 expandtab shiftwidth=4
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/examples/Twisted/LoginApp.py Sat May 29 23:07:08 2004 +0000 5.3 @@ -0,0 +1,25 @@ 5.4 +#!/usr/bin/env python 5.5 + 5.6 +from WebStack.Adapters import Twisted 5.7 +from Login import LoginResource, LoginAuthenticator 5.8 +import twisted.web.server 5.9 +import twisted.internet.reactor 5.10 + 5.11 +# Special magic incantation. 5.12 + 5.13 +resource = LoginResource( 5.14 + LoginAuthenticator( 5.15 + secret_key="horses", 5.16 + credentials=( 5.17 + ("badger", "abc"), 5.18 + ("vole", "xyz"), 5.19 + ) 5.20 + ) 5.21 +) 5.22 + 5.23 +top_level = Twisted.Dispatcher(resource) 5.24 +site = twisted.web.server.Site(top_level) 5.25 +twisted.internet.reactor.listenTCP(8081, site) 5.26 +twisted.internet.reactor.run() 5.27 + 5.28 +# vim: tabstop=4 expandtab shiftwidth=4
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/examples/Twisted/SimpleWithLoginApp.py Sat May 29 23:07:08 2004 +0000 6.3 @@ -0,0 +1,24 @@ 6.4 +#!/usr/bin/env python 6.5 + 6.6 +from WebStack.Adapters import Twisted 6.7 +from Simple import SimpleResource 6.8 +from LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 6.9 +import twisted.web.server 6.10 +import twisted.internet.reactor 6.11 + 6.12 +# Special magic incantation. 6.13 + 6.14 +resource = LoginRedirectResource( 6.15 + login_url="http://localhost:8081", 6.16 + app_url="http://localhost:8080", 6.17 + resource=SimpleResource(), 6.18 + authenticator=LoginRedirectAuthenticator(secret_key="horses"), 6.19 + anonymous_parameter_name="anonymous" 6.20 +) 6.21 + 6.22 +top_level = Twisted.Dispatcher(resource) 6.23 +site = twisted.web.server.Site(top_level) 6.24 +twisted.internet.reactor.listenTCP(8080, site) 6.25 +twisted.internet.reactor.run() 6.26 + 6.27 +# vim: tabstop=4 expandtab shiftwidth=4
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/examples/Webware/LoginApp/Properties.py Sat May 29 23:07:08 2004 +0000 7.3 @@ -0,0 +1,15 @@ 7.4 +#!/usr/bin/env python 7.5 + 7.6 +name = "Login" 7.7 + 7.8 +version = (0, 1, 0) 7.9 + 7.10 +status = "alpha" 7.11 + 7.12 +releaseDate = "?" 7.13 + 7.14 +requiredPyVersion = (2, 2, 0) 7.15 + 7.16 +synopsis = "A WebStack login application." 7.17 + 7.18 +# vim: tabstop=4 expandtab shiftwidth=4
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/examples/Webware/LoginApp/__init__.py Sat May 29 23:07:08 2004 +0000 8.3 @@ -0,0 +1,33 @@ 8.4 +#!/usr/bin/env python 8.5 + 8.6 +""" 8.7 +Webware plug-in code. 8.8 +""" 8.9 + 8.10 +__version__ = "0.1" 8.11 + 8.12 +from WebStack.Adapters.Webware import WebStackServletFactory 8.13 +from Login import LoginResource, LoginAuthenticator 8.14 + 8.15 +# NOTE: Initialising a shared resource. 8.16 + 8.17 +resource = LoginResource( 8.18 + LoginAuthenticator( 8.19 + secret_key="horses", 8.20 + credentials=( 8.21 + ("badger", "abc"), 8.22 + ("vole", "xyz"), 8.23 + ) 8.24 + ) 8.25 +) 8.26 + 8.27 +def InstallInWebKit(appServer): 8.28 + global resource 8.29 + app = appServer.application() 8.30 + 8.31 + # NOTE: Allow .login files only. Really, we'd like any kind of file, but 8.32 + # NOTE: that would severely undermine the servlet factory concept. 8.33 + 8.34 + app.addServletFactory(WebStackServletFactory(app, resource, [".login"])) 8.35 + 8.36 +# vim: tabstop=4 expandtab shiftwidth=4
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/examples/Webware/LoginContext/__init__.py Sat May 29 23:07:08 2004 +0000 9.3 @@ -0,0 +1,24 @@ 9.4 +#!/usr/bin/env python 9.5 + 9.6 +""" 9.7 +Webware context for the Login application (post Webware 0.8.1). 9.8 +""" 9.9 + 9.10 +from WebStack.Adapters.Webware import WebStackURLParser 9.11 +from Login import LoginResource, LoginAuthenticator 9.12 + 9.13 +# NOTE: Initialising a shared resource. 9.14 + 9.15 +resource = LoginResource( 9.16 + LoginAuthenticator( 9.17 + secret_key="horses", 9.18 + credentials=( 9.19 + ("badger", "abc"), 9.20 + ("vole", "xyz"), 9.21 + ) 9.22 + ) 9.23 +) 9.24 + 9.25 +urlParser = WebStackURLParser(resource) 9.26 + 9.27 +# vim: tabstop=4 expandtab shiftwidth=4
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/examples/Webware/SimpleWithLoginApp/Properties.py Sat May 29 23:07:08 2004 +0000 10.3 @@ -0,0 +1,15 @@ 10.4 +#!/usr/bin/env python 10.5 + 10.6 +name = "SimpleWithLogin" 10.7 + 10.8 +version = (0, 1, 0) 10.9 + 10.10 +status = "alpha" 10.11 + 10.12 +releaseDate = "?" 10.13 + 10.14 +requiredPyVersion = (2, 2, 0) 10.15 + 10.16 +synopsis = "A simple WebStack application protected by a login screen." 10.17 + 10.18 +# vim: tabstop=4 expandtab shiftwidth=4
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/examples/Webware/SimpleWithLoginApp/__init__.py Sat May 29 23:07:08 2004 +0000 11.3 @@ -0,0 +1,32 @@ 11.4 +#!/usr/bin/env python 11.5 + 11.6 +""" 11.7 +Webware plug-in code. 11.8 +""" 11.9 + 11.10 +__version__ = "0.1" 11.11 + 11.12 +from WebStack.Adapters.Webware import WebStackServletFactory 11.13 +from Simple import SimpleResource 11.14 +from LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 11.15 + 11.16 +# NOTE: Initialising a shared resource. 11.17 + 11.18 +resource = LoginRedirectResource( 11.19 + login_url="http://localhost/webkit/app.login", 11.20 + app_url="http://localhost", 11.21 + resource=SimpleResource(), 11.22 + authenticator=LoginRedirectAuthenticator(secret_key="horses"), 11.23 + anonymous_parameter_name="anonymous" 11.24 +) 11.25 + 11.26 +def InstallInWebKit(appServer): 11.27 + global resource 11.28 + app = appServer.application() 11.29 + 11.30 + # NOTE: Allow .xsimple files only. Really, we'd like any kind of file, but 11.31 + # NOTE: that would severely undermine the servlet factory concept. 11.32 + 11.33 + app.addServletFactory(WebStackServletFactory(app, resource, [".xsimple"])) 11.34 + 11.35 +# vim: tabstop=4 expandtab shiftwidth=4
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/examples/Webware/SimpleWithLoginContext/__init__.py Sat May 29 23:07:08 2004 +0000 12.3 @@ -0,0 +1,22 @@ 12.4 +#!/usr/bin/env python 12.5 + 12.6 +""" 12.7 +Webware context for the Simple application (post Webware 0.8.1). 12.8 +""" 12.9 + 12.10 +from WebStack.Adapters.Webware import WebStackURLParser 12.11 +from Simple import SimpleResource 12.12 +from LoginRedirect import LoginRedirectResource, LoginRedirectAuthenticator 12.13 + 12.14 +# NOTE: Initialising a shared resource. 12.15 + 12.16 +resource = LoginRedirectResource( 12.17 + login_url="http://localhost/webkitcvs/login", 12.18 + app_url="http://localhost", 12.19 + resource=SimpleResource(), 12.20 + authenticator=LoginRedirectAuthenticator(secret_key="horses"), 12.21 + anonymous_parameter_name="anonymous" 12.22 +) 12.23 +urlParser = WebStackURLParser(resource) 12.24 + 12.25 +# vim: tabstop=4 expandtab shiftwidth=4