mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Use basic auth headers for ServiceNow
This commit is contained in:
parent
c366163486
commit
4324d931f7
2 changed files with 4 additions and 2 deletions
|
@ -20,6 +20,7 @@ import type { ResponseError } from './types';
|
||||||
import { connectorTokenClientMock } from '@kbn/actions-plugin/server/lib/connector_token_client.mock';
|
import { connectorTokenClientMock } from '@kbn/actions-plugin/server/lib/connector_token_client.mock';
|
||||||
import { actionsConfigMock } from '@kbn/actions-plugin/server/actions_config.mock';
|
import { actionsConfigMock } from '@kbn/actions-plugin/server/actions_config.mock';
|
||||||
import { getOAuthJwtAccessToken } from '@kbn/actions-plugin/server/lib/get_oauth_jwt_access_token';
|
import { getOAuthJwtAccessToken } from '@kbn/actions-plugin/server/lib/get_oauth_jwt_access_token';
|
||||||
|
import { getBasicAuthHeader } from '../get_basic_auth_header';
|
||||||
|
|
||||||
jest.mock('@kbn/actions-plugin/server/lib/get_oauth_jwt_access_token', () => ({
|
jest.mock('@kbn/actions-plugin/server/lib/get_oauth_jwt_access_token', () => ({
|
||||||
getOAuthJwtAccessToken: jest.fn(),
|
getOAuthJwtAccessToken: jest.fn(),
|
||||||
|
@ -189,7 +190,7 @@ describe('utils', () => {
|
||||||
|
|
||||||
expect(createAxiosInstanceMock).toHaveBeenCalledTimes(1);
|
expect(createAxiosInstanceMock).toHaveBeenCalledTimes(1);
|
||||||
expect(createAxiosInstanceMock).toHaveBeenCalledWith({
|
expect(createAxiosInstanceMock).toHaveBeenCalledWith({
|
||||||
auth: { password: 'password', username: 'username' },
|
headers: getBasicAuthHeader({ username: 'username', password: 'password' }),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import {
|
||||||
} from './types';
|
} from './types';
|
||||||
import { FIELD_PREFIX } from './config';
|
import { FIELD_PREFIX } from './config';
|
||||||
import * as i18n from './translations';
|
import * as i18n from './translations';
|
||||||
|
import { getBasicAuthHeader } from '../get_basic_auth_header';
|
||||||
|
|
||||||
export const prepareIncident = (useOldApi: boolean, incident: PartialIncident): PartialIncident =>
|
export const prepareIncident = (useOldApi: boolean, incident: PartialIncident): PartialIncident =>
|
||||||
useOldApi
|
useOldApi
|
||||||
|
@ -115,7 +116,7 @@ export const getAxiosInstance = ({
|
||||||
|
|
||||||
if (!isOAuth && username && password) {
|
if (!isOAuth && username && password) {
|
||||||
axiosInstance = axios.create({
|
axiosInstance = axios.create({
|
||||||
auth: { username, password },
|
headers: getBasicAuthHeader({ username, password }),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
axiosInstance = axios.create();
|
axiosInstance = axios.create();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue