@@ -205,16 +205,21 @@ public void testSendAsyncSwitchToSystem() throws Exception {
205205 SecurityServerTransportInterceptor interceptor = new SecurityServerTransportInterceptor (
206206 settings ,
207207 threadPool ,
208- mock (AuthenticationService .class ),
209- mock (AuthorizationService .class ),
210208 mockSslService (),
211209 securityContext ,
212210 new DestructiveOperations (
213211 Settings .EMPTY ,
214212 new ClusterSettings (Settings .EMPTY , Collections .singleton (DestructiveOperations .REQUIRES_NAME_SETTING ))
215213 ),
216- mock (CrossClusterAccessAuthenticationService .class ),
217- mockLicenseState
214+ new CrossClusterAccessTransportInterceptor (
215+ mock (CrossClusterAccessAuthenticationService .class ),
216+ mock (AuthenticationService .class ),
217+ mock (AuthorizationService .class ),
218+ mockLicenseState ,
219+ securityContext ,
220+ threadPool ,
221+ settings
222+ )
218223 );
219224 ClusterServiceUtils .setState (clusterService , clusterService .state ()); // force state update to trigger listener
220225
@@ -249,16 +254,21 @@ public void testSendWithoutUser() throws Exception {
249254 SecurityServerTransportInterceptor interceptor = new SecurityServerTransportInterceptor (
250255 settings ,
251256 threadPool ,
252- mock (AuthenticationService .class ),
253- mock (AuthorizationService .class ),
254257 mockSslService (),
255258 securityContext ,
256259 new DestructiveOperations (
257260 Settings .EMPTY ,
258261 new ClusterSettings (Settings .EMPTY , Collections .singleton (DestructiveOperations .REQUIRES_NAME_SETTING ))
259262 ),
260- mock (CrossClusterAccessAuthenticationService .class ),
261- mockLicenseState
263+ new CrossClusterAccessTransportInterceptor (
264+ mock (CrossClusterAccessAuthenticationService .class ),
265+ mock (AuthenticationService .class ),
266+ mock (AuthorizationService .class ),
267+ mockLicenseState ,
268+ securityContext ,
269+ threadPool ,
270+ settings
271+ )
262272 ) {
263273 @ Override
264274 void assertNoAuthentication (String action ) {}
@@ -311,16 +321,21 @@ public void testSendToNewerVersionSetsCorrectVersion() throws Exception {
311321 SecurityServerTransportInterceptor interceptor = new SecurityServerTransportInterceptor (
312322 settings ,
313323 threadPool ,
314- mock (AuthenticationService .class ),
315- mock (AuthorizationService .class ),
316324 mockSslService (),
317325 securityContext ,
318326 new DestructiveOperations (
319327 Settings .EMPTY ,
320328 new ClusterSettings (Settings .EMPTY , Collections .singleton (DestructiveOperations .REQUIRES_NAME_SETTING ))
321329 ),
322- mock (CrossClusterAccessAuthenticationService .class ),
323- mockLicenseState
330+ new CrossClusterAccessTransportInterceptor (
331+ mock (CrossClusterAccessAuthenticationService .class ),
332+ mock (AuthenticationService .class ),
333+ mock (AuthorizationService .class ),
334+ mockLicenseState ,
335+ securityContext ,
336+ threadPool ,
337+ settings
338+ )
324339 );
325340 ClusterServiceUtils .setState (clusterService , clusterService .state ()); // force state update to trigger listener
326341
@@ -379,16 +394,21 @@ public void testSendToOlderVersionSetsCorrectVersion() throws Exception {
379394 SecurityServerTransportInterceptor interceptor = new SecurityServerTransportInterceptor (
380395 settings ,
381396 threadPool ,
382- mock (AuthenticationService .class ),
383- mock (AuthorizationService .class ),
384397 mockSslService (),
385398 securityContext ,
386399 new DestructiveOperations (
387400 Settings .EMPTY ,
388401 new ClusterSettings (Settings .EMPTY , Collections .singleton (DestructiveOperations .REQUIRES_NAME_SETTING ))
389402 ),
390- mock (CrossClusterAccessAuthenticationService .class ),
391- mockLicenseState
403+ new CrossClusterAccessTransportInterceptor (
404+ mock (CrossClusterAccessAuthenticationService .class ),
405+ mock (AuthenticationService .class ),
406+ mock (AuthorizationService .class ),
407+ mockLicenseState ,
408+ securityContext ,
409+ threadPool ,
410+ settings
411+ )
392412 );
393413 ClusterServiceUtils .setState (clusterService , clusterService .state ()); // force state update to trigger listener
394414
@@ -445,16 +465,21 @@ public void testSetUserBasedOnActionOrigin() {
445465 SecurityServerTransportInterceptor interceptor = new SecurityServerTransportInterceptor (
446466 settings ,
447467 threadPool ,
448- mock (AuthenticationService .class ),
449- mock (AuthorizationService .class ),
450468 mockSslService (),
451469 securityContext ,
452470 new DestructiveOperations (
453471 Settings .EMPTY ,
454472 new ClusterSettings (Settings .EMPTY , Collections .singleton (DestructiveOperations .REQUIRES_NAME_SETTING ))
455473 ),
456- mock (CrossClusterAccessAuthenticationService .class ),
457- mockLicenseState
474+ new CrossClusterAccessTransportInterceptor (
475+ mock (CrossClusterAccessAuthenticationService .class ),
476+ mock (AuthenticationService .class ),
477+ mock (AuthorizationService .class ),
478+ mockLicenseState ,
479+ securityContext ,
480+ threadPool ,
481+ settings
482+ )
458483 );
459484
460485 final AtomicBoolean calledWrappedSender = new AtomicBoolean (false );
@@ -1155,16 +1180,21 @@ public void testProfileFiltersCreatedDifferentlyForDifferentTransportAndRemoteCl
11551180 final var securityServerTransportInterceptor = new SecurityServerTransportInterceptor (
11561181 builder .build (),
11571182 threadPool ,
1158- mock (AuthenticationService .class ),
1159- mock (AuthorizationService .class ),
11601183 sslService ,
11611184 securityContext ,
11621185 new DestructiveOperations (
11631186 Settings .EMPTY ,
11641187 new ClusterSettings (Settings .EMPTY , Collections .singleton (DestructiveOperations .REQUIRES_NAME_SETTING ))
11651188 ),
1166- mock (CrossClusterAccessAuthenticationService .class ),
1167- mockLicenseState
1189+ new CrossClusterAccessTransportInterceptor (
1190+ mock (CrossClusterAccessAuthenticationService .class ),
1191+ mock (AuthenticationService .class ),
1192+ mock (AuthorizationService .class ),
1193+ mockLicenseState ,
1194+ securityContext ,
1195+ threadPool ,
1196+ builder .build ()
1197+ )
11681198 );
11691199
11701200 final Map <String , ServerTransportFilter > profileFilters = securityServerTransportInterceptor .getProfileFilters ();
@@ -1213,16 +1243,21 @@ public void testNoProfileFilterForRemoteClusterWhenTheFeatureIsDisabled() {
12131243 final var securityServerTransportInterceptor = new SecurityServerTransportInterceptor (
12141244 builder .build (),
12151245 threadPool ,
1216- mock (AuthenticationService .class ),
1217- mock (AuthorizationService .class ),
12181246 sslService ,
12191247 securityContext ,
12201248 new DestructiveOperations (
12211249 Settings .EMPTY ,
12221250 new ClusterSettings (Settings .EMPTY , Collections .singleton (DestructiveOperations .REQUIRES_NAME_SETTING ))
12231251 ),
1224- mock (CrossClusterAccessAuthenticationService .class ),
1225- mockLicenseState
1252+ new CrossClusterAccessTransportInterceptor (
1253+ mock (CrossClusterAccessAuthenticationService .class ),
1254+ mock (AuthenticationService .class ),
1255+ mock (AuthorizationService .class ),
1256+ mockLicenseState ,
1257+ securityContext ,
1258+ threadPool ,
1259+ builder .build ()
1260+ )
12261261 );
12271262
12281263 final Map <String , ServerTransportFilter > profileFilters = securityServerTransportInterceptor .getProfileFilters ();
0 commit comments