From e12a0bcb34f0cf9bd8158e17f91f7705815c3a00 Mon Sep 17 00:00:00 2001 From: Ioannis Kakavas Date: Fri, 17 Jan 2020 15:50:40 +0200 Subject: [PATCH 1/2] Don't fallback to anonymous for tokens/apikeys (#51042) This commit changes our behavior so that when we receive a request with an invalid/expired/wrong access token or API Key we do not fallback to authenticating as the anonymous user even if anonymous access is enabled for Elasticsearch. --- .../security/authc/AuthenticationService.java | 17 +++++- .../authc/AuthenticationServiceTests.java | 54 +++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/AuthenticationService.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/AuthenticationService.java index 20289c5f09e91..f94e198c0e359 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/AuthenticationService.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/AuthenticationService.java @@ -460,6 +460,7 @@ private List getRealmList(String principal) { *