From 2cedbb496074ce3e491c218c01ab3bb9704e81f5 Mon Sep 17 00:00:00 2001 From: Mikhail Shustov Date: Fri, 2 Aug 2019 12:35:37 +0200 Subject: [PATCH] before Security plugin proxied ES error status code. now sets explicitly. --- x-pack/plugins/security/server/authentication/index.ts | 5 ++--- .../kerberos_api_integration/apis/security/kerberos_login.ts | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/security/server/authentication/index.ts b/x-pack/plugins/security/server/authentication/index.ts index ffca1d78e64c362..2354d89a75aa0a1 100644 --- a/x-pack/plugins/security/server/authentication/index.ts +++ b/x-pack/plugins/security/server/authentication/index.ts @@ -13,7 +13,7 @@ import { } from '../../../../../src/core/server'; import { AuthenticatedUser } from '../../common/model'; import { ConfigType } from '../config'; -import { getErrorStatusCode, wrapError } from '../errors'; +import { getErrorStatusCode } from '../errors'; import { Authenticator, ProviderSession } from './authenticator'; import { LegacyAPI } from '../plugin'; import { createAPIKey, CreateAPIKeyOptions } from './api_keys'; @@ -88,7 +88,7 @@ export async function setupAuthentication({ authenticationResult = await authenticator.authenticate(request); } catch (err) { authLogger.error(err); - return response.internalError(wrapError(err)); + return response.internalError(err); } if (authenticationResult.succeeded()) { @@ -115,7 +115,6 @@ export async function setupAuthentication({ let error; if (authenticationResult.failed()) { authLogger.info(`Authentication attempt failed: ${authenticationResult.error!.message}`); - error = wrapError(authenticationResult.error); } else { authLogger.info('Could not handle authentication attempt'); error = Boom.unauthorized(); diff --git a/x-pack/test/kerberos_api_integration/apis/security/kerberos_login.ts b/x-pack/test/kerberos_api_integration/apis/security/kerberos_login.ts index a05c51b85e4f162..68dc1cf58e927fd 100644 --- a/x-pack/test/kerberos_api_integration/apis/security/kerberos_login.ts +++ b/x-pack/test/kerberos_api_integration/apis/security/kerberos_login.ts @@ -146,7 +146,7 @@ export default function({ getService }: KibanaFunctionalTestDefaultProviders) { const spnegoResponse = await supertest .get('/api/security/v1/me') .set('Authorization', 'Negotiate (:I am malformed:)') - .expect(500); + .expect(401); expect(spnegoResponse.headers['set-cookie']).to.be(undefined); expect(spnegoResponse.headers['www-authenticate']).to.be(undefined); });