本文整理汇总了Python中oic.oauth2.message.AuthorizationRequest.serialize方法的典型用法代码示例。如果您正苦于以下问题:Python AuthorizationRequest.serialize方法的具体用法?Python AuthorizationRequest.serialize怎么用?Python AuthorizationRequest.serialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oic.oauth2.message.AuthorizationRequest
的用法示例。
在下文中一共展示了AuthorizationRequest.serialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_json_serialize_deserialize
# 需要导入模块: from oic.oauth2.message import AuthorizationRequest [as 别名]
# 或者: from oic.oauth2.message.AuthorizationRequest import serialize [as 别名]
def test_json_serialize_deserialize(self):
ar = AuthorizationRequest(response_type=["code"],
client_id="foobar")
jtxt = ar.serialize(method="json")
ar2 = AuthorizationRequest().deserialize(jtxt, "json")
assert ar == ar2
示例2: test_req_json_serialize
# 需要导入模块: from oic.oauth2.message import AuthorizationRequest [as 别名]
# 或者: from oic.oauth2.message.AuthorizationRequest import serialize [as 别名]
def test_req_json_serialize(self):
ar = AuthorizationRequest(response_type=["code"],
client_id="foobar")
js_obj = json.loads(ar.serialize(method="json"))
expected_js_obj = {
"response_type": "code",
"client_id": "foobar"
}
assert js_obj == expected_js_obj
示例3: test_json_resp_type_token
# 需要导入模块: from oic.oauth2.message import AuthorizationRequest [as 别名]
# 或者: from oic.oauth2.message.AuthorizationRequest import serialize [as 别名]
def test_json_resp_type_token(self):
ar = AuthorizationRequest(response_type=["token"],
client_id="s6BhdRkqt3",
redirect_uri="https://client.example.com/cb",
state="xyz")
ue_obj = json.loads(ar.serialize(method="json"))
expected_ue_obj = {
"state": "xyz",
"redirect_uri": "https://client.example.com/cb",
"response_type": "token",
"client_id": "s6BhdRkqt3"
}
assert ue_obj == expected_ue_obj
示例4: test_json_multiple_params
# 需要导入模块: from oic.oauth2.message import AuthorizationRequest [as 别名]
# 或者: from oic.oauth2.message.AuthorizationRequest import serialize [as 别名]
def test_json_multiple_params(self):
ar = AuthorizationRequest(response_type=["code"],
client_id="foobar",
redirect_uri="http://foobar.example.com/oaclient",
state="cold")
ue_obj = json.loads(ar.serialize(method="json"))
expected_ue_obj = {
"response_type": "code",
"state": "cold",
"redirect_uri": "http://foobar.example.com/oaclient",
"client_id": "foobar"
}
assert ue_obj == expected_ue_obj
示例5: test_json_serizalize_deserialize_multiple_params
# 需要导入模块: from oic.oauth2.message import AuthorizationRequest [as 别名]
# 或者: from oic.oauth2.message.AuthorizationRequest import serialize [as 别名]
def test_json_serizalize_deserialize_multiple_params(self):
argv = {"scope": ["openid"],
"state": "id-b0be8bb64118c3ec5f70093a1174b039",
"redirect_uri": "http://localhost:8087authz",
"response_type": ["code"],
"client_id": "a1b2c3"}
arq = AuthorizationRequest(**argv)
jstr = arq.serialize(method="json")
jarq = AuthorizationRequest().deserialize(jstr, "json")
assert jarq["scope"] == ["openid"]
assert jarq["response_type"] == ["code"]
assert jarq["redirect_uri"] == "http://localhost:8087authz"
assert jarq["state"] == "id-b0be8bb64118c3ec5f70093a1174b039"
assert jarq["client_id"] == "a1b2c3"