patrik-marton commented on code in PR #12846: URL: https://github.com/apache/kafka/pull/12846#discussion_r1039439337
########## connect/basic-auth-extension/src/main/java/org/apache/kafka/connect/rest/basic/auth/extension/JaasBasicAuthFilter.java: ########## @@ -174,4 +153,85 @@ public void handle(Callback[] callbacks) throws UnsupportedCallbackException { )); } } + + private void setSecurityContextForRequest(ContainerRequestContext requestContext, BasicAuthenticationCredential credential) { + requestContext.setSecurityContext(new SecurityContext() { + @Override + public Principal getUserPrincipal() { + return () -> credential.getUsername(); + } + + @Override + public boolean isUserInRole(String role) { + return false; + } + + @Override + public boolean isSecure() { + String scheme = requestContext.getUriInfo().getRequestUri().getScheme(); + return scheme != null && scheme.equalsIgnoreCase("https"); + } + + @Override + public String getAuthenticationScheme() { + return BASIC_AUTH; + } + }); + } + + + public static class BasicAuthenticationCredential { Review Comment: All done. Thanks! -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org