當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。