本文整理汇总了Python中oic.oic.message.RegistrationRequest.items方法的典型用法代码示例。如果您正苦于以下问题:Python RegistrationRequest.items方法的具体用法?Python RegistrationRequest.items怎么用?Python RegistrationRequest.items使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oic.oic.message.RegistrationRequest
的用法示例。
在下文中一共展示了RegistrationRequest.items方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: registration_endpoint
# 需要导入模块: from oic.oic.message import RegistrationRequest [as 别名]
# 或者: from oic.oic.message.RegistrationRequest import items [as 别名]
def registration_endpoint(self, environ, start_response, **kwargs):
logger.debug("@registration_endpoint")
try:
query = kwargs["query"]
except KeyError:
try:
query = get_or_post(environ)
except UnsupportedMethod:
resp = BadRequest("Unsupported method")
return resp(environ, start_response)
request = RegistrationRequest().deserialize(query, "urlencoded")
logger.info("registration_request:%s" % request.to_dict())
_keystore = self.server.keystore
if request["type"] == "client_associate":
# create new id och secret
client_id = rndstr(12)
while client_id in self.cdb:
client_id = rndstr(12)
client_secret = secret(self.seed, client_id)
self.cdb[client_id] = {
"client_secret":client_secret
}
_cinfo = self.cdb[client_id]
if "redirect_uris" in request:
for uri in request["redirect_uris"]:
if urlparse.urlparse(uri).fragment:
err = ClientRegistrationErrorResponse(
error="invalid_configuration_parameter",
error_description="redirect_uri contains fragment")
resp = Response(err.to_json(),
content="application/json",
status="400 Bad Request")
return resp(environ, start_response)
for key,val in request.items():
_cinfo[key] = val
try:
self.keystore.load_keys(request, client_id)
except Exception, err:
logger.error("Failed to load client keys: %s" % request.to_dict())
err = ClientRegistrationErrorResponse(
error="invalid_configuration_parameter",
error_description="%s" % err)
resp = Response(err.to_json(), content="application/json",
status="400 Bad Request")
return resp(environ, start_response)
response = RegistrationResponseCARS(client_id=client_id)
示例2: KeyJar
# 需要导入模块: from oic.oic.message import RegistrationRequest [as 别名]
# 或者: from oic.oic.message.RegistrationRequest import items [as 别名]
# ----------------------------------------
# get the Developers key and issuer ID
# ----------------------------------------
DEV_keyjar = KeyJar()
DEV_keyjar.add_kb('', KeyBundle(_sost_dev['signing_key']))
dev_iss = _rp_sost['iss']
# -----------------------------------------------------------------------------
_sost_rp = unpack_software_statement(rp_swamid_sost, dev_iss, DEV_keyjar)
assert _sost_rp
regreq_rp = RegistrationRequest(**_sost_rp)
regreq_rp.weed()
regreq_dev = RegistrationRequest(**_sost_dev)
regreq_dev.weed()
for key, val in regreq_rp.items():
if key not in regreq_dev:
regreq_dev[key] = val
elif isinstance(val, list):
regreq_dev[key] = list(set(regreq_dev[key]).intersection(val))
print(70 * "-")
print_lines(json.dumps(regreq_dev.to_dict(), sort_keys=True, indent=2,
separators=(',', ': ')))