Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
MoinMoin.util.moinoid.MoinOpenIDStore Class Reference
Inheritance diagram for MoinMoin.util.moinoid.MoinOpenIDStore:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.util.moinoid.MoinOpenIDStore:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def key
def storeAssociation
def getAssociation
def removeAssociation
def useNonce

Public Attributes

 request

Detailed Description

OpenIDStore for MoinMoin

Definition at line 48 of file moinoid.py.


Constructor & Destructor Documentation

def MoinMoin.util.moinoid.MoinOpenIDStore.__init__ (   self,
  request 
)

Definition at line 50 of file moinoid.py.

00050 
00051     def __init__(self, request):
00052         self.request = request
00053         OpenIDStore.__init__(self)


Member Function Documentation

def MoinMoin.util.moinoid.MoinOpenIDStore.getAssociation (   self,
  server_url,
  handle = None 
)

Definition at line 68 of file moinoid.py.

00068 
00069     def getAssociation(self, server_url, handle=None):
00070         ce = caching.CacheEntry(self.request, 'openid', self.key(server_url),
00071                                 scope='wiki', use_pickle=True)
00072         if not ce.exists():
00073             return None
00074         assocs = ce.content()
00075         found = False
00076         for idx in xrange(len(assocs)-1, -1, -1):
00077             assoc_str = assocs[idx]
00078             association = Association.deserialize(assoc_str)
00079             if association.getExpiresIn() == 0:
00080                 del assocs[idx]
00081             else:
00082                 if handle is None or association.handle == handle:
00083                     found = True
00084                     break
00085         ce.update(assocs)
00086         if found:
00087             return association
00088         return None

Here is the call graph for this function:

def MoinMoin.util.moinoid.MoinOpenIDStore.key (   self,
  url 
)
return cache key

Definition at line 54 of file moinoid.py.

00054 
00055     def key(self, url):
00056         '''return cache key'''
00057         return hash_new('sha1', url).hexdigest()

Here is the caller graph for this function:

def MoinMoin.util.moinoid.MoinOpenIDStore.removeAssociation (   self,
  server_url,
  handle 
)

Definition at line 89 of file moinoid.py.

00089 
00090     def removeAssociation(self, server_url, handle):
00091         ce = caching.CacheEntry(self.request, 'openid', self.key(server_url),
00092                                 scope='wiki', use_pickle=True)
00093         if not ce.exists():
00094             return
00095         assocs = ce.content()
00096         for idx in xrange(len(assocs)-1, -1, -1):
00097             assoc_str = assocs[idx]
00098             association = Association.deserialize(assoc_str)
00099             if association.handle == handle:
00100                 del assocs[idx]
00101         if len(assocs):
00102             ce.update(assocs)
00103         else:
00104             ce.remove()

Here is the call graph for this function:

def MoinMoin.util.moinoid.MoinOpenIDStore.storeAssociation (   self,
  server_url,
  association 
)

Definition at line 58 of file moinoid.py.

00058 
00059     def storeAssociation(self, server_url, association):
00060         ce = caching.CacheEntry(self.request, 'openid', self.key(server_url),
00061                                 scope='wiki', use_pickle=True)
00062         if ce.exists():
00063             assocs = ce.content()
00064         else:
00065             assocs = []
00066         assocs += [association.serialize()]
00067         ce.update(assocs)

Here is the call graph for this function:

def MoinMoin.util.moinoid.MoinOpenIDStore.useNonce (   self,
  server_url,
  timestamp,
  salt 
)

Definition at line 105 of file moinoid.py.

00105 
00106     def useNonce(self, server_url, timestamp, salt):
00107         val = ''.join([str(server_url), str(timestamp), str(salt)])
00108         csum = hash_new('sha1', val).hexdigest()
00109         ce = caching.CacheEntry(self.request, 'openid-nonce', csum,
00110                                 scope='farm', use_pickle=False)
00111         if ce.exists():
00112             # nonce already used!
00113             return False
00114         ce.update(str(timestamp))
00115         if randint(0, 999) == 0:
00116             self.request.add_finisher(_cleanup_nonces)
00117         return True

Member Data Documentation

Definition at line 51 of file moinoid.py.


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