28
28
import org .opensearch .action .search .SearchResponse ;
29
29
import org .opensearch .client .Client ;
30
30
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 ;
34
31
import org .opensearch .test .framework .JwtConfigBuilder ;
35
32
import org .opensearch .test .framework .TestSecurityConfig ;
36
33
import org .opensearch .test .framework .TestSecurityConfig .Role ;
37
- import org .opensearch .test .framework .audit .AuditLogsRule ;
38
34
import org .opensearch .test .framework .cluster .ClusterManager ;
39
35
import org .opensearch .test .framework .cluster .LocalCluster ;
40
36
import org .opensearch .test .framework .cluster .TestRestClient ;
@@ -108,18 +104,11 @@ public class JwtAuthenticationTests {
108
104
JWT_AUTH_HEADER
109
105
);
110
106
111
- @ Rule
112
- public AuditLogsRule auditLogsRule = new AuditLogsRule ();
113
-
114
107
public static final TestSecurityConfig .AuthcDomain JWT_AUTH_DOMAIN = new TestSecurityConfig .AuthcDomain (
115
108
"jwt" ,
116
109
BASIC_AUTH_DOMAIN_ORDER - 1
117
110
).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 )
123
112
).backend ("noop" );
124
113
public static final String SONG_ID_1 = "song-id-01" ;
125
114
@@ -137,10 +126,6 @@ public class JwtAuthenticationTests {
137
126
.users (ADMIN_USER )
138
127
.roles (DEPARTMENT_SONG_LISTENER_ROLE )
139
128
.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
- )
144
129
.build ();
145
130
146
131
@ Rule
@@ -168,19 +153,6 @@ public void shouldAuthenticateWithJwtToken_positive() {
168
153
}
169
154
}
170
155
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
-
184
156
@ Test
185
157
public void shouldAuthenticateWithJwtToken_positiveWithAnotherUsername () {
186
158
try (TestRestClient client = cluster .getRestClient (tokenFactory .generateValidToken (USERNAME_ROOT ))) {
0 commit comments