WebStack

Annotated examples/ModPython/LoginApp/LoginHandler.py

752:7a9ee094a4b7
2008-02-02 paulb [project @ 2008-02-02 23:35:36 by paulb] Removed local default encoding attributes. Improved the SimpleMap resource documentation and initialisation features.
paulb@139 1
#!/usr/bin/env python
paulb@139 2
paulb@539 3
# NOTE: Path manipulation may require manual customisation.
paulb@139 4
paulb@539 5
import sys, os
paulb@539 6
sys.path.append(os.path.abspath(os.path.join(__file__, "../../../Common")))
paulb@139 7
paulb@560 8
from WebStack.Adapters.ModPython import deploy
paulb@156 9
from WebStack.Resources.Login import LoginResource, LoginAuthenticator
paulb@139 10
paulb@139 11
# NOTE: Not sure if the resource should be maintained in a resource pool.
paulb@139 12
paulb@139 13
resource = LoginResource(
paulb@139 14
    LoginAuthenticator(
paulb@139 15
        secret_key="horses",
paulb@139 16
        credentials=(
paulb@139 17
            ("badger", "abc"),
paulb@139 18
            ("vole", "xyz"),
paulb@139 19
        )
paulb@139 20
    ),
paulb@139 21
    use_redirect=0
paulb@139 22
)
paulb@139 23
paulb@718 24
handler, _no_authentication = deploy(resource, handle_errors=0)
paulb@139 25
paulb@139 26
# vim: tabstop=4 expandtab shiftwidth=4