Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-12359: Update Jetty to 11 #10176

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 31 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ allprojects {

ext {
gradleVersion = versions.gradle
minJavaVersion = "8"
minJavaVersion = "11"
buildVersionFileName = "kafka-version.properties"

defaultMaxHeapSize = "2g"
Expand Down Expand Up @@ -1525,11 +1525,20 @@ project(':trogdor') {
implementation libs.jacksonJaxrsJsonProvider
implementation libs.jerseyContainerServlet
implementation libs.jerseyHk2
implementation libs.jerseyMediaJsonJackson
implementation libs.jaxbApi // Jersey dependency that was available in the JDK before Java 9
implementation libs.activation // Jersey dependency that was available in the JDK before Java 9
implementation libs.jettyServer
implementation libs.jettyServlet
implementation libs.jettyServlets
implementation (libs.jettyServer) {
exclude group: 'org.slf4j', module: 'slf4j-api'
}
implementation (libs.jettyServlet) {
exclude group: 'org.slf4j', module: 'slf4j-api'
}
implementation (libs.jettyServlets) {
exclude group: 'org.slf4j', module: 'slf4j-api'
}
implementation libs.jakartaServletApi
implementation libs.jsr311Api

testImplementation project(':clients')
testImplementation libs.junitJupiter
Expand Down Expand Up @@ -2120,7 +2129,7 @@ project(':connect:api') {
dependencies {
api project(':clients')
implementation libs.slf4jApi
implementation libs.jaxrsApi
implementation libs.jakartaRsApi

testImplementation libs.junitJupiter
testRuntimeOnly libs.slf4jlog4j
Expand Down Expand Up @@ -2245,12 +2254,23 @@ project(':connect:runtime') {
implementation libs.jacksonJaxrsJsonProvider
implementation libs.jerseyContainerServlet
implementation libs.jerseyHk2
implementation libs.jerseyMediaJsonJackson
implementation libs.jaxbApi // Jersey dependency that was available in the JDK before Java 9
implementation libs.activation // Jersey dependency that was available in the JDK before Java 9
implementation libs.jettyServer
implementation libs.jettyServlet
implementation libs.jettyServlets
implementation libs.jettyClient
implementation (libs.jettyServer) {
exclude group: 'org.slf4j', module: 'slf4j-api'
}
implementation (libs.jettyServlet) {
exclude group: 'org.slf4j', module: 'slf4j-api'
}
implementation (libs.jettyServlets) {
exclude group: 'org.slf4j', module: 'slf4j-api'
}
implementation (libs.jettyClient) {
exclude group: 'org.slf4j', module: 'slf4j-api'
}
implementation libs.jakartaServletApi
implementation libs.jsr311Api
implementation libs.reflections
implementation libs.mavenArtifact

Expand Down Expand Up @@ -2377,7 +2397,7 @@ project(':connect:basic-auth-extension') {
dependencies {
implementation project(':connect:api')
implementation libs.slf4jApi
implementation libs.jaxrsApi
implementation libs.jakartaRsApi

testImplementation libs.bcpkix
testImplementation libs.easymock
Expand Down Expand Up @@ -2504,10 +2524,5 @@ task aggregatedJavadoc(type: Javadoc, dependsOn: compileJava) {
options.encoding = 'UTF-8'
// Turn off doclint for now, see https://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html for rationale
options.addStringOption('Xdoclint:none', '-quiet')

// The URL structure was changed to include the locale after Java 8
if (JavaVersion.current().isJava11Compatible())
options.links "https://docs.oracle.com/en/java/javase/${JavaVersion.current().majorVersion}/docs/api/"
else
options.links "https://docs.oracle.com/javase/8/docs/api/"
options.links "https://docs.oracle.com/en/java/javase/${JavaVersion.current().majorVersion}/docs/api/"
}
16 changes: 8 additions & 8 deletions checkstyle/import-control.xml
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@

<subpackage name="trogdor">
<allow pkg="com.fasterxml.jackson" />
<allow pkg="javax.servlet" />
<allow pkg="javax.ws.rs" />
<allow pkg="jakarta.servlet" />
<allow pkg="jakarta.ws.rs" />
<allow pkg="net.sourceforge.argparse4j" />
<allow pkg="org.apache.kafka.clients" />
<allow pkg="org.apache.kafka.clients.admin" />
Expand Down Expand Up @@ -451,7 +451,7 @@

<subpackage name="rest">
<allow pkg="org.apache.kafka.connect.health" />
<allow pkg="javax.ws.rs" />
<allow pkg="jakarta.ws.rs" />
<allow pkg= "javax.security.auth"/>
<subpackage name="basic">
<allow pkg="org.apache.kafka.connect.rest"/>
Expand Down Expand Up @@ -484,8 +484,8 @@

<subpackage name="rest">
<allow pkg="org.eclipse.jetty" />
<allow pkg="javax.ws.rs" />
<allow pkg="javax.servlet" />
<allow pkg="jakarta.ws.rs" />
<allow pkg="jakarta.servlet" />
<allow pkg="org.glassfish.jersey" />
<allow pkg="com.fasterxml.jackson" />
<allow pkg="org.apache.http"/>
Expand All @@ -501,7 +501,7 @@
</subpackage>

<subpackage name="distributed">
<allow pkg="javax.ws.rs.core" />
<allow pkg="jakarta.ws.rs.core" />
</subpackage>
</subpackage>

Expand Down Expand Up @@ -530,7 +530,7 @@
<allow pkg="kafka.zk" />
<allow pkg="kafka.utils" />
<allow class="javax.servlet.http.HttpServletResponse" />
<allow class="javax.ws.rs.core.Response" />
<allow class="jakarta.ws.rs.core.Response" />
<allow pkg="com.fasterxml.jackson.core.type" />
<allow pkg="org.apache.kafka.metadata" />
</subpackage>
Expand All @@ -540,7 +540,7 @@
<allow pkg="org.apache.kafka.connect.util.clusters" />
<allow pkg="org.apache.kafka.connect" />
<allow pkg="org.apache.kafka.tools" />
<allow pkg="javax.ws.rs" />
<allow pkg="jakarta.ws.rs" />
</subpackage>

<subpackage name="json">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class OAuthBearerSaslClientProvider extends Provider {
private static final long serialVersionUID = 1L;

protected OAuthBearerSaslClientProvider() {
super("SASL/OAUTHBEARER Client Provider", 1.0, "SASL/OAUTHBEARER Client Provider for Kafka");
super("SASL/OAUTHBEARER Client Provider", "1.0", "SASL/OAUTHBEARER Client Provider for Kafka");
put("SaslClientFactory." + OAuthBearerLoginModule.OAUTHBEARER_MECHANISM,
OAuthBearerSaslClientFactory.class.getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class OAuthBearerSaslServerProvider extends Provider {
private static final long serialVersionUID = 1L;

protected OAuthBearerSaslServerProvider() {
super("SASL/OAUTHBEARER Server Provider", 1.0, "SASL/OAUTHBEARER Server Provider for Kafka");
super("SASL/OAUTHBEARER Server Provider", "1.0", "SASL/OAUTHBEARER Server Provider for Kafka");
put("SaslServerFactory." + OAuthBearerLoginModule.OAUTHBEARER_MECHANISM,
OAuthBearerSaslServerFactory.class.getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
public class TestPlainSaslServerProvider extends Provider {

public TestPlainSaslServerProvider() {
this("TestPlainSaslServerProvider", 0.1, "test plain sasl server provider");
this("TestPlainSaslServerProvider", "0.1", "test plain sasl server provider");
}

protected TestPlainSaslServerProvider(String name, double version, String info) {
protected TestPlainSaslServerProvider(String name, String version, String info) {
super(name, version, info);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public class TestProvider extends Provider {
private static final String TRUST_MANAGER_FACTORY = String.format("TrustManagerFactory.%s", TestTrustManagerFactory.ALGORITHM);

public TestProvider() {
this("TestProvider", 0.1, "provider for test cases");
this("TestProvider", "0.1", "provider for test cases");
}

protected TestProvider(String name, double version, String info) {
protected TestProvider(String name, String version, String info) {
super(name, version, info);
super.put(KEY_MANAGER_FACTORY, TestKeyManagerFactory.class.getName());
super.put(TRUST_MANAGER_FACTORY, TestTrustManagerFactory.class.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
public class TestScramSaslServerProvider extends Provider {

public TestScramSaslServerProvider() {
this("TestScramSaslServerProvider", 0.1, "test scram sasl server provider");
this("TestScramSaslServerProvider", "0.1", "test scram sasl server provider");
}

protected TestScramSaslServerProvider(String name, double version, String info) {
protected TestScramSaslServerProvider(String name, String version, String info) {
super(name, version, info);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public interface ConnectRestExtension extends Configurable, Versioned, Closeable
* method. The Connect framework will invoke this method after registering the default Connect resources. If the implementations attempt
* to re-register any of the Connect resources, it will be be ignored and will be logged.
*
* @param restPluginContext The context provides access to JAX-RS {@link javax.ws.rs.core.Configurable} and {@link
* @param restPluginContext The context provides access to JAX-RS {@link jakarta.ws.rs.core.Configurable} and {@link
* ConnectClusterState}.The custom JAX-RS resources can be registered via the {@link
* ConnectRestExtensionContext#configurable()}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@

import org.apache.kafka.connect.health.ConnectClusterState;

import javax.ws.rs.core.Configurable;
import jakarta.ws.rs.core.Configurable;

/**
* The interface provides the ability for {@link ConnectRestExtension} implementations to access the JAX-RS
* {@link javax.ws.rs.core.Configurable} and cluster state {@link ConnectClusterState}. The implementation for the interface is provided
* {@link jakarta.ws.rs.core.Configurable} and cluster state {@link ConnectClusterState}. The implementation for the interface is provided
* by the Connect framework.
*/
public interface ConnectRestExtensionContext {

/**
* Provides an implementation of {@link javax.ws.rs.core.Configurable} that be used to register JAX-RS resources.
* Provides an implementation of {@link jakarta.ws.rs.core.Configurable} that be used to register JAX-RS resources.
*
* @return @return the JAX-RS {@link javax.ws.rs.core.Configurable}; never {@code null}
* @return @return the JAX-RS {@link jakarta.ws.rs.core.Configurable}; never {@code null}
*/
Configurable<? extends Configurable> configurable();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
import org.apache.kafka.connect.errors.ConnectException;
import org.apache.kafka.connect.rest.ConnectRestExtension;
import org.apache.kafka.connect.rest.ConnectRestExtensionContext;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.security.auth.login.Configuration;
import java.io.IOException;
import java.util.Map;
import java.util.function.Supplier;
import javax.security.auth.login.Configuration;

/**
* Provides the ability to authenticate incoming BasicAuth credentials using the configured JAAS {@link
Expand All @@ -50,7 +51,7 @@
*</Pre>
*
* <p>This is a reference implementation of the {@link ConnectRestExtension} interface. It registers an implementation of {@link
* javax.ws.rs.container.ContainerRequestFilter} that does JAAS based authentication of incoming Basic Auth credentials. {@link
* jakarta.ws.rs.container.ContainerRequestFilter} that does JAAS based authentication of incoming Basic Auth credentials. {@link
* ConnectRestExtension} implementations are loaded via the plugin class loader using {@link java.util.ServiceLoader} mechanism and hence
* the packaged jar includes {@code META-INF/services/org.apache.kafka.connect.rest.extension.ConnectRestExtension} with the entry
* {@code org.apache.kafka.connect.extension.auth.jaas.BasicAuthSecurityRestExtension}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,31 @@

package org.apache.kafka.connect.rest.basic.auth.extension;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import javax.security.auth.login.Configuration;
import javax.ws.rs.HttpMethod;
import org.apache.kafka.common.config.ConfigException;
import org.apache.kafka.connect.errors.ConnectException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Base64;

import java.util.List;
import java.util.regex.Pattern;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.login.Configuration;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.core.Response;

import jakarta.ws.rs.HttpMethod;
import jakarta.ws.rs.container.ContainerRequestContext;
import jakarta.ws.rs.container.ContainerRequestFilter;
import jakarta.ws.rs.core.Response;

public class JaasBasicAuthFilter implements ContainerRequestFilter {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,26 @@

import org.apache.kafka.connect.errors.ConnectException;
import org.apache.kafka.connect.rest.ConnectRestExtensionContext;

import org.easymock.Capture;
import org.easymock.EasyMock;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import javax.security.auth.login.Configuration;
import javax.ws.rs.core.Configurable;

import java.io.IOException;
import java.util.Collections;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;
import javax.security.auth.login.Configuration;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import jakarta.ws.rs.core.Configurable;

public class BasicAuthSecurityRestExtensionTest {

Configuration priorConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,9 @@

package org.apache.kafka.connect.rest.basic.auth.extension;

import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.ChoiceCallback;
import javax.ws.rs.HttpMethod;
import javax.ws.rs.core.UriInfo;

import org.apache.kafka.common.security.authenticator.TestJaasConfig;
import org.apache.kafka.connect.errors.ConnectException;

import org.easymock.EasyMock;
import org.junit.jupiter.api.Test;

Expand All @@ -37,13 +32,18 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;

import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.Response;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.ChoiceCallback;

import static org.easymock.EasyMock.replay;
import static org.junit.jupiter.api.Assertions.assertThrows;

import jakarta.ws.rs.HttpMethod;
import jakarta.ws.rs.container.ContainerRequestContext;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;

public class JaasBasicAuthFilterTest {

private static final String LOGIN_MODULE =
Expand Down
Loading