Skip to content

Commit

Permalink
before Security plugin proxied ES error status code. now sets explici…
Browse files Browse the repository at this point in the history
…tly.
  • Loading branch information
mshustov committed Aug 2, 2019
1 parent 6fb0fec commit 2cedbb4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions x-pack/plugins/security/server/authentication/index.ts
Expand Up @@ -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';
Expand Down Expand Up @@ -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()) {
Expand All @@ -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();
Expand Down
Expand Up @@ -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);
});
Expand Down

0 comments on commit 2cedbb4

Please sign in to comment.