Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes
plone.session.sources.hash.HashSession Class Reference
Inheritance diagram for plone.session.sources.hash.HashSession:
Inheritance graph
[legend]
Collaboration diagram for plone.session.sources.hash.HashSession:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def clearSecrets
def createNewSecret
def getSecrets
def getSigningSecret
def signUserid
def createIdentifier
def splitIdentifier
def verifyIdentifier
def extractUserId
def extractLoginName
def invalidateSession

Public Attributes

 context

Static Public Attributes

int secret_count = 5
tuple manage_options
tuple manage_secret = ViewPageTemplateFile('hash.pt')

Detailed Description

A Hash session source implementation.

Definition at line 14 of file hash.py.


Constructor & Destructor Documentation

def plone.session.sources.hash.HashSession.__init__ (   self,
  context 
)

Reimplemented from plone.session.sources.base.BaseSource.

Definition at line 28 of file hash.py.

00028 
00029     def __init__(self, context):
00030         self.context=context
00031         anno=IAnnotations(self.context)
00032         if not anno.has_key("plone.session.plugins.hash.secrets"):
00033             self.clearSecrets()
00034 

Here is the caller graph for this function:


Member Function Documentation

Definition at line 35 of file hash.py.

00035 
00036     def clearSecrets(self):
00037         anno=IAnnotations(self.context)
00038         anno["plone.session.plugins.hash.secrets"]=[]
00039         self.createNewSecret()
00040 

Here is the call graph for this function:

Reimplemented from plone.session.sources.base.BaseSource.

Definition at line 63 of file hash.py.

00063 
00064     def createIdentifier(self, userid):
00065         signature=self.signUserid(userid)
00066 
00067         return "%s %s" % (signature, userid)
00068 

Here is the call graph for this function:

Definition at line 41 of file hash.py.

00041 
00042     def createNewSecret(self):
00043         anno=IAnnotations(self.context)
00044         anno["plone.session.plugins.hash.secrets"]=[GenerateSecret()] + \
00045                 anno["plone.session.plugins.hash.secrets"][:self.secret_count-1]
00046 

Here is the call graph for this function:

Here is the caller graph for this function:

def plone.session.sources.base.BaseSource.extractLoginName (   self,
  identifier 
) [inherited]

Definition at line 19 of file base.py.

00019 
00020     def extractLoginName(self, identifier):
00021         raise NotImplemented
00022 

def plone.session.sources.hash.HashSession.extractUserId (   self,
  identifier 
)

Definition at line 90 of file hash.py.

00090 
00091     def extractUserId(self, identifier):
00092         (signature, userid)=self.splitIdentifier(identifier)
00093         return userid
00094 

Here is the call graph for this function:

Definition at line 47 of file hash.py.

00047 
00048     def getSecrets(self):
00049         anno=IAnnotations(self.context)
00050         return anno["plone.session.plugins.hash.secrets"]
00051 

Here is the caller graph for this function:

Definition at line 52 of file hash.py.

00052 
00053     def getSigningSecret(self):
00054         return self.getSecrets()[0]
00055 

Here is the call graph for this function:

Here is the caller graph for this function:

def plone.session.sources.base.BaseSource.invalidateSession (   self,
  principal 
) [inherited]

Definition at line 23 of file base.py.

00023 
00024     def invalidateSession(self, principal):
00025         return False
00026 
def plone.session.sources.hash.HashSession.signUserid (   self,
  userid,
  secret = None 
)

Definition at line 56 of file hash.py.

00056 
00057     def signUserid(self, userid, secret=None):
00058         if secret is None:
00059             secret = self.getSigningSecret()
00060 
00061         return hmac.new(secret, userid, sha).digest()
00062 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 69 of file hash.py.

00069 
00070     def splitIdentifier(self, identifier):
00071         index=identifier.rfind(" ")
00072         if index==-1:
00073             raise ValueError
00074 
00075         return (identifier[:index], identifier[index+1:])
00076 

Here is the caller graph for this function:

Reimplemented from plone.session.sources.base.BaseSource.

Definition at line 77 of file hash.py.

00077 
00078     def verifyIdentifier(self, identifier):
00079         for secret in self.getSecrets():
00080             try:
00081                 (signature, userid)=self.splitIdentifier(identifier)
00082                 if  signature==self.signUserid(userid, secret):
00083 # XXX if the secret is not the current signing secret we should reset the cookie
00084                     return True
00085             except (AttributeError, ValueError):
00086                 continue
00087 
00088         return False
00089 

Here is the call graph for this function:


Member Data Documentation

Reimplemented from plone.session.sources.base.BaseSource.

Definition at line 29 of file hash.py.

Initial value:
(
                { 'label':      'Hash tools',
                  'action':     '@@hash_view/manage_secret' },
                { 'label':      'Hash tools',
                  'action':     'manage_secret' },
              )

Definition at line 21 of file hash.py.

tuple plone.session.sources.hash.HashSession.manage_secret = ViewPageTemplateFile('hash.pt') [static]

Definition at line 95 of file hash.py.

Definition at line 19 of file hash.py.


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