Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Static Private Attributes
plone.session.plugins.session.SessionPlugin Class Reference
Inheritance diagram for plone.session.plugins.session.SessionPlugin:
Inheritance graph
[legend]
Collaboration diagram for plone.session.plugins.session.SessionPlugin:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def source
def manage_options
def setupSession
def extractCredentials
def authenticateCredentials
def updateCredentials
def resetCredentials
def manage_clearSecrets
def manage_createNewSecret

Public Attributes

 title
 path

Static Public Attributes

string meta_type = "Plone Session Plugin"
tuple security = ClassSecurityInfo()
string cookie_name = "__ac"
tuple manage_secret = PageTemplateFile("../sources/hash.pt", globals())

Static Private Attributes

tuple _properties

Detailed Description

Session authentication plugin.

Definition at line 37 of file session.py.


Constructor & Destructor Documentation

def plone.session.plugins.session.SessionPlugin.__init__ (   self,
  id,
  title = None,
  path = "/" 
)

Definition at line 60 of file session.py.

00060 
00061     def __init__(self, id, title=None, path="/"):
00062         self._setId(id)
00063         self.title=title
00064         self.path=path

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

Definition at line 111 of file session.py.

00111 
00112     def authenticateCredentials(self, credentials):
00113         if not credentials.get("source", None)=="plone.session":
00114             return None
00115 
00116         source=self.source
00117         identifier=credentials["cookie"]
00118         if source.verifyIdentifier(identifier):
00119             userid=source.extractUserId(identifier)
00120             pas=self._getPAS()
00121             info=pas._verifyUser(pas.plugins, user_id=userid)
00122             if info is not None:
00123                 return (info['id'], info['login'])
00124 
00125         return None
00126 

Here is the call graph for this function:

Definition at line 92 of file session.py.

00092 
00093     def extractCredentials(self, request):
00094         creds={}
00095 
00096         if not self.cookie_name in request:
00097             return creds
00098 
00099         try:
00100             creds["cookie"]=binascii.a2b_base64(request.get(self.cookie_name))
00101         except binascii.Error:
00102             # If we have a cookie which is not properly base64 encoded it
00103             # can not be ours.
00104             return creds
00105 
00106         creds["source"]="plone.session" # XXX should this be the id?
00107 
00108         return creds
00109 

Clear all secrets from this source.

This invalidates all current sessions and requires users to login again.

Definition at line 150 of file session.py.

00150 
00151     def manage_clearSecrets(self, REQUEST):
00152         """Clear all secrets from this source.
00153 
00154         This invalidates all current sessions and requires users to login again.
00155         """
00156         self.source.clearSecrets()
00157         REQUEST.RESPONSE.redirect('%s/manage_secret?manage_tabs_message=%s'
00158                                      % (self.absolute_url(), 'All+secrets+cleared.'))
00159 

Here is the call graph for this function:

Create a new (signing) secret.

Definition at line 162 of file session.py.

00162 
00163     def manage_createNewSecret(self, REQUEST):
00164         """Create a new (signing) secret.
00165         """
00166         self.source.createNewSecret()
00167         REQUEST.RESPONSE.redirect('%s/manage_secret?manage_tabs_message=%s'
00168                                      % (self.absolute_url(), 'New+secret+created.'))
00169 
00170 classImplements(SessionPlugin, ISessionPlugin,
00171                 IExtractionPlugin, IAuthenticationPlugin,
00172                 ICredentialsResetPlugin, ICredentialsUpdatePlugin)
00173 

Here is the call graph for this function:

Splice in mangae options from our source if it has them.

Definition at line 70 of file session.py.

00070 
00071     def manage_options(self):
00072         """Splice in mangae options from our source if it has them."""
00073 
00074         more = getattr(self.source, 'manage_options', ()) 
00075         if more:
00076             try:
00077                 more = tuple(more)
00078             except TypeError:
00079                 more = more()
00080 
00081         return more  + BasePlugin.manage_options
00082 

Here is the call graph for this function:

def plone.session.plugins.session.SessionPlugin.resetCredentials (   self,
  request,
  response 
)

Definition at line 137 of file session.py.

00137 
00138     def resetCredentials(self, request, response):
00139         source=self.source
00140 
00141         response=self.REQUEST["RESPONSE"]
00142         response.expireCookie(self.cookie_name, path=self.path)
00143 
00144 # XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX
00145 # This should be in HashSource !

Here is the call graph for this function:

Here is the caller graph for this function:

def plone.session.plugins.session.SessionPlugin.setupSession (   self,
  userid,
  response 
)

Definition at line 84 of file session.py.

00084 
00085     def setupSession(self, userid, response):
00086         cookie=self.source.createIdentifier(userid)
00087         cookie=binascii.b2a_base64(cookie).rstrip()
00088 
00089         response.setCookie(self.cookie_name, cookie, path=self.path)
00090 

Here is the caller graph for this function:

Definition at line 66 of file session.py.

00066 
00067     def source(self):
00068         return ISessionSource(self)
00069 

Here is the caller graph for this function:

def plone.session.plugins.session.SessionPlugin.updateCredentials (   self,
  request,
  response,
  login,
  new_password 
)

Definition at line 128 of file session.py.

00128 
00129     def updateCredentials(self, request, response, login, new_password):
00130         pas=self._getPAS()
00131         info=pas._verifyUser(pas.plugins, login=login)
00132         if info is not None:
00133             # Only setup a session for users in our own user folder.
00134             self.setupSession(info["id"], response)
00135 

Here is the call graph for this function:


Member Data Documentation

Initial value:
(
            {
                "id"    : "title",
                "label" : "Title",
                "type"  : "string",
                "mode"  : "w",
            },
            {
                "id"    : "cookie_name",
                "label" : "Cookie Name root",
                "type"  : "string",
                "mode"  : "w",
            },
            )

Definition at line 45 of file session.py.

Definition at line 43 of file session.py.

tuple plone.session.plugins.session.SessionPlugin.manage_secret = PageTemplateFile("../sources/hash.pt", globals()) [static]

Definition at line 146 of file session.py.

string plone.session.plugins.session.SessionPlugin.meta_type = "Plone Session Plugin" [static]

Definition at line 41 of file session.py.

Definition at line 63 of file session.py.

tuple plone.session.plugins.session.SessionPlugin.security = ClassSecurityInfo() [static]

Definition at line 42 of file session.py.

Definition at line 62 of file session.py.


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