patrik-marton commented on code in PR #12846:
URL: https://github.com/apache/kafka/pull/12846#discussion_r1039441425
##########
connect/basic-auth-extension/src/test/java/org/apache/kafka/connect/rest/basic/auth/extension/JaasBasicAuthFilterTest.java:
##########
@@ -211,6 +214,18 @@ public void testUnsupportedCallback() {
assertThrows(ConnectException.class, () -> callbackHandler.handle(new
Callback[] {unsupportedCallback}));
}
+ @Test
+ public void testSecurityContextSet() throws IOException {
+ File credentialFile = setupPropertyLoginFile(true);
+ JaasBasicAuthFilter jaasBasicAuthFilter =
setupJaasFilter("KafkaConnect", credentialFile.getPath());
+ ContainerRequestContext requestContext = setMock("Basic", "user1",
"password1");
+ jaasBasicAuthFilter.filter(requestContext);
+
+ ArgumentCaptor<SecurityContext> argument =
ArgumentCaptor.forClass(SecurityContext.class);
+ verify(requestContext).setSecurityContext(argument.capture());
+ assertEquals("user1",
argument.getValue().getUserPrincipal().getName());
Review Comment:
Added coverage for the `isSecure` method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]