def resource(environ, start_response, logger, kaka=None): """ """ _log_info = logger.info _session_db = environ["oic.session_db"] _conc = environ["oic.consumer.config"] _oac = consumer.factory(kaka, _session_db, _conc) if _oac is None: resp = http_util.Unauthorized("No valid cookie") return resp(environ, start_response) url = "http://localhost:8088/safe" response, content = _oac.fetch_protected_resource(url) if _oac.debug: _log_info("response: %s (%s)" % (response, type(response))) resp = http_util.factory(response.status, content) # if kaka: # resp.headers.append(kaka) return resp(environ, start_response)
def userinfo(environ, start_response, logger, kaka=None): _session_db = environ["oic.session_db"] _cc = environ["oic.client_config"] _conc = environ["oic.consumer.config"] _server_info = environ["oic.server.info"] _log_info = logger.info _oac = consumer.factory(kaka, _session_db, _conc) _log_info("_server_info: %s" % (_server_info, )) _log_info("[3]: %s" % (_oac.__dict__, )) try: uinfo = _oac.userinfo(logger) except (AuthzError, TokenError), err: resp = http_util.Unauthorized("%s" % err) return resp(environ, start_response)