Use basic auth headers for ServiceNow

This commit is contained in:
Christos Nasikas 2024-05-10 18:37:02 +03:00
parent c366163486
commit 4324d931f7
2 changed files with 4 additions and 2 deletions

View file

@ -20,6 +20,7 @@ import type { ResponseError } from './types';
import { connectorTokenClientMock } from '@kbn/actions-plugin/server/lib/connector_token_client.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 { getBasicAuthHeader } from '../get_basic_auth_header';
jest.mock('@kbn/actions-plugin/server/lib/get_oauth_jwt_access_token', () => ({
getOAuthJwtAccessToken: jest.fn(),
@ -189,7 +190,7 @@ describe('utils', () => {
expect(createAxiosInstanceMock).toHaveBeenCalledTimes(1);
expect(createAxiosInstanceMock).toHaveBeenCalledWith({
auth: { password: 'password', username: 'username' },
headers: getBasicAuthHeader({ username: 'username', password: 'password' }),
});
});

View file

@ -22,6 +22,7 @@ import {
} from './types';
import { FIELD_PREFIX } from './config';
import * as i18n from './translations';
import { getBasicAuthHeader } from '../get_basic_auth_header';
export const prepareIncident = (useOldApi: boolean, incident: PartialIncident): PartialIncident =>
useOldApi
@ -115,7 +116,7 @@ export const getAxiosInstance = ({
if (!isOAuth && username && password) {
axiosInstance = axios.create({
auth: { username, password },
headers: getBasicAuthHeader({ username, password }),
});
} else {
axiosInstance = axios.create();