本文整理汇总了Python中privacyidea.lib.tokens.emailtoken.EmailTokenClass.check_challenge_response方法的典型用法代码示例。如果您正苦于以下问题:Python EmailTokenClass.check_challenge_response方法的具体用法?Python EmailTokenClass.check_challenge_response怎么用?Python EmailTokenClass.check_challenge_response使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类privacyidea.lib.tokens.emailtoken.EmailTokenClass
的用法示例。
在下文中一共展示了EmailTokenClass.check_challenge_response方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_18_challenge_request
# 需要导入模块: from privacyidea.lib.tokens.emailtoken import EmailTokenClass [as 别名]
# 或者: from privacyidea.lib.tokens.emailtoken.EmailTokenClass import check_challenge_response [as 别名]
def test_18_challenge_request(self):
smtpmock.setdata(response={})
transactionid = "123456098712"
set_privacyidea_config("email.mailserver", "localhost")
set_privacyidea_config("email.username", "user")
set_privacyidea_config("email.username", "password")
set_privacyidea_config("email.tls", True)
db_token = Token.query.filter_by(serial=self.serial1).first()
token = EmailTokenClass(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_22_new_email_config
# 需要导入模块: from privacyidea.lib.tokens.emailtoken import EmailTokenClass [as 别名]
# 或者: from privacyidea.lib.tokens.emailtoken.EmailTokenClass import check_challenge_response [as 别名]
def test_22_new_email_config(self):
smtpmock.setdata(response={"[email protected]": (200, 'OK')})
transactionid = "123456098717"
# send the email with the new configuration
r = add_smtpserver(identifier="myServer", server="1.2.3.4")
set_privacyidea_config("email.identifier", "myServer")
db_token = Token.query.filter_by(serial=self.serial1).first()
token = EmailTokenClass(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)
delete_smtpserver("myServer")
delete_privacyidea_config("email.identifier")