1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/BaseHTTPRequestHandler/SimpleWithOpenIDApp.py Mon Nov 12 00:51:58 2007 +0000
1.3 @@ -0,0 +1,37 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +from WebStack.Adapters.BaseHTTPRequestHandler import deploy
1.7 +from WebStack.Resources.LoginRedirect import LoginRedirectResource
1.8 +from WebStack.Resources.OpenIDRedirect import OpenIDRedirectAuthenticator
1.9 +from WebStack.Resources.OpenIDInitiation import OpenIDInitiationResource
1.10 +from WebStack.Resources.ResourceMap import MapResource
1.11 +from Simple import SimpleResource
1.12 +
1.13 +app_url = "http://localhost:8080" # No trailing "/"!
1.14 +initiation_url = "http://localhost:8080/login"
1.15 +secret_key = "horses" # Must match the login authenticator's key.
1.16 +
1.17 +print "Serving..."
1.18 +deploy(
1.19 + MapResource({
1.20 + "simple" :
1.21 + LoginRedirectResource(
1.22 + login_url=initiation_url,
1.23 + app_url=app_url,
1.24 + resource=SimpleResource(),
1.25 + authenticator=OpenIDRedirectAuthenticator(
1.26 + secret_key=secret_key,
1.27 + app_url=app_url
1.28 + ),
1.29 + anonymous_parameter_name="anonymous",
1.30 + logout_parameter_name="logout"
1.31 + ),
1.32 +
1.33 + # The "login" is really OpenID initiation.
1.34 +
1.35 + "login" : OpenIDInitiationResource()
1.36 + }),
1.37 + handle_errors=0
1.38 +)
1.39 +
1.40 +# vim: tabstop=4 expandtab shiftwidth=4