Skip to content

Commit 201fcad

Browse files
delegate last call to remoteClusterCredentialsResolver and remove it
1 parent 9a21578 commit 201fcad

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/transport/SecurityServerTransportInterceptor.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ public class SecurityServerTransportInterceptor implements TransportInterceptor
6464
private final Settings settings;
6565
private final SecurityContext securityContext;
6666
private final CrossClusterAccessAuthenticationService crossClusterAccessAuthcService;
67-
private final Function<Transport.Connection, Optional<RemoteClusterAliasWithCredentials>> remoteClusterCredentialsResolver;
6867
private final XPackLicenseState licenseState;
6968

7069
public SecurityServerTransportInterceptor(
@@ -113,7 +112,6 @@ public SecurityServerTransportInterceptor(
113112
this.securityContext = securityContext;
114113
this.crossClusterAccessAuthcService = crossClusterAccessAuthcService;
115114
this.licenseState = licenseState;
116-
this.remoteClusterCredentialsResolver = remoteClusterCredentialsResolver;
117115
this.remoteClusterTransportInterceptor = new CrossClusterAccessTransportInterceptor(
118116
crossClusterAccessAuthcService,
119117
authcService,
@@ -255,7 +253,8 @@ private <T extends TransportResponse> void sendWithUser(
255253
throw new IllegalStateException("there should always be a user when sending a message for action [" + action + "]");
256254
}
257255

258-
assert securityContext.getParentAuthorization() == null || remoteClusterCredentialsResolver.apply(connection).isEmpty()
256+
assert securityContext.getParentAuthorization() == null
257+
|| false == remoteClusterTransportInterceptor.isRemoteClusterConnection(connection)
259258
: "parent authorization header should not be set for remote cluster requests";
260259

261260
try {

0 commit comments

Comments
 (0)