def testSignedSharedAuthBackendFromUser(self):
     """
     ensure we can build a cookie string for a user
     """
     self.assertEqual(
         signed.loads(SharedAuthBackend.getCookieStr(self.user)),
         signed.loads(self.signed_str))
Esempio n. 2
0
    def userFromSignedStr(signed_str):
        """
        encode a sign a string
        """
        dct = signed.loads(signed_str)

        should_continue = True
        extra_params_consumer = getattr(settings, 'EXTRA_PARAMS_CONSUMER', None)
        if extra_params_consumer:
            extra_params_consumer = get_callable(extra_params_consumer)
            try:
                should_continue, user = extra_params_consumer(dct['u'], dct['extra_params'])
            except KeyError, e:
                logger.warning('Invalid signed_str data: %s' % e)
                should_continue = False
Esempio n. 3
0
    def userFromSignedStr(signed_str):
        """
        encode a sign a string
        """
        dct = signed.loads(signed_str)

        should_continue = True
        extra_params_consumer = getattr(settings, 'EXTRA_PARAMS_CONSUMER', None)
        if extra_params_consumer:
            extra_params_consumer = get_callable(extra_params_consumer)
            try:
                should_continue, user = extra_params_consumer(dct['u'], dct['extra_params'])
            except KeyError, e:
                if LOGGIN:
                    logger.warning('Invalid signed_str data: %s' % e)
                should_continue = False
Esempio n. 4
0
    def userFromSignedStr(signed_str):
        """
        encode a sign a string
        """
        logger.debug('extracting user record from signed cookie')
        dct = signed.loads(signed_str)

        should_continue = True
        extra_params_consumer = getattr(settings, 'EXTRA_PARAMS_CONSUMER', None)
        if extra_params_consumer:
            logger.debug('1 attempting to execute EXTRA_PARAMS_CONSUMER %s'%(extra_params_consumer))
            extra_params_consumer = get_callable(extra_params_consumer)
            try:
                should_continue, user = extra_params_consumer(dct['u'], dct['extra_params'])
            except KeyError, e:
                logger.warning('Invalid signed_str data: %s' % e)
                should_continue = False
            logger.debug('2 completed execution of EXTRA_PARAMS_CONSUMER %s'%(extra_params_consumer))
Esempio n. 5
0
    def userFromSignedStr(signed_str):
        """
        encode a sign a string
        """
        if LOGGIN:
            logger.debug('extracting user record from signed cookie')
        dct = signed.loads(signed_str)

        should_continue = True
        extra_params_consumer = getattr(settings, 'EXTRA_PARAMS_CONSUMER', None)
        if extra_params_consumer:
            if LOGGIN:
                logger.debug('1 attempting to execute EXTRA_PARAMS_CONSUMER %s'%(extra_params_consumer))
            extra_params_consumer = get_callable(extra_params_consumer)
            try:
                should_continue, user = extra_params_consumer(dct['u'], dct['extra_params'])
            except KeyError, e:
                if LOGGIN:
                    logger.warning('Invalid signed_str data: %s' % e)
                should_continue = False
            if LOGGIN:
                logger.debug('2 completed execution of EXTRA_PARAMS_CONSUMER %s'%(extra_params_consumer))
Esempio n. 6
0
 def userFromSignedStr(signed_str):
     """
     encode a sign a string
     """
     return SharedAuthBackend.userFromDict(signed.loads(signed_str))
Esempio n. 7
0
 def testSignedSharedAuthBackendFromUser(self):
     """
     ensure we can build a cookie string for a user
     """
     self.assertEqual(signed.loads(SharedAuthBackend.getCookieStr(self.user)), signed.loads(self.signed_str))