1.1 --- a/examples/Common/OpenIDLogin/__init__.py Thu May 01 21:46:24 2008 +0000
1.2 +++ b/examples/Common/OpenIDLogin/__init__.py Thu May 01 21:46:34 2008 +0000
1.3 @@ -8,23 +8,29 @@
1.4 from WebStack.Resources.Static import StringResource
1.5 from WebStack.Generic import ContentType
1.6
1.7 -def get_site_map(app_url):
1.8 +def get_site_map(app_url, deployment_url):
1.9 +
1.10 + """
1.11 + Return a resource for the site having the given 'app_url' and
1.12 + 'deployment_url'. The 'app_url' should be the "bare" reference using a
1.13 + protocol, host and port, not including any path information.
1.14 + """
1.15
1.16 - "Return a resource for the site having the given 'app_url'."
1.17 + login = OpenIDLoginResource(
1.18 + app_url=app_url,
1.19 + authenticator=Authenticator(
1.20 + credentials=(
1.21 + # Local identifier, username, password
1.22 + ((deployment_url + "/badger", "badger"), "abc"),
1.23 + ((deployment_url + "/vole", "vole"), "xyz"),
1.24 + ((deployment_url + u"/æøå", u"æøå"), u"ÆØÅ"),
1.25 + )
1.26 + )
1.27 + )
1.28
1.29 return MapResource({
1.30 - "login" :
1.31 - OpenIDLoginResource(
1.32 - app_url=app_url,
1.33 - authenticator=Authenticator(
1.34 - credentials=(
1.35 - # Local identifier, username, password
1.36 - ((app_url + "/badger", "badger"), "abc"),
1.37 - ((app_url + "/vole", "vole"), "xyz"),
1.38 - ((app_url + u"/æøå", u"æøå"), u"ÆØÅ"),
1.39 - )
1.40 - )
1.41 - ),
1.42 + "" : login,
1.43 + "login" : login,
1.44
1.45 # Some local OpenID pages.
1.46
1.47 @@ -40,7 +46,7 @@
1.48 <p>Home page for the OpenID authenticated user, <code>badger</code>.</p>
1.49 </body>
1.50 </html>
1.51 - """ % (app_url, app_url), ContentType("text/html")),
1.52 + """ % (deployment_url, deployment_url), ContentType("text/html")),
1.53 u"æøå" :
1.54 StringResource(u"""
1.55 <html>
1.56 @@ -53,7 +59,7 @@
1.57 <p>Home page for the OpenID authenticated user, <code>æøå</code>.</p>
1.58 </body>
1.59 </html>
1.60 - """ % (app_url, app_url), ContentType("text/html", "iso-8859-1")),
1.61 + """ % (deployment_url, deployment_url), ContentType("text/html", "iso-8859-1")),
1.62 "vole" :
1.63 StringResource("""
1.64 <html>
1.65 @@ -66,7 +72,7 @@
1.66 <p>Home page for the OpenID authenticated user, <code>vole</code>.</p>
1.67 </body>
1.68 </html>
1.69 - """ % (app_url, app_url), ContentType("text/html"))
1.70 + """ % (deployment_url, deployment_url), ContentType("text/html"))
1.71 })
1.72
1.73 # vim: tabstop=4 expandtab shiftwidth=4