Enable "With Credentials" for InfluxDB datasource (#6018)

This commit is contained in:
Jouni Kuusisto 2016-09-13 09:57:39 +03:00 committed by Torkel Ödegaard
parent 52dc2db769
commit e53b815956

View File

@ -16,6 +16,7 @@ export default class InfluxDatasource {
name: string;
database: any;
basicAuth: any;
withCredentials: any;
interval: any;
supportAnnotations: boolean;
supportMetrics: boolean;
@ -33,6 +34,7 @@ export default class InfluxDatasource {
this.name = instanceSettings.name;
this.database = instanceSettings.database;
this.basicAuth = instanceSettings.basicAuth;
this.withCredentials = instanceSettings.withCredentials;
this.interval = (instanceSettings.jsonData || {}).timeInterval;
this.supportAnnotations = true;
this.supportMetrics = true;
@ -187,6 +189,9 @@ export default class InfluxDatasource {
};
options.headers = options.headers || {};
if (this.basicAuth || this.withCredentials) {
options.withCredentials = true;
}
if (self.basicAuth) {
options.headers.Authorization = self.basicAuth;
}