Skip to content

Commit 638599f

Browse files
committed
Back out JwtAuthenticationTests changes
Signed-off-by: Craig Perkins <cwperx@amazon.com>
1 parent 1939a03 commit 638599f

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

src/integrationTest/java/org/opensearch/security/http/JwtAuthenticationTests.java

+1-29
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,9 @@
2828
import org.opensearch.action.search.SearchResponse;
2929
import org.opensearch.client.Client;
3030
import org.opensearch.client.RestHighLevelClient;
31-
import org.opensearch.test.framework.AuditCompliance;
32-
import org.opensearch.test.framework.AuditConfiguration;
33-
import org.opensearch.test.framework.AuditFilters;
3431
import org.opensearch.test.framework.JwtConfigBuilder;
3532
import org.opensearch.test.framework.TestSecurityConfig;
3633
import org.opensearch.test.framework.TestSecurityConfig.Role;
37-
import org.opensearch.test.framework.audit.AuditLogsRule;
3834
import org.opensearch.test.framework.cluster.ClusterManager;
3935
import org.opensearch.test.framework.cluster.LocalCluster;
4036
import org.opensearch.test.framework.cluster.TestRestClient;
@@ -108,18 +104,11 @@ public class JwtAuthenticationTests {
108104
JWT_AUTH_HEADER
109105
);
110106

111-
@Rule
112-
public AuditLogsRule auditLogsRule = new AuditLogsRule();
113-
114107
public static final TestSecurityConfig.AuthcDomain JWT_AUTH_DOMAIN = new TestSecurityConfig.AuthcDomain(
115108
"jwt",
116109
BASIC_AUTH_DOMAIN_ORDER - 1
117110
).jwtHttpAuthenticator(
118-
new JwtConfigBuilder().jwtHeader(JWT_AUTH_HEADER)
119-
.jwtUrlParameter("token")
120-
.signingKey(PUBLIC_KEY)
121-
.subjectKey(CLAIM_USERNAME)
122-
.rolesKey(CLAIM_ROLES)
111+
new JwtConfigBuilder().jwtHeader(JWT_AUTH_HEADER).signingKey(PUBLIC_KEY).subjectKey(CLAIM_USERNAME).rolesKey(CLAIM_ROLES)
123112
).backend("noop");
124113
public static final String SONG_ID_1 = "song-id-01";
125114

@@ -137,10 +126,6 @@ public class JwtAuthenticationTests {
137126
.users(ADMIN_USER)
138127
.roles(DEPARTMENT_SONG_LISTENER_ROLE)
139128
.authc(JWT_AUTH_DOMAIN)
140-
.audit(
141-
new AuditConfiguration(true).compliance(new AuditCompliance().enabled(true))
142-
.filters(new AuditFilters().enabledRest(true).enabledTransport(true).resolveBulkRequests(true))
143-
)
144129
.build();
145130

146131
@Rule
@@ -168,19 +153,6 @@ public void shouldAuthenticateWithJwtToken_positive() {
168153
}
169154
}
170155

171-
@Test
172-
public void shouldAuthenticateWithJwtTokenInUrl_positive() {
173-
Header jwtToken = tokenFactory.generateValidToken(USER_SUPERHERO);
174-
String jwtTokenValue = jwtToken.getValue();
175-
try (TestRestClient client = cluster.getRestClient()) {
176-
HttpResponse response = client.getAuthInfo(Map.of("token", jwtTokenValue));
177-
178-
response.assertStatusCode(200);
179-
String username = response.getTextFromJsonBody(POINTER_USERNAME);
180-
assertThat(username, equalTo(USER_SUPERHERO));
181-
}
182-
}
183-
184156
@Test
185157
public void shouldAuthenticateWithJwtToken_positiveWithAnotherUsername() {
186158
try (TestRestClient client = cluster.getRestClient(tokenFactory.generateValidToken(USERNAME_ROOT))) {

0 commit comments

Comments
 (0)