本文整理匯總了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))