当前位置: 首页>>代码示例>>Python>>正文


Python interfaces.IAuthenticationPolicy方法代码示例

本文整理汇总了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")) 
开发者ID:wichert,项目名称:pyramid_jwt,代码行数:4,代码来源:test_policy.py

示例2: test_interface

# 需要导入模块: from pyramid import interfaces [as 别名]
# 或者: from pyramid.interfaces import IAuthenticationPolicy [as 别名]
def test_interface():
    verifyObject(IAuthenticationPolicy, JWTCookieAuthenticationPolicy("secret")) 
开发者ID:wichert,项目名称:pyramid_jwt,代码行数:4,代码来源:test_cookies.py

示例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} 
开发者ID:wichert,项目名称:rest_toolkit,代码行数:17,代码来源:macauth_demo.py

示例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) 
开发者ID:mozilla-services,项目名称:shavar,代码行数:6,代码来源:test_user.py

示例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)) 
开发者ID:mozilla-services,项目名称:shavar,代码行数:11,代码来源:test_user.py


注:本文中的pyramid.interfaces.IAuthenticationPolicy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。