def getAuthenticatedSession( self , userEmailAddr , passwd=None, ticket_id=None ):
        """
        @return: an already existing authenticated session.
        @param userEmailAddr: the user email
        @type userEmailAddr: a Mobyle.Net.EmailAddress instance
        @param passwd: the session pass word 
        @type passwd: string
        @raise AuthenticationError: if the passwd doesn't match the session passwd
        @raise AuthenticationError: the session doesn't already exists
        """
        mymd5 = md5()
        mymd5.update( str( userEmailAddr ) )
        key = mymd5.hexdigest()

        try:
            session = self.__sessions[ key ]
            if session.checkPasswd( passwd ):
                return session
            else:
                raise AuthenticationError , "There is no user with this email and password"
       
        except KeyError: 
            sessionDir = os.path.normpath( os.path.join( self.cfg.user_sessions_path() , AuthenticatedSession.DIRNAME , key ) )
          
            if os.path.exists( sessionDir ):
                session = AuthenticatedSession( self.cfg , userEmailAddr , passwd=passwd, ticket_id=ticket_id )
                self.__sessions[ session.getKey() ] = session  
                return session
            else: 
                raise AuthenticationError , "There is no user with this email" 
    def createAuthenticatedSession( self , userEmailAddr , passwd ):
        """
        create an authenticated session with email as login and passwd as pass word
        @param userEmailAddr: the user email
        @type userEmailAddr: a Mobyle.Net.EmailAddress object
        @param passwd: the user password
        @type passwd: string
        @return: a new authenticated session
        @rtype: session instance
        @raise AuthenticationError: if there is already a session with this email, or the email is not allowed on this server
        """
        authenticatedSessionAllowed = self.cfg.authenticatedSession()
      
        if authenticatedSessionAllowed == 'no':
            self.log.error("can't create  session AUTHENTICATED_SESSION is set to \"no\" in Local/Config/Config.py")          
            raise SessionError , "can't create  authenticated session: permission denied"

        mymd5 = md5()
        mymd5.update( str( userEmailAddr ) )
        key = mymd5.hexdigest()

        if self.__sessions.has_key( key ) : 
            msg = "Try to create a new Session with email %s, the %s Session already exist" % ( userEmailAddr , key)
            self.log.error( msg )        
            raise AuthenticationError , "user with the email you specify already exist" 
       
        else:  
            sessionDir = os.path.normpath( os.path.join( self.cfg.user_sessions_path() , AuthenticatedSession.DIRNAME , key ) )
          
            if os.path.exists( sessionDir ):
                msg = "Try to create a new Session with email %s, the %s Session already exist" % ( userEmailAddr , key)
                self.log.error( msg )
                raise AuthenticationError , "user with the email you specify already exist" 
                
            session = AuthenticatedSession( self.cfg , userEmailAddr , passwd )
            self.__sessions[ session.getKey() ] = session   
            return session