def __init__(self):
        ''' Creates a proxy granting ticket storage. '''
        # mapping id as key, session id as value
        self._mapping_id_to_session_id = OOBForest(timedelta(hours=1), count=3)

        # session id as key, mapping id as value
        self._session_id_to_mapping_id = OOBForest(timedelta(hours=1), count=3)
 def __init__( self ):
     ''' Creates a proxy granting ticket storage. '''
     # mapping id as key, session id as value
     self._mapping_id_to_session_id = OOBForest(
         timedelta(hours=1), count=3 )
     
     # session id as key, mapping id as value
     self._session_id_to_mapping_id = OOBForest(
         timedelta(hours=1), count=3 )
Esempio n. 3
0
class ProxyGrantingTicketStorage( Persistent ):
    ''' See interfaces.IProxyGrantingTicketStorage. '''
    
    implements( IProxyGrantingTicketStorage )
    
    # pgtIou validate in almost 60 seconds before it is considered expired.
    TIME_OUT = 60
    
    def __init__( self ):
        ''' Creates a proxy granting ticket storage. '''
        self._mapping = OOBForest(
            datetime.timedelta(seconds=int(self.TIME_OUT/10)), count=11 )
    
    def add( self, pgtIou, pgt ):
        ''' See interfaces.IProxyGrantingTicketStorage. '''
        self._mapping[pgtIou] = pgt
        
        # Commit explicity to make sure the pgt has been saved before we tried
        # to get it during service validate. This will be a issue when anz.cas
        # and anz.casclient deploied on the same zope instance.
        #transaction.commit()
    
    def retrieve( self, pgtIou ):
        ''' See interfaces.IProxyGrantingTicketStorage. '''
        return pgtIou in self._mapping.keys() and self._mapping[pgtIou] or None
class SessionMappingStorage( Persistent ):
    ''' See interfaces.ISessionMappingStorage. '''
    
    implements( ISessionMappingStorage )
    
    def __init__( self ):
        ''' Creates a proxy granting ticket storage. '''
        # mapping id as key, session id as value
        self._mapping_id_to_session_id = OOBForest(
            timedelta(hours=1), count=3 )
        
        # session id as key, mapping id as value
        self._session_id_to_mapping_id = OOBForest(
            timedelta(hours=1), count=3 )
    
    def getSessionId( self, mappingId ):
        ''' See interfaces.ISessionMappingStorage. '''
        return mappingId in self._mapping_id_to_session_id.keys() and \
               self._mapping_id_to_session_id[mappingId] or None
    
    def removeByMappingId( self, mappingId ):
        ''' See interfaces.ISessionMappingStorage. '''
        if mappingId in self._mapping_id_to_session_id.keys():
            sessionId = self._mapping_id_to_session_id[mappingId]
            
            del self._session_id_to_mapping_id[sessionId]
            del self._mapping_id_to_session_id[mappingId]
    
    def removeBySessionId( self, sessionId ):
        ''' See interfaces.ISessionMappingStorage. '''
        if sessionId in self._session_id_to_mapping_id.keys():
            mappingId = self._session_id_to_mapping_id[sessionId]
            
            del self._session_id_to_mapping_id[sessionId]
            del self._mapping_id_to_session_id[mappingId]
    
    def addSession( self, mappingId, sessionId ):
        ''' See interfaces.ISessionMappingStorage. '''
        self._mapping_id_to_session_id[mappingId] = sessionId
        self._session_id_to_mapping_id[sessionId] = mappingId
class SessionMappingStorage(Persistent):
    ''' See interfaces.ISessionMappingStorage. '''

    implements(ISessionMappingStorage)

    def __init__(self):
        ''' Creates a proxy granting ticket storage. '''
        # mapping id as key, session id as value
        self._mapping_id_to_session_id = OOBForest(timedelta(hours=1), count=3)

        # session id as key, mapping id as value
        self._session_id_to_mapping_id = OOBForest(timedelta(hours=1), count=3)

    def getSessionId(self, mappingId):
        ''' See interfaces.ISessionMappingStorage. '''
        return mappingId in self._mapping_id_to_session_id.keys() and \
               self._mapping_id_to_session_id[mappingId] or None

    def removeByMappingId(self, mappingId):
        ''' See interfaces.ISessionMappingStorage. '''
        if mappingId in self._mapping_id_to_session_id.keys():
            sessionId = self._mapping_id_to_session_id[mappingId]

            del self._session_id_to_mapping_id[sessionId]
            del self._mapping_id_to_session_id[mappingId]

    def removeBySessionId(self, sessionId):
        ''' See interfaces.ISessionMappingStorage. '''
        if sessionId in self._session_id_to_mapping_id.keys():
            mappingId = self._session_id_to_mapping_id[sessionId]

            del self._session_id_to_mapping_id[sessionId]
            del self._mapping_id_to_session_id[mappingId]

    def addSession(self, mappingId, sessionId):
        ''' See interfaces.ISessionMappingStorage. '''
        self._mapping_id_to_session_id[mappingId] = sessionId
        self._session_id_to_mapping_id[sessionId] = mappingId
class ProxyGrantingTicketStorage(Persistent):
    """ See interfaces.IProxyGrantingTicketStorage. """

    implements(IProxyGrantingTicketStorage)

    # pgtIou validate in almost 60 seconds before it is considered expired.
    TIME_OUT = 60

    def __init__(self):
        """ Creates a proxy granting ticket storage. """
        self._mapping = OOBForest(datetime.timedelta(seconds=int(self.TIME_OUT / 10)), count=11)

    def add(self, pgtIou, pgt):
        """ See interfaces.IProxyGrantingTicketStorage. """
        self._mapping[pgtIou] = pgt

        # Commit explicity to make sure the pgt has been saved before we tried
        # to get it during service validate. This will be a issue when anz.cas
        # and anz.casclient deploied on the same zope instance.
        # transaction.commit()

    def retrieve(self, pgtIou):
        """ See interfaces.IProxyGrantingTicketStorage. """
        return pgtIou in self._mapping.keys() and self._mapping[pgtIou] or None
Esempio n. 7
0
 def __init__( self ):
     ''' Creates a proxy granting ticket storage. '''
     self._mapping = OOBForest(
         datetime.timedelta(seconds=int(self.TIME_OUT/10)), count=11 )
 def __init__(self):
     """ Creates a proxy granting ticket storage. """
     self._mapping = OOBForest(datetime.timedelta(seconds=int(self.TIME_OUT / 10)), count=11)