From 544a1eafbea591ffe38c29da8f45a4d68d3f1713 Mon Sep 17 00:00:00 2001 From: Ioannis Kakavas Date: Wed, 15 Jan 2020 15:27:56 +0200 Subject: [PATCH] Don't fallback to anonymous for tokens/apikeys 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. Resolves: #50171 --- .../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) { *