# HG changeset patch # User paulb # Date 1209678394 0 # Node ID 0b33f944b967b1a6c32f639ffc79adc122e90f1c # Parent 7f2ee7b77ecd047c7c48d40e3a52b23466ca9626 [project @ 2008-05-01 21:46:34 by paulb] Added a deployment URL for the application, distinct from the 'app_url' which is used to build redirection paths using the entire request path. diff -r 7f2ee7b77ecd -r 0b33f944b967 examples/Common/OpenIDLogin/__init__.py --- a/examples/Common/OpenIDLogin/__init__.py Thu May 01 21:46:24 2008 +0000 +++ b/examples/Common/OpenIDLogin/__init__.py Thu May 01 21:46:34 2008 +0000 @@ -8,23 +8,29 @@ from WebStack.Resources.Static import StringResource from WebStack.Generic import ContentType -def get_site_map(app_url): +def get_site_map(app_url, deployment_url): + + """ + Return a resource for the site having the given 'app_url' and + 'deployment_url'. The 'app_url' should be the "bare" reference using a + protocol, host and port, not including any path information. + """ - "Return a resource for the site having the given 'app_url'." + login = OpenIDLoginResource( + app_url=app_url, + authenticator=Authenticator( + credentials=( + # Local identifier, username, password + ((deployment_url + "/badger", "badger"), "abc"), + ((deployment_url + "/vole", "vole"), "xyz"), + ((deployment_url + u"/זרו", u"זרו"), u"ֶ״ֵ"), + ) + ) + ) return MapResource({ - "login" : - OpenIDLoginResource( - app_url=app_url, - authenticator=Authenticator( - credentials=( - # Local identifier, username, password - ((app_url + "/badger", "badger"), "abc"), - ((app_url + "/vole", "vole"), "xyz"), - ((app_url + u"/זרו", u"זרו"), u"ֶ״ֵ"), - ) - ) - ), + "" : login, + "login" : login, # Some local OpenID pages. @@ -40,7 +46,7 @@

Home page for the OpenID authenticated user, badger.

- """ % (app_url, app_url), ContentType("text/html")), + """ % (deployment_url, deployment_url), ContentType("text/html")), u"זרו" : StringResource(u""" @@ -53,7 +59,7 @@

Home page for the OpenID authenticated user, זרו.

- """ % (app_url, app_url), ContentType("text/html", "iso-8859-1")), + """ % (deployment_url, deployment_url), ContentType("text/html", "iso-8859-1")), "vole" : StringResource(""" @@ -66,7 +72,7 @@

Home page for the OpenID authenticated user, vole.

- """ % (app_url, app_url), ContentType("text/html")) + """ % (deployment_url, deployment_url), ContentType("text/html")) }) # vim: tabstop=4 expandtab shiftwidth=4