-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Refactor remote cluster interceptor and tests #135747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
elasticsearchmachine
merged 15 commits into
elastic:main
from
slobodanadamovic:security-transport-refactoring
Oct 6, 2025
+1,347
−1,020
Merged
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e2d1125
Refactor transport filters and remote cluster interceptor
slobodanadamovic ac52102
extend common test class
slobodanadamovic d03c4e8
Merge branch 'main' into security-transport-refactoring
slobodanadamovic 6c9c7b2
test getRemoteProfileTransportFilter
slobodanadamovic 8582ae5
drop unused authcService
slobodanadamovic 478bf6e
rollback introduction of ServerTransportFilter interface
slobodanadamovic 443db48
drop `profileName` parameter
slobodanadamovic f60851e
Merge branch 'main' into security-transport-refactoring
slobodanadamovic 38053c0
drop the assertion
slobodanadamovic 46f0119
Merge branch 'main' into security-transport-refactoring
slobodanadamovic 755b480
Merge branch 'main' into security-transport-refactoring
slobodanadamovic 0f519bb
remove old tests #135942
slobodanadamovic e0e01cb
Merge branch 'main' of github.com:elastic/elasticsearch into security…
slobodanadamovic cda64b2
spotless
slobodanadamovic f1b255d
Merge branch 'main' into security-transport-refactoring
slobodanadamovic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...t/java/org/elasticsearch/xpack/security/transport/AbstractServerTransportFilterTests.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.security.transport; | ||
|
||
import org.elasticsearch.action.ActionListener; | ||
import org.elasticsearch.test.ESTestCase; | ||
import org.elasticsearch.xpack.core.security.authc.Authentication; | ||
import org.mockito.stubbing.Answer; | ||
|
||
import static org.hamcrest.Matchers.arrayWithSize; | ||
|
||
public abstract class AbstractServerTransportFilterTests extends ESTestCase { | ||
|
||
protected static Answer<Class<Void>> getAnswer(Authentication authentication) { | ||
return getAnswer(authentication, false); | ||
} | ||
|
||
protected static Answer<Class<Void>> getAnswer(Authentication authentication, boolean crossClusterAccess) { | ||
return i -> { | ||
final Object[] args = i.getArguments(); | ||
assertThat(args, arrayWithSize(crossClusterAccess ? 3 : 4)); | ||
@SuppressWarnings("unchecked") | ||
ActionListener<Authentication> callback = (ActionListener<Authentication>) args[args.length - 1]; | ||
callback.onResponse(authentication); | ||
return Void.TYPE; | ||
}; | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning
Optional<ServerTransportFilter>
is more of a preference here. We could as well returnServerTransportFilter
and annotate the method as@Nullable