Package WebStack :: Package Resources :: Module LoginRedirect :: Class LoginRedirectResource
[show private | hide private]
[frames | no frames]

Class LoginRedirectResource


A resource redirecting to a login URL.

Method Summary
  __init__(self, resource, authenticator, login_url, app_url, anonymous_parameter_name, anonymous_username, logout_parameter_name, logout_url, use_logout_redirect, urlencoding, path_encoding)
Initialise the resource with a 'resource' for the application being protected and an 'authenticator' protecting the resource.
  get_app_url(self, trans)
Return the application URL, using 'trans' if necessary, in order to provide a complete URL to redirect an authenticated user to their originally requested page.
  get_login_url(self, trans)
Return the login URL, using 'trans' if necessary, in order to provide a complete URL to redirect an authenticated user to their originally requested page.
  respond(self, trans)
Respond using the given transaction 'trans'.
  show_logout(self, trans, redirect)
Write a confirmation page to 'trans' containing the 'redirect' URL which the client should be sent to upon logout.

Class Variable Summary
str encoding = 'utf-8'
str logout_page = '\n<html>\n  <head>\n    <title>Logout</ti...

Method Details

__init__(self, resource, authenticator, login_url=None, app_url=None, anonymous_parameter_name=None, anonymous_username='anonymous', logout_parameter_name=None, logout_url='/', use_logout_redirect=1, urlencoding=None, path_encoding=None)
(Constructor)

Initialise the resource with a 'resource' for the application being
protected and an 'authenticator' protecting the resource.

If the optional 'login_url' and 'app_url' are provided, these values
will be used to locate the login application and protected application
respectively. Such values, if not provided, must be otherwise set at a
later time or provided by 'get_login_url' and 'get_app_url' methods in
a subclass of this class.

If the optional 'anonymous_parameter_name' is set, clients providing a
parameter of that name in the URL will not be authenticated, but then
such clients will get a predefined user identity associated with them,
configurable using the optional 'anonymous_username'.

If the optional 'logout_parameter_name' is set, clients providing a
parameter of that name in the URL will become logged out. After logging
out, clients are redirected to a location which can be configured by the
optional 'logout_url'.

If the optional 'use_logout_redirect' flag is set to 0, a confirmation
screen is given instead of redirecting the user to the 'logout_url'.

The optional 'path_encoding' parameter (previously 'urlencoding', which
is still supported) allows a special encoding to be used in producing
the redirection path.

To change the page used by this resource, either redefine the
'logout_page' attribute in instances of this class or a subclass, or
override the 'show_logout' method.

get_app_url(self, trans)

Return the application URL, using 'trans' if necessary, in order to
provide a complete URL to redirect an authenticated user to their
originally requested page. If the application URL is empty, any
redirects will be within the same application, rather than to
potentially completely different applications residing at arbitrary
locations.

get_login_url(self, trans)

Return the login URL, using 'trans' if necessary, in order to
provide a complete URL to redirect an authenticated user to their
originally requested page.

respond(self, trans)

Respond using the given transaction 'trans'.

show_logout(self, trans, redirect)

Write a confirmation page to 'trans' containing the 'redirect' URL which the
client should be sent to upon logout.

Class Variable Details

encoding

Type:
str
Value:
'utf-8'                                                                

logout_page

Type:
str
Value:
'''
<html>
  <head>
    <title>Logout</title>
  </head>
  <body>
    <h1>Logout Successful</h1>
    <p>Please proceed <a href="%s">to the application</a>.</p>
...                                                                    

Generated by Epydoc 2.1 on Thu Mar 1 00:37:14 2007 http://epydoc.sf.net