1 #!/usr/bin/env python 2 3 """ 4 Webware plug-in code. 5 """ 6 7 __version__ = "0.1" 8 9 from WebStack.Adapters.Webware import WebStackServletFactory 10 from Login import LoginResource, LoginAuthenticator 11 12 # NOTE: Initialising a shared resource. 13 14 resource = LoginResource( 15 LoginAuthenticator( 16 secret_key="horses", 17 credentials=( 18 ("badger", "abc"), 19 ("vole", "xyz"), 20 ) 21 ), 22 anonymous_parameter_name="anonymous" 23 ) 24 25 def InstallInWebKit(appServer): 26 global resource 27 app = appServer.application() 28 29 # NOTE: Allow .login files only. Really, we'd like any kind of file, but 30 # NOTE: that would severely undermine the servlet factory concept. 31 32 app.addServletFactory(WebStackServletFactory(app, resource, [".login"])) 33 34 # vim: tabstop=4 expandtab shiftwidth=4