本文整理汇总了Python中pyramid.interfaces.IAuthenticationPolicy方法的典型用法代码示例。如果您正苦于以下问题:Python interfaces.IAuthenticationPolicy方法的具体用法?Python interfaces.IAuthenticationPolicy怎么用?Python interfaces.IAuthenticationPolicy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyramid.interfaces
的用法示例。
在下文中一共展示了interfaces.IAuthenticationPolicy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_interface
# 需要导入模块: from pyramid import interfaces [as 别名]
# 或者: from pyramid.interfaces import IAuthenticationPolicy [as 别名]
def test_interface():
verifyObject(IAuthenticationPolicy, JWTAuthenticationPolicy("secret"))
示例2: test_interface
# 需要导入模块: from pyramid import interfaces [as 别名]
# 或者: from pyramid.interfaces import IAuthenticationPolicy [as 别名]
def test_interface():
verifyObject(IAuthenticationPolicy, JWTCookieAuthenticationPolicy("secret"))
示例3: provision_creds
# 需要导入模块: from pyramid import interfaces [as 别名]
# 或者: from pyramid.interfaces import IAuthenticationPolicy [as 别名]
def provision_creds(request):
"""Pyramid view to provision MACAuth credentials."""
# Check that the user is authenticated.
userid = authenticated_userid(request)
if userid is None:
raise Forbidden()
# Get a reference to the MACAuthenticationPolicy plugin.
policy = request.registry.getUtility(IAuthenticationPolicy)
policy = policy.get_policy(MACAuthenticationPolicy)
# Generate a new id and secret key for the current user.
id, key = policy.encode_mac_id(request, userid)
return {"id": id, "key": key}
示例4: setUp
# 需要导入模块: from pyramid import interfaces [as 别名]
# 或者: from pyramid.interfaces import IAuthenticationPolicy [as 别名]
def setUp(self):
super(UserTestCase, self).setUp()
self.config.commit()
self.policy = self.config.registry.queryUtility(IAuthenticationPolicy)
示例5: test_that_hawkauth_can_use_custom_secrets_backend
# 需要导入模块: from pyramid import interfaces [as 别名]
# 或者: from pyramid.interfaces import IAuthenticationPolicy [as 别名]
def test_that_hawkauth_can_use_custom_secrets_backend(self):
config2 = pyramid.testing.setUp()
config2.add_settings({
"hawkauth.secrets.backend": "mozsvc.secrets.DerivedSecrets",
"hawkauth.secrets.master_secrets": "abcd 123456",
})
config2.include("mozsvc.user")
policy2 = config2.registry.queryUtility(IAuthenticationPolicy)
self.assertTrue(isinstance(policy2.secrets, DerivedSecrets))