From 15164db15cc7afd9166d92cec5e3192346f932f7 Mon Sep 17 00:00:00 2001 From: Yang Wang Date: Wed, 4 May 2022 21:30:36 +1000 Subject: [PATCH] [Test] Replace removed User methods Another refactor leftover. Relates: #86246 Resolves: #86421 --- .../elasticsearch/example/CustomAuthorizationEngine.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/examples/security-authorization-engine/src/main/java/org/elasticsearch/example/CustomAuthorizationEngine.java b/plugins/examples/security-authorization-engine/src/main/java/org/elasticsearch/example/CustomAuthorizationEngine.java index 561729eb00342..bd75722415269 100644 --- a/plugins/examples/security-authorization-engine/src/main/java/org/elasticsearch/example/CustomAuthorizationEngine.java +++ b/plugins/examples/security-authorization-engine/src/main/java/org/elasticsearch/example/CustomAuthorizationEngine.java @@ -47,9 +47,9 @@ public class CustomAuthorizationEngine implements AuthorizationEngine { @Override public void resolveAuthorizationInfo(RequestInfo requestInfo, ActionListener listener) { final Authentication authentication = requestInfo.getAuthentication(); - if (authentication.getUser().isRunAs()) { + if (authentication.isRunAs()) { final CustomAuthorizationInfo authenticatedUserAuthzInfo = - new CustomAuthorizationInfo(authentication.getUser().authenticatedUser().roles(), null); + new CustomAuthorizationInfo(authentication.getAuthenticatingSubject().getUser().roles(), null); listener.onResponse(new CustomAuthorizationInfo(authentication.getUser().roles(), authenticatedUserAuthzInfo)); } else { listener.onResponse(new CustomAuthorizationInfo(authentication.getUser().roles(), null)); @@ -58,7 +58,7 @@ public void resolveAuthorizationInfo(RequestInfo requestInfo, ActionListener listener) { - if (isSuperuser(requestInfo.getAuthentication().getUser().authenticatedUser())) { + if (isSuperuser(requestInfo.getAuthentication().getAuthenticatingSubject().getUser())) { listener.onResponse(AuthorizationResult.granted()); } else { listener.onResponse(AuthorizationResult.deny());