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


Python KeyBundle.update方法代码示例

本文整理汇总了Python中oic.utils.keyio.KeyBundle.update方法的典型用法代码示例。如果您正苦于以下问题:Python KeyBundle.update方法的具体用法?Python KeyBundle.update怎么用?Python KeyBundle.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oic.utils.keyio.KeyBundle的用法示例。


在下文中一共展示了KeyBundle.update方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _func

# 需要导入模块: from oic.utils.keyio import KeyBundle [as 别名]
# 或者: from oic.utils.keyio.KeyBundle import update [as 别名]
    def _func(self, conv):

        response = get_protocol_response(conv, ASConfigurationResponse)
        if not response:
            response = get_protocol_response(conv, ServerMetadata)

        response = response[-1]  # Should only be one but ...
        res = {}

        try:
            _jwks_uri = response['jwks_uri']
        except KeyError:
            try:
                kb = KeyBundle(response['jwks'])
            except KeyBundle:
                self._message = "Neither jwks_uri or jwks defined"
                self._status = ERROR
            except UnknownKeyType as err:
                self._message = '{}'.format(err)
                self._status = ERROR
        else:
            kb = KeyBundle(source=_jwks_uri, verify_ssl=False)
            try:
                kb.update()
            except UpdateFailed as err:
                self._message = '{}'.format(err)
                self._status = ERROR

        return res
开发者ID:heart-test-suites,项目名称:oauth2test,代码行数:31,代码来源:check.py

示例2: __call__

# 需要导入模块: from oic.utils.keyio import KeyBundle [as 别名]
# 或者: from oic.utils.keyio.KeyBundle import update [as 别名]
    def __call__(self):
        kb = KeyBundle(source=self.conv.entity.provider_info["jwks_uri"])
        kb.verify_ssl = False
        kb.update()

        try:
            self.conv.keybundle.append(kb)
        except AttributeError:
            self.conv.keybundle = [kb]
开发者ID:rohe,项目名称:otest,代码行数:11,代码来源:operation.py

示例3: __call__

# 需要导入模块: from oic.utils.keyio import KeyBundle [as 别名]
# 或者: from oic.utils.keyio.KeyBundle import update [as 别名]
    def __call__(self, conv, **kwargs):
        pi = conv.client.provider_info
        kb = KeyBundle(source=pi["jwks_uri"])
        kb.verify_ssl = False
        kb.update()

        try:
            conv.keybundle.append(kb)
        except AttributeError:
            conv.keybundle = [kb]
开发者ID:rohe,项目名称:oictest,代码行数:12,代码来源:testclass.py

示例4: test_chain_1

# 需要导入模块: from oic.utils.keyio import KeyBundle [as 别名]
# 或者: from oic.utils.keyio.KeyBundle import update [as 别名]
def test_chain_1():
    kc = KeyBundle([{"kty": "oct", "key": "supersecret", "use": "sig"}])
    assert len(kc.get("oct")) == 1
    assert len(kc.get("rsa")) == 0
    assert kc.remote is False
    assert kc.source is None

    kc.update()  # Nothing should happen
    assert len(kc.get("oct")) == 1
    assert len(kc.get("rsa")) == 0
    assert kc.remote is False
    assert kc.source is None
开发者ID:dajiaji,项目名称:pyoidc,代码行数:14,代码来源:test_keyio.py

示例5: test_chain_1

# 需要导入模块: from oic.utils.keyio import KeyBundle [as 别名]
# 或者: from oic.utils.keyio.KeyBundle import update [as 别名]
def test_chain_1():
    kc = KeyBundle({"hmac": "supersecret"}, usage="sig")
    assert len(kc.get("hmac")) == 1
    assert len(kc.get("rsa")) == 0
    assert kc.usage == ["sig"]
    assert kc.remote == False
    assert kc.source is None

    kc.update() # Nothing should happen
    assert len(kc.get("hmac")) == 1
    assert len(kc.get("rsa")) == 0
    assert kc.usage == ["sig"]
    assert kc.remote == False
    assert kc.source is None
开发者ID:asheidan,项目名称:pyoidc,代码行数:16,代码来源:test_keyio.py

示例6: test_chain_3

# 需要导入模块: from oic.utils.keyio import KeyBundle [as 别名]
# 或者: from oic.utils.keyio.KeyBundle import update [as 别名]
def test_chain_3():
    kc = KeyBundle(source="file://../oc3/certs/server.crt", type="rsa",
                  src_type="x509", usage=["sig", "enc"])
    assert kc.usage == ["sig", "enc"]
    assert kc.remote == False
    assert kc.source == "../oc3/certs/server.crt"
    assert len(kc.get("hmac")) == 0
    assert len(kc.get("rsa")) == 1

    key = kc.get("rsa")[0]
    assert isinstance(key, M2Crypto.RSA.RSA)

    kc.update()
    assert kc.usage == ["sig", "enc"]
    assert kc.remote == False
    assert kc.source == "../oc3/certs/server.crt"
    assert len(kc.get("hmac")) == 0
    assert len(kc.get("rsa")) == 1

    key = kc.get("rsa")[0]
    assert isinstance(key, M2Crypto.RSA.RSA)
开发者ID:asheidan,项目名称:pyoidc,代码行数:23,代码来源:test_keyio.py

示例7: test_chain_2

# 需要导入模块: from oic.utils.keyio import KeyBundle [as 别名]
# 或者: from oic.utils.keyio.KeyBundle import update [as 别名]
def test_chain_2():
    kc = KeyBundle(source="file://../oc3/certs/mycert.key", type="rsa",
                  usage=["ver", "sig"])
    assert kc.usage == ["ver", "sig"]
    assert kc.remote == False
    assert kc.source == "../oc3/certs/mycert.key"
    assert len(kc.get("hmac")) == 0
    assert len(kc.get("rsa")) == 1

    key = kc.get("rsa")[0]
    assert isinstance(key, M2Crypto.RSA.RSA)

    kc.update()
    assert kc.usage == ["ver", "sig"]
    assert kc.remote == False
    assert kc.source == "../oc3/certs/mycert.key"
    assert len(kc.get("hmac")) == 0
    assert len(kc.get("rsa")) == 1

    key = kc.get("rsa")[0]
    assert isinstance(key, M2Crypto.RSA.RSA)
开发者ID:asheidan,项目名称:pyoidc,代码行数:23,代码来源:test_keyio.py

示例8: KeyBundle

# 需要导入模块: from oic.utils.keyio import KeyBundle [as 别名]
# 或者: from oic.utils.keyio.KeyBundle import update [as 别名]
from oic.utils.keyio import KeyBundle, key_eq

__author__ = 'rolandh'

jwk_url = ["https://connect.openid4.us/connect4us.jwk", # edmund
       "https://connect-op.heroku.com/jwk.json"]    # nov

x509_url = ["https://connect-op.heroku.com/cert.pem"]

kc0 = KeyBundle(source=jwk_url[1], src_type="jwk", type="rsa", usage=["sig", "enc"])

kc1 = KeyBundle(source=x509_url[0], src_type="x509", type="rsa", usage=["sig", "enc"])

kc0.update()

print kc0

kc1.update()

print kc1

print key_eq(kc0.get("rsa")[0], kc1.get("rsa")[0])
开发者ID:asheidan,项目名称:pyoidc,代码行数:24,代码来源:debug_keybundle.py


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