add separate datasource parameter withCredentials

This commit is contained in:
Mitsuhiro Tanda
2015-12-09 14:44:28 +09:00
parent 6edd6c8f03
commit 8264c76642
2 changed files with 8 additions and 2 deletions
@@ -19,6 +19,7 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
function ElasticDatasource(datasource) {
this.type = 'elasticsearch';
this.basicAuth = datasource.basicAuth;
this.withCredentials = datasource.withCredentials;
this.url = datasource.url;
this.name = datasource.name;
this.index = datasource.index;
@@ -38,8 +39,10 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
data: data
};
if (this.basicAuth) {
if (this.basicAuth || this.withCredentials) {
options.withCredentials = true;
}
if (this.basicAuth) {
options.headers = {
"Authorization": this.basicAuth
};
@@ -23,6 +23,7 @@ function (angular, _, moment, dateMath) {
this.url = datasource.url;
this.directUrl = datasource.directUrl;
this.basicAuth = datasource.basicAuth;
this.withCredentials = datasource.withCredentials;
this.lastErrors = {};
}
@@ -32,8 +33,10 @@ function (angular, _, moment, dateMath) {
method: method
};
if (this.basicAuth) {
if (this.basicAuth || this.withCredentials) {
options.withCredentials = true;
}
if (this.basicAuth) {
options.headers = {
"Authorization": this.basicAuth
};