From 638599f6b1b986e8bf33e37c2da8be6ce8952d9b Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Thu, 22 Feb 2024 11:05:51 -0500 Subject: [PATCH] Back out JwtAuthenticationTests changes Signed-off-by: Craig Perkins --- .../security/http/JwtAuthenticationTests.java | 30 +------------------ 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/src/integrationTest/java/org/opensearch/security/http/JwtAuthenticationTests.java b/src/integrationTest/java/org/opensearch/security/http/JwtAuthenticationTests.java index 5decb3ef5a..659d7c178e 100644 --- a/src/integrationTest/java/org/opensearch/security/http/JwtAuthenticationTests.java +++ b/src/integrationTest/java/org/opensearch/security/http/JwtAuthenticationTests.java @@ -28,13 +28,9 @@ import org.opensearch.action.search.SearchResponse; import org.opensearch.client.Client; import org.opensearch.client.RestHighLevelClient; -import org.opensearch.test.framework.AuditCompliance; -import org.opensearch.test.framework.AuditConfiguration; -import org.opensearch.test.framework.AuditFilters; import org.opensearch.test.framework.JwtConfigBuilder; import org.opensearch.test.framework.TestSecurityConfig; import org.opensearch.test.framework.TestSecurityConfig.Role; -import org.opensearch.test.framework.audit.AuditLogsRule; import org.opensearch.test.framework.cluster.ClusterManager; import org.opensearch.test.framework.cluster.LocalCluster; import org.opensearch.test.framework.cluster.TestRestClient; @@ -108,18 +104,11 @@ public class JwtAuthenticationTests { JWT_AUTH_HEADER ); - @Rule - public AuditLogsRule auditLogsRule = new AuditLogsRule(); - public static final TestSecurityConfig.AuthcDomain JWT_AUTH_DOMAIN = new TestSecurityConfig.AuthcDomain( "jwt", BASIC_AUTH_DOMAIN_ORDER - 1 ).jwtHttpAuthenticator( - new JwtConfigBuilder().jwtHeader(JWT_AUTH_HEADER) - .jwtUrlParameter("token") - .signingKey(PUBLIC_KEY) - .subjectKey(CLAIM_USERNAME) - .rolesKey(CLAIM_ROLES) + new JwtConfigBuilder().jwtHeader(JWT_AUTH_HEADER).signingKey(PUBLIC_KEY).subjectKey(CLAIM_USERNAME).rolesKey(CLAIM_ROLES) ).backend("noop"); public static final String SONG_ID_1 = "song-id-01"; @@ -137,10 +126,6 @@ public class JwtAuthenticationTests { .users(ADMIN_USER) .roles(DEPARTMENT_SONG_LISTENER_ROLE) .authc(JWT_AUTH_DOMAIN) - .audit( - new AuditConfiguration(true).compliance(new AuditCompliance().enabled(true)) - .filters(new AuditFilters().enabledRest(true).enabledTransport(true).resolveBulkRequests(true)) - ) .build(); @Rule @@ -168,19 +153,6 @@ public void shouldAuthenticateWithJwtToken_positive() { } } - @Test - public void shouldAuthenticateWithJwtTokenInUrl_positive() { - Header jwtToken = tokenFactory.generateValidToken(USER_SUPERHERO); - String jwtTokenValue = jwtToken.getValue(); - try (TestRestClient client = cluster.getRestClient()) { - HttpResponse response = client.getAuthInfo(Map.of("token", jwtTokenValue)); - - response.assertStatusCode(200); - String username = response.getTextFromJsonBody(POINTER_USERNAME); - assertThat(username, equalTo(USER_SUPERHERO)); - } - } - @Test public void shouldAuthenticateWithJwtToken_positiveWithAnotherUsername() { try (TestRestClient client = cluster.getRestClient(tokenFactory.generateValidToken(USERNAME_ROOT))) {