Skip to content

Commit 3dd666f

Browse files
rename tryAuthenticate to authenticateHeaders
1 parent b7b8aa7 commit 3dd666f

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/core/security/transport/netty4/SecurityNetty4Transport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ protected void headerReceived(Header header) {
180180
channel.config().setAutoRead(false);
181181
// this prevents thread-context changes to propagate beyond the validation, as netty worker threads are reused
182182
try (ThreadContext.StoredContext ignore = threadPool.getThreadContext().newStoredContext()) {
183-
remoteClusterAuthenticationService.tryAuthenticate(
183+
remoteClusterAuthenticationService.authenticateHeaders(
184184
header.getRequestHeaders(),
185185
ActionListener.runAfter(ActionListener.wrap(aVoid -> {
186186
// authn is successful -> NOOP (the complete request will be subsequently authn & authz & audited)

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/CrossClusterAccessAuthenticationService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public void authenticate(final String action, final TransportRequest request, fi
119119
}
120120

121121
@Override
122-
public void tryAuthenticate(Map<String, String> headers, ActionListener<Void> listener) {
122+
public void authenticateHeaders(Map<String, String> headers, ActionListener<Void> listener) {
123123
final ApiKeyService.ApiKeyCredentials credentials;
124124
try {
125125
credentials = extractApiKeyCredentialsFromHeaders(headers);

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/RemoteClusterAuthenticationService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ public interface RemoteClusterAuthenticationService {
4242
* @param listener callback to receive {@code null} on successful authentication,
4343
* or an exception on authentication failure
4444
*/
45-
void tryAuthenticate(Map<String, String> headers, ActionListener<Void> listener);
45+
void authenticateHeaders(Map<String, String> headers, ActionListener<Void> listener);
4646

4747
}

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/CrossClusterAccessAuthenticationServiceIntegTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public void testInvalidHeaders() throws IOException {
142142
}
143143
}
144144

145-
public void testTryAuthenticateSuccess() throws IOException {
145+
public void testAuthenticateHeadersSuccess() throws IOException {
146146
final String encodedCrossClusterAccessApiKey = getEncodedCrossClusterAccessApiKey();
147147
final String nodeName = internalCluster().getRandomNodeName();
148148
final ThreadContext threadContext = internalCluster().getInstance(SecurityContext.class, nodeName).getThreadContext();
@@ -209,7 +209,7 @@ public void testGetApiKeyCredentialsFromHeaders() {
209209

210210
}
211211

212-
public void testTryAuthenticateFailure() throws IOException {
212+
public void testAuthenticateHeadersFailure() throws IOException {
213213
final EncodedKeyWithId encodedCrossClusterAccessApiKeyWithId = getEncodedCrossClusterAccessApiKeyWithId();
214214
final EncodedKeyWithId encodedRestApiKeyWithId = getEncodedRestApiKeyWithId();
215215
final String nodeName = internalCluster().getRandomNodeName();

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/CrossClusterAccessAuthenticationServiceTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public void testNoInteractionWithAuditableRequestOnInitialAuthenticationFailure(
193193
verifyNoInteractions(auditableRequest);
194194
}
195195

196-
public void testTerminateExceptionBubblesUpWithTryAuthenticate() {
196+
public void testTerminateExceptionBubblesUpWithAuthenticateHeaders() {
197197
@SuppressWarnings("unchecked")
198198
final ArgumentCaptor<ActionListener<AuthenticationResult<User>>> listenerCaptor = ArgumentCaptor.forClass(ActionListener.class);
199199
doAnswer(i -> null).when(apiKeyService)

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4ServerTransportAuthenticationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void setUp() throws Exception {
115115
((ActionListener<Void>) invocation.getArguments()[1]).onResponse(null);
116116
}
117117
return null;
118-
}).when(remoteCrossClusterAccessAuthenticationService).tryAuthenticate(any(Map.class), anyActionListener());
118+
}).when(remoteCrossClusterAccessAuthenticationService).authenticateHeaders(any(Map.class), anyActionListener());
119119
remoteSecurityNetty4ServerTransport = new SecurityNetty4ServerTransport(
120120
remoteSettings,
121121
TransportVersion.current(),

0 commit comments

Comments
 (0)