本文整理汇总了Python中privacyidea.lib.tokens.smstoken.SmsTokenClass.check_challenge_response方法的典型用法代码示例。如果您正苦于以下问题:Python SmsTokenClass.check_challenge_response方法的具体用法?Python SmsTokenClass.check_challenge_response怎么用?Python SmsTokenClass.check_challenge_response使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类privacyidea.lib.tokens.smstoken.SmsTokenClass
的用法示例。
在下文中一共展示了SmsTokenClass.check_challenge_response方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_18_challenge_request
# 需要导入模块: from privacyidea.lib.tokens.smstoken import SmsTokenClass [as 别名]
# 或者: from privacyidea.lib.tokens.smstoken.SmsTokenClass import check_challenge_response [as 别名]
def test_18_challenge_request(self):
responses.add(responses.POST,
self.SMSHttpUrl,
body=self.success_body)
transactionid = "123456098712"
set_privacyidea_config("sms.providerConfig", self.SMSProviderConfig)
db_token = Token.query.filter_by(serial=self.serial1).first()
token = SmsTokenClass(db_token)
self.assertTrue(token.check_otp("123456", 1, 10) == -1)
c = token.create_challenge(transactionid)
self.assertTrue(c[0], c)
otp = c[1]
self.assertTrue(c[3].get("state"), transactionid)
# check for the challenges response
r = token.check_challenge_response(passw=otp)
self.assertTrue(r, r)
示例2: test_18a_challenge_request_dynamic
# 需要导入模块: from privacyidea.lib.tokens.smstoken import SmsTokenClass [as 别名]
# 或者: from privacyidea.lib.tokens.smstoken.SmsTokenClass import check_challenge_response [as 别名]
def test_18a_challenge_request_dynamic(self):
# Send a challenge request for an SMS token with a dynamic phone number
responses.add(responses.POST,
self.SMSHttpUrl,
body=self.success_body)
transactionid = "123456098712"
set_privacyidea_config("sms.providerConfig", self.SMSProviderConfig)
db_token = Token.query.filter_by(serial=self.serial2).first()
token = SmsTokenClass(db_token)
self.assertTrue(token.check_otp("123456", 1, 10) == -1)
c = token.create_challenge(transactionid)
self.assertTrue(c[0], c)
otp = c[1]
self.assertTrue(c[3].get("state"), transactionid)
# check for the challenges response
r = token.check_challenge_response(passw=otp,
options={"transaction_id":
transactionid})
self.assertTrue(r, r)