def claims_info_endpoint(self, environ, start_response, *args): _log_info = logger.info query = get_or_post(environ) _log_info("Claims_info_endpoint query: '%s'" % query) _log_info("environ: %s" % environ) #ucreq = self.srvmethod.parse_userinfo_claims_request(query) #_log_info("request: %s" % ucreq) # Supposed to be "Bearer <access_token> access_token = self._bearer_auth(environ) uiresp = OpenIDSchema(**self.info_store[access_token]) resp = Response(uiresp.to_json(), content="application/json") return resp(environ, start_response)
def claims_endpoint(self, environ, start_response, *args): _log_info = logger.info query = get_or_post(environ) ucreq = self.srvmethod.parse_user_claims_request(query) _log_info("request: %s" % ucreq) if not self.function["verify_client"](environ, ucreq, self.cdb): _log_info("could not verify client") err = TokenErrorResponse(error="unathorized_client") resp = Unauthorized(err.to_json(), content="application/json") return resp(environ, start_response) if "claims_names" in ucreq: args = dict([(n, {"optional": True}) for n in ucreq["claims_names"]]) uic = UserInfoClaim(claims=Claims(**args)) else: uic = None _log_info("User info claims: %s" % uic) #oicsrv, userdb, subject, client_id="", user_info_claims=None info = self.function["userinfo"](self, self.userdb, ucreq["sub"], ucreq["client_id"], user_info_claims=uic) _log_info("User info: %s" % info.to_dict()) if self.do_aggregation(info, ucreq["sub"]): cresp = self._aggregation(info) else: cresp = self._distributed(info) _log_info("response: %s" % cresp.to_dict()) resp = Response(cresp.to_json(), content="application/json") return resp(environ, start_response)