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


Python ClaimsClient.client_secret方法代码示例

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


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

示例1: test_srv2

# 需要导入模块: from oic.oic.claims_provider import ClaimsClient [as 别名]
# 或者: from oic.oic.claims_provider.ClaimsClient import client_secret [as 别名]
def test_srv2():
    cc = ClaimsClient(client_id="client_1")
    cc.client_secret = "hemlig"

    req = cc.construct_UserClaimsRequest(
        request_args={"sub": "diana", "claims_names": ["gender", "birthdate"]})

    srv = ClaimsServer("pyoicserv", SessionDB("https://example.com"), CDB,
                       USERINFO, verify_client,
                       keyjar=KEYJAR, dist_claims_mode=ClaimsMode(USER2MODE))

    srv.keyjar[""] = keybundle_from_local_file("%s/rsa.key" % BASE_PATH, "rsa", ["ver", "sig"])

    assert srv

    resp = srv.claims_endpoint(req.to_urlencoded(), "")

    print resp.message

    ucr = UserClaimsResponse().deserialize(resp.message, "json")
    ucr.verify(keyjar=srv.keyjar)

    print ucr
    assert _eq(ucr["claims_names"], ["gender", "birthdate"])
    assert "jwt" in ucr
开发者ID:takehikokodama,项目名称:pyoidc,代码行数:27,代码来源:test_x_claims.py

示例2: test_srv2

# 需要导入模块: from oic.oic.claims_provider import ClaimsClient [as 别名]
# 或者: from oic.oic.claims_provider.ClaimsClient import client_secret [as 别名]
def test_srv2():
    cc = ClaimsClient(client_id="client_1")
    cc.client_secret="hemlig"

    req = cc.construct_UserClaimsRequest(request_args={"user_id": "diana",
                                        "claims_names":["gender", "birthdate"]})

    srv = ClaimsServer("name", None, CDB, FUNCTIONS, USERDB)

    srv.keystore.set_sign_key(rsa_load("rsa.key"), "rsa")
    assert srv

    environ = BASE_ENVIRON.copy()
    environ["REQUEST_METHOD"] = "POST"
    txt = req.to_urlencoded()
    environ["CONTENT_LENGTH"] = len(txt)
    fil = StringIO.StringIO(buf=txt)
    environ["wsgi.input"] = fil

    resp = srv.claims_endpoint(environ, start_response, LOG())

    print resp
    assert len(resp) == 1

    ucr = UserClaimsResponse().deserialize(resp[0], "json")
    ucr.verify(key = srv.keystore.get_keys("sig", owner=None))

    print ucr
    assert _eq(ucr["claims_names"], ["gender", "birthdate"])
    assert "jwt" in ucr
开发者ID:imsoftware,项目名称:pyoidc,代码行数:32,代码来源:test_claims.py

示例3: test_srv2

# 需要导入模块: from oic.oic.claims_provider import ClaimsClient [as 别名]
# 或者: from oic.oic.claims_provider.ClaimsClient import client_secret [as 别名]
def test_srv2():
    cc = ClaimsClient(client_id="client_1")
    cc.client_secret="hemlig"

    req = cc.construct_UserClaimsRequest(request_args={"sub": "diana",
                                        "claims_names":["gender", "birthdate"]})

    srv = ClaimsServer("name", None, CDB, FUNCTIONS, USERDB)

    srv.keyjar[""] = [KeyBundle(source="file://rsa.key", usage=["ver", "sig"])]
    assert srv

    environ = BASE_ENVIRON.copy()
    environ["REQUEST_METHOD"] = "POST"
    txt = req.to_urlencoded()
    environ["CONTENT_LENGTH"] = len(txt)
    fil = StringIO.StringIO(buf=txt)
    environ["wsgi.input"] = fil

    resp = srv.claims_endpoint(environ, start_response, LOG())

    print resp
    assert len(resp) == 1

    ucr = UserClaimsResponse().deserialize(resp[0], "json")
    ucr.verify(keyjar = srv.keyjar)

    print ucr
    assert _eq(ucr["claims_names"], ["gender", "birthdate"])
    assert "jwt" in ucr
开发者ID:asheidan,项目名称:pyoidc,代码行数:32,代码来源:test_x_claims.py

示例4: dynamic_init_claims_client

# 需要导入模块: from oic.oic.claims_provider import ClaimsClient [as 别名]
# 或者: from oic.oic.claims_provider.ClaimsClient import client_secret [as 别名]
def dynamic_init_claims_client(issuer, req_args):
    cc = ClaimsClient()
    # dynamic provider info discovery
    cc.provider_config(issuer)
    resp = cc.do_registration_request(request_args=req_args)
    cc.client_id = resp.client_id
    cc.client_secret = resp.client_secret
    return cc
开发者ID:dash-dash,项目名称:pyoidc,代码行数:10,代码来源:broken_server.py

示例5: test_c2

# 需要导入模块: from oic.oic.claims_provider import ClaimsClient [as 别名]
# 或者: from oic.oic.claims_provider.ClaimsClient import client_secret [as 别名]
def test_c2():
    cc = ClaimsClient(client_id="client_1")
    cc.client_secret = "hemlig"
    cc.userclaims_endpoint = "https://example.com/claims"
    request = UserClaimsRequest
    method = "POST"
    request_args = {"sub": "norah", "claims_names": ["gender", "birthdate"]}

    cc.request_info(request, method=method, request_args=request_args)
开发者ID:HaToHo,项目名称:pyoidc,代码行数:11,代码来源:test_x_claims.py

示例6: test_1

# 需要导入模块: from oic.oic.claims_provider import ClaimsClient [as 别名]
# 或者: from oic.oic.claims_provider.ClaimsClient import client_secret [as 别名]
def test_1():
    cc = ClaimsClient(client_id="client_1")
    cc.client_secret="hemlig"

    req = cc.construct_UserClaimsRequest(request_args={"user_id": "norah",
                                        "claims_names":["gender", "birthdate"]})

    print req
    assert req.type() == "UserClaimsRequest"
    assert _eq(req.keys(),['client_secret', 'claims_names', 'user_id',
                           'client_id'])
    assert req["user_id"] == "norah"
    assert req["client_id"] == "client_1"
开发者ID:imsoftware,项目名称:pyoidc,代码行数:15,代码来源:test_claims.py

示例7: init_claims_clients

# 需要导入模块: from oic.oic.claims_provider import ClaimsClient [as 别名]
# 或者: from oic.oic.claims_provider.ClaimsClient import client_secret [as 别名]
    def init_claims_clients(self, client_info):
        res = {}
        if client_info is None:
            return res

        for cid, specs in client_info.items():
            if "dynamic" in specs:
                cc = self.dynamic_init_claims_client(cid, specs["client"])
            else:
                cc = ClaimsClient(client_id=specs["client_id"])
                cc.client_secret = specs["client_secret"]
                try:
                    cc.keyjar.add(specs["client_id"], specs["jwks_uri"])
                except KeyError:
                    pass
                cc.userclaims_endpoint = specs["userclaims_endpoint"]
            res[cid] = cc
        return res
开发者ID:Omosofe,项目名称:pyoidc,代码行数:20,代码来源:distaggr.py

示例8: init_claims_clients

# 需要导入模块: from oic.oic.claims_provider import ClaimsClient [as 别名]
# 或者: from oic.oic.claims_provider.ClaimsClient import client_secret [as 别名]
def init_claims_clients(client_info):
    res = {}
    for cid, specs in client_info.items():
        if "dynamic" in specs:
            cc = dynamic_init_claims_client(cid, args)
        else:
            cc = ClaimsClient(client_id=specs["client_id"])
            cc.client_secret = specs["client_secret"]
            try:
                cc.keystore.load_x509_cert(specs["x509_url"], "ver", cid)
            except KeyError:
                pass
            try:
                cc.keystore.load_jwk(specs["jwk_url"], "ver", cid)
            except KeyError:
                pass
            cc.userclaims_endpoint = specs["userclaims_endpoint"]
        res[cid] = cc
    return res
开发者ID:imsoftware,项目名称:pyoidc,代码行数:21,代码来源:oc3_server.py

示例9: init_claims_clients

# 需要导入模块: from oic.oic.claims_provider import ClaimsClient [as 别名]
# 或者: from oic.oic.claims_provider.ClaimsClient import client_secret [as 别名]
def init_claims_clients(client_info):
    res = {}
    for cid, specs in client_info.items():
        if "dynamic" in specs:
            cc = dynamic_init_claims_client(cid, args)
        else:
            cc = ClaimsClient(client_id=specs["client_id"])
            cc.client_secret=specs["client_secret"]
            _req = cc.keystore.crypt.http_request
            _s2k = cc.keystore.spec2key
            try:
                for typ, key in load_x509_cert(_req, specs["x509_url"], _s2k):
                    cc.keystore.set_verify_key(key, typ, cid)
            except KeyError:
                pass
            try:
                for typ, key in load_jwk(_req, specs["jwk_url"], _s2k):
                    cc.keystore.set_verify_key(key, typ, cid)
            except KeyError:
                pass
            cc.userclaims_endpoint = specs["userclaims_endpoint"]
        res[cid] = cc
    return res
开发者ID:dash-dash,项目名称:pyoidc,代码行数:25,代码来源:broken_server.py

示例10: verify_client

# 需要导入模块: from oic.oic.claims_provider import ClaimsClient [as 别名]
# 或者: from oic.oic.claims_provider.ClaimsClient import client_secret [as 别名]
                'COMMAND_MODE': 'unix2003'}

CDB = {
    "client_1": { "client_secret": "hemlig"}
}

def verify_client(env, req, cdb):
    return True

FUNCTIONS = {
    "verify_client": verify_client,
    "userinfo": user_info
}

cc = ClaimsClient(client_id="client_1")
cc.client_secret="hemlig"

req = cc.construct_UserClaimsRequest(request_args={"user_id": "diana",
                                                   "claims_names":["gender", "birthdate"]})

srv = ClaimsServer("name", None, CDB, FUNCTIONS, USERDB)

srv.keyjar[""] = [KeyChain(source="file://rsa.key", usage=["ver", "sig"])]
assert srv

environ = BASE_ENVIRON.copy()
environ["REQUEST_METHOD"] = "POST"
txt = req.to_urlencoded()
environ["CONTENT_LENGTH"] = len(txt)
fil = StringIO.StringIO(buf=txt)
environ["wsgi.input"] = fil
开发者ID:asheidan,项目名称:pyoidc,代码行数:33,代码来源:debug_claims_srv2.py


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