mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Make callWithRequest use whitelisted headers
This commit is contained in:
parent
f9f4b79626
commit
7f75efb43a
2 changed files with 6 additions and 6 deletions
|
@ -3,12 +3,12 @@ import Promise from 'bluebird';
|
|||
import Boom from 'boom';
|
||||
import getBasicAuthRealm from './get_basic_auth_realm';
|
||||
import toPath from 'lodash/internal/toPath';
|
||||
import filterHeaders from './filter_headers';
|
||||
|
||||
module.exports = (client) => {
|
||||
module.exports = (server, client) => {
|
||||
return (req, endpoint, params = {}) => {
|
||||
if (req.headers.authorization) {
|
||||
_.set(params, 'headers.authorization', req.headers.authorization);
|
||||
}
|
||||
const filteredHeaders = filterHeaders(req.headers, server.config().get('elasticsearch.requestHeaders'));
|
||||
_.set(params, 'headers', filteredHeaders);
|
||||
const path = toPath(endpoint);
|
||||
const api = _.get(client, path);
|
||||
let apiContext = _.get(client, path.slice(0, -1));
|
||||
|
|
|
@ -78,8 +78,8 @@ module.exports = function (server) {
|
|||
server.expose('ElasticsearchClientLogging', ElasticsearchClientLogging);
|
||||
server.expose('client', client);
|
||||
server.expose('createClient', createClient);
|
||||
server.expose('callWithRequestFactory', callWithRequest);
|
||||
server.expose('callWithRequest', callWithRequest(noAuthClient));
|
||||
server.expose('callWithRequestFactory', _.partial(callWithRequest, server));
|
||||
server.expose('callWithRequest', callWithRequest(server, noAuthClient));
|
||||
server.expose('errors', elasticsearch.errors);
|
||||
|
||||
return client;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue