本文整理汇总了Python中oic.oauth2.message.AuthorizationRequest.keys方法的典型用法代码示例。如果您正苦于以下问题:Python AuthorizationRequest.keys方法的具体用法?Python AuthorizationRequest.keys怎么用?Python AuthorizationRequest.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oic.oauth2.message.AuthorizationRequest
的用法示例。
在下文中一共展示了AuthorizationRequest.keys方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_multiple_response_types_urlencoded
# 需要导入模块: from oic.oauth2.message import AuthorizationRequest [as 别名]
# 或者: from oic.oauth2.message.AuthorizationRequest import keys [as 别名]
def test_multiple_response_types_urlencoded(self):
ar = AuthorizationRequest(response_type=["code", "token"],
client_id="foobar")
ue = ar.to_urlencoded()
ue_splits = ue.split('&')
expected_ue_splits = "response_type=code+token&client_id=foobar".split(
'&')
assert _eq(ue_splits, expected_ue_splits)
are = AuthorizationRequest().deserialize(ue, "urlencoded")
assert _eq(are.keys(), ["response_type", "client_id"])
assert _eq(are["response_type"], ["code", "token"])
示例2: test_multiple_response_types_json
# 需要导入模块: from oic.oauth2.message import AuthorizationRequest [as 别名]
# 或者: from oic.oauth2.message.AuthorizationRequest import keys [as 别名]
def test_multiple_response_types_json(self):
ar = AuthorizationRequest(response_type=["code", "token"],
client_id="foobar")
ue = ar.to_json()
ue_obj = json.loads(ue)
expected_ue_obj = {
"response_type": "code token",
"client_id": "foobar"
}
assert ue_obj == expected_ue_obj
are = AuthorizationRequest().deserialize(ue, "json")
assert _eq(are.keys(), ["response_type", "client_id"])
assert _eq(are["response_type"], ["code", "token"])
示例3: _authn
# 需要导入模块: from oic.oauth2.message import AuthorizationRequest [as 别名]
# 或者: from oic.oauth2.message.AuthorizationRequest import keys [as 别名]
# To authenticate or Not
if identity is None: # No!
if "prompt" in areq and "none" in areq["prompt"]:
# Need to authenticate but not allowed
return self._redirect_authz_error("login_required",
redirect_uri)
else:
# Do authentication
return _authn(**authn_args)
else:
user = identity["uid"]
aevent = AuthnEvent(user, authn_info=acr)
# If I get this far the person is already authenticated
logger.debug("- authenticated -")
logger.debug("AREQ keys: %s" % areq.keys())
try:
oidc_req = areq["request"]
except KeyError:
oidc_req = None
skey = self.sdb.create_authz_session(aevent, areq, oidreq=oidc_req)
# Now about the authorization step.
try:
permissions = self.authz.permissions(cookie)
if not permissions:
return self.authz(user, skey)
except (ToOld, TamperAllert):
return self.authz(user, areq, skey)