C0urante commented on code in PR #11779:
URL: https://github.com/apache/kafka/pull/11779#discussion_r892555147


##########
connect/basic-auth-extension/src/test/java/org/apache/kafka/connect/rest/basic/auth/extension/JaasBasicAuthFilterTest.java:
##########
@@ -139,17 +141,26 @@ public void testNoFileOption() throws IOException {
         jaasBasicAuthFilter.filter(requestContext);
 
         verify(requestContext).abortWith(any(Response.class));
-        verify(requestContext).getMethod();
+        verify(requestContext, atLeastOnce()).getMethod();
         
verify(requestContext).getHeaderString(JaasBasicAuthFilter.AUTHORIZATION);
     }
 
     @Test
-    public void testPostWithoutAppropriateCredential() throws IOException {
+    public void testInternalTaskConfigEndpointSkipped() throws IOException {
+        testInternalEndpointSkipped("connectors/connName/tasks", 
HttpMethod.POST);
+    }
+
+    @Test
+    public void testInternalZombieFencingEndpointSkipped() throws IOException {
+        testInternalEndpointSkipped("connectors/connName/fence", 
HttpMethod.PUT);
+    }
+
+    private void testInternalEndpointSkipped(String endpoint, String method) 
throws IOException {

Review Comment:
   👍 done



##########
connect/basic-auth-extension/src/main/java/org/apache/kafka/connect/rest/basic/auth/extension/JaasBasicAuthFilter.java:
##########
@@ -45,21 +49,40 @@
 public class JaasBasicAuthFilter implements ContainerRequestFilter {
 
     private static final Logger log = 
LoggerFactory.getLogger(JaasBasicAuthFilter.class);
-    private static final Pattern TASK_REQUEST_PATTERN = 
Pattern.compile("/?connectors/([^/]+)/tasks/?");
+    private static final Set<RequestMatcher> INTERNAL_REQUEST_MATCHERS = new 
HashSet<>(Arrays.asList(
+            new RequestMatcher("/?connectors/([^/]+)/tasks/?", 
HttpMethod.POST),
+            new RequestMatcher("/?connectors/[^/]+/fence/?", HttpMethod.PUT)
+    ));
     private static final String CONNECT_LOGIN_MODULE = "KafkaConnect";
 
     static final String AUTHORIZATION = "Authorization";
 
     // Package-private for testing
     final Configuration configuration;
 
+    private static class RequestMatcher implements 
Predicate<ContainerRequestContext> {
+        private final Pattern path;
+        private final String method;
+
+        public RequestMatcher(String path, String method) {

Review Comment:
   👍 done



-- 
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]

Reply via email to