Skip to content
Open
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
3 changes: 3 additions & 0 deletions checkstyleSuppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@

<!-- TODO ZOOKEEPER-3508 -->
<suppress checks="LineLength" files=".+[\\/]zookeeper-server[\\/].+\.java"/>
<suppress checks="LineLength" files=".+[\\/]zookeeper-server-http-admin[\\/].+\.java"/>

<!-- TODO ZOOKEEPER-3507 -->
<suppress checks=".*Name.*" files=".+[\\/]zookeeper-server[\\/].+\.java"/>
<suppress checks=".*Name.*" files=".+[\\/]zookeeper-server-http-admin[\\/].+\.java"/>

<!-- TODO ZOOKEEPER-3469 -->
<suppress checks="Javadoc.+" files=".+[\\/]zookeeper-server[\\/].+\.java"/>
<suppress checks="Javadoc.+" files=".+[\\/]zookeeper-server-http-admin[\\/].+\.java"/>
</suppressions>
9 changes: 9 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,15 @@
</developers>

<profiles>
<profile>
<id>jdk17+</id>
<activation>
<jdk>[17,)</jdk>
</activation>
<modules>
<module>zookeeper-server-http-admin</module>
</modules>
</profile>
<profile>
<id>full-build</id>
<modules>
Expand Down
21 changes: 13 additions & 8 deletions zookeeper-assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@
<skip.lib.artifact>false</skip.lib.artifact>
</properties>
</profile>
<profile>
<id>jdk17+</id>
<activation>
<jdk>[17,)</jdk>
</activation>
<dependencies>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper-http-admin</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
</profiles>


Expand Down Expand Up @@ -87,14 +100,6 @@
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
Expand Down
117 changes: 117 additions & 0 deletions zookeeper-server-http-admin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!--
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.zookeeper</groupId>
<artifactId>parent</artifactId>
<version>3.10.0-SNAPSHOT</version>
</parent>

<artifactId>zookeeper-http-admin</artifactId>
<packaging>jar</packaging>
<name>Apache ZooKeeper - HTTP Admin Server</name>
<description>
Optional HTTP admin server for ZooKeeper, backed by Jetty 12.
Requires Java 17 or later. When this module is on the classpath,
ZooKeeper will automatically use JettyAdminServer; otherwise it
falls back to DummyAdminServer.
</description>

<properties>
<maven.compiler.release>17</maven.compiler.release>
<jetty12.version>12.0.35</jetty12.version>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Jetty 12 core -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty12.version}</version>
</dependency>

<!-- Jetty 12 EE8 (javax.servlet compatibility) -->
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-servlet</artifactId>
<version>${jetty12.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-security</artifactId>
<version>${jetty12.version}</version>
</dependency>

<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
<version>${jetty12.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,21 @@
import org.apache.zookeeper.common.SecretUtils;
import org.apache.zookeeper.common.X509Util;
import org.apache.zookeeper.server.ZooKeeperServer;
import org.apache.zookeeper.server.admin.jetty.UnifiedConnectionFactory;
import org.apache.zookeeper.server.auth.IPAuthenticationProvider;
import org.eclipse.jetty.ee8.nested.ServletConstraint;
import org.eclipse.jetty.ee8.security.ConstraintMapping;
import org.eclipse.jetty.ee8.security.ConstraintSecurityHandler;
import org.eclipse.jetty.ee8.servlet.ServletContextHandler;
import org.eclipse.jetty.ee8.servlet.ServletHolder;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.security.ConstraintMapping;
import org.eclipse.jetty.security.ConstraintSecurityHandler;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.security.Constraint;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -369,7 +370,7 @@ private List<String> commandLinks() {
* @param ctxHandler the context to modify
*/
private void constrainTraceMethod(ServletContextHandler ctxHandler) {
Constraint c = new Constraint();
ServletConstraint c = new ServletConstraint();
c.setAuthenticate(true);

ConstraintMapping cmt = new ConstraintMapping();
Expand Down
Loading