Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes
PluggableAuthService.plugins.HTTPBasicAuthHelper.HTTPBasicAuthHelper Class Reference
Inheritance diagram for PluggableAuthService.plugins.HTTPBasicAuthHelper.HTTPBasicAuthHelper:
Inheritance graph
[legend]
Collaboration diagram for PluggableAuthService.plugins.HTTPBasicAuthHelper.HTTPBasicAuthHelper:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def extractCredentials
def challenge
def resetCredentials

Public Attributes

 title

Static Public Attributes

string meta_type = 'HTTP Basic Auth Helper'
tuple security = ClassSecurityInfo()
string protocol = "http"

Detailed Description

Multi-plugin for managing details of HTTP Basic Authentication.

Definition at line 59 of file HTTPBasicAuthHelper.py.


Constructor & Destructor Documentation

Definition at line 69 of file HTTPBasicAuthHelper.py.

00069 
00070     def __init__( self, id, title=None ):
00071         self._setId( id )
00072         self.title = title

Here is the call graph for this function:


Member Function Documentation

def PluggableAuthService.plugins.HTTPBasicAuthHelper.HTTPBasicAuthHelper.challenge (   self,
  request,
  response,
  kw 
)
Challenge the user for credentials.

Definition at line 96 of file HTTPBasicAuthHelper.py.

00096 
00097     def challenge( self, request, response, **kw ):
00098 
00099         """ Challenge the user for credentials.
00100         """
00101         realm = response.realm
00102         if realm:
00103             response.addHeader('WWW-Authenticate',
00104                                'basic realm="%s"' % realm)
00105         m = "<strong>You are not authorized to access this resource.</strong>"
00106         if response.debug_mode:
00107             if response._auth:
00108                 m = m + '<p>\nUsername and password are not correct.'
00109             else:
00110                 m = m + '<p>\nNo Authorization header found.'
00111 
00112         response.setBody(m, is_error=1)
00113         response.setStatus(401)
00114         return 1

Extract basic auth credentials from 'request'.

Definition at line 74 of file HTTPBasicAuthHelper.py.

00074 
00075     def extractCredentials( self, request ):
00076 
00077         """ Extract basic auth credentials from 'request'.
00078         """
00079         creds = {}
00080         login_pw = request._authUserPW()
00081 
00082         if login_pw is not None:
00083             name, password = login_pw
00084 
00085             creds[ 'login' ] = name
00086             creds[ 'password' ] = password
00087             creds[ 'remote_host' ] = request.get('REMOTE_HOST', '')
00088 
00089             try:
00090                 creds[ 'remote_address' ] = request.getClientAddr()
00091             except AttributeError:
00092                 creds[ 'remote_address' ] = ''
00093 
00094         return creds

Raise unauthorized to tell browser to clear credentials.

Definition at line 116 of file HTTPBasicAuthHelper.py.

00116 
00117     def resetCredentials( self, request, response ):
00118 
00119         """ Raise unauthorized to tell browser to clear credentials.
00120         """
00121         # XXX:  Does this need to check whether we have an HTTP response?
00122         response.unauthorized()
00123 
00124 classImplements( HTTPBasicAuthHelper
00125                , IHTTPBasicAuthHelper
00126                , ILoginPasswordHostExtractionPlugin
00127                , IChallengePlugin
00128                , ICredentialsResetPlugin
00129                )
00130 
00131 InitializeClass( HTTPBasicAuthHelper )

Here is the call graph for this function:


Member Data Documentation

Definition at line 63 of file HTTPBasicAuthHelper.py.

Definition at line 67 of file HTTPBasicAuthHelper.py.

Definition at line 65 of file HTTPBasicAuthHelper.py.

Definition at line 71 of file HTTPBasicAuthHelper.py.


The documentation for this class was generated from the following file: