예제 #1
0
    def is_challenge_request(self, passw, user, options=None):
        """
        check, if the request would start a challenge

        - default: if the passw contains only the pin, this request would
        trigger a challenge

        - in this place as well the policy for a token is checked

        :param passw: password, which might be pin or pin+otp
        :param options: dictionary of additional request parameters

        :return: returns true or false
        """

        request_is_valid = False
        # do we need to call the
        # (res, pin, otpval) = split_pin_otp(self, passw, user, options=options)
        # if policy to send sms on emtpy pin is set, return true
        realms = self.token.getRealmNames()
        if trigger_sms(realms):
            if (
                "check_s" in options.get("scope", {})
                and "challenge" in options
            ):
                request_is_valid = True
                return request_is_valid

        # if its a challenge, the passw contains only the pin
        pin_match = check_pin(self, passw, user=user, options=options)
        if pin_match is True:
            request_is_valid = True

        return request_is_valid
예제 #2
0
파일: smstoken.py 프로젝트: eespinosa/Elm
    def is_challenge_request(self, passw, user, options=None):
        '''
        check, if the request would start a challenge

        - default: if the passw contains only the pin, this request would
        trigger a challenge

        - in this place as well the policy for a token is checked

        :param passw: password, which might be pin or pin+otp
        :param options: dictionary of additional request parameters

        :retrun: returns true or false
        '''

        request_is_valid = False
        # # do we need to call the
        # (res, pin, otpval) = split_pin_otp(self, passw, user, options=options)
        realms = self.token.getRealmNames()
        if trigger_sms(realms):
            if 'check_s' in options.get('scope', {}) and 'challenge' in options:
                request_is_valid = True
                return request_is_valid

        pin_match = check_pin(self, passw, user=user, options=options)
        if pin_match is True:
            request_is_valid = True

        return request_is_valid
예제 #3
0
    def is_challenge_request(self, passw, user, options=None):
        '''
        check, if the request would start a challenge

        - default: if the passw contains only the pin, this request would
        trigger a challenge

        - in this place as well the policy for a token is checked

        :param passw: password, which might be pin or pin+otp
        :param options: dictionary of additional request parameters

        :retrun: returns true or false
        '''

        request_is_valid = False
        # # do we need to call the
        # (res, pin, otpval) = split_pin_otp(self, passw, user, options=options)
        realms = self.token.getRealmNames()
        if trigger_sms(realms, context=self.context):
            if 'check_s' in options.get('scope',
                                        {}) and 'challenge' in options:
                request_is_valid = True
                return request_is_valid

        pin_match = check_pin(self, passw, user=user, options=options)
        if pin_match is True:
            request_is_valid = True

        return request_is_valid