Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 8, 11 ]
java: [ 17 ]
fail-fast: false
name: CI - Java ${{ matrix.java }}
steps:
Expand Down
54 changes: 37 additions & 17 deletions build-tools/src/main/resources/build-tools/pmd/pmd-ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,42 @@ limitations under the License.
<exclude name="ConstantsInInterface" />
<exclude name="ForLoopVariableCount" />
<exclude name="GuardLogStatement" />
<exclude name="JUnitAssertionsShouldIncludeMessage" />
<exclude name="JUnitTestContainsTooManyAsserts" />
<exclude name="JUnitTestsShouldIncludeAssert" />
<exclude name="UnitTestShouldIncludeAssert" />
<exclude name="MethodReturnsInternalArray" />
<exclude name="OneDeclarationPerLine" />
<exclude name="PreserveStackTrace" />
<exclude name="ReplaceEnumerationWithIterator" />
<exclude name="ReplaceHashtableWithMap" />
<exclude name="SwitchStmtsShouldHaveDefault" />
<exclude name="NonExhaustiveSwitch" />
<exclude name="SystemPrintln" />
<exclude name="UseTryWithResources" />
<exclude name="UseVarargs" />
<exclude name="UnitTestAssertionsShouldIncludeMessage" />
<exclude name="LooseCoupling" />
<exclude name="UnitTestContainsTooManyAsserts" />
<exclude name="UnusedAssignment" />
<exclude name="LiteralsFirstInComparisons" />
<exclude name="UnusedLocalVariable" />
<exclude name="UnusedPrivateField" />
<exclude name="UnnecessaryVarargsArrayCreation" />
<exclude name="UnitTestShouldUseTestAnnotation" />
<exclude name="UnitTestShouldUseBeforeAnnotation" />
<exclude name="CheckResultSet" />
<exclude name="UseEnumCollections" />
<exclude name="UnitTestShouldUseAfterAnnotation" />
<exclude name="SimplifiableTestAssertion" />
<exclude name="DoubleBraceInitialization" />
<exclude name="UseCollectionIsEmpty" />
</rule>

<!--<rule ref="category/java/codestyle.xml" />-->
<rule ref="category/java/codestyle.xml/AvoidProtectedFieldInFinalClass" />
<rule ref="category/java/codestyle.xml/ControlStatementBraces" />
<rule ref="category/java/codestyle.xml/DontImportJavaLang" />
<rule ref="category/java/codestyle.xml/DuplicateImports" />
<rule ref="category/java/codestyle.xml/ExtendsObject" />
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" />
<rule ref="category/java/codestyle.xml/NoPackage" />
<rule ref="category/java/codestyle.xml/PackageCase" />
<rule ref="category/java/codestyle.xml/UnnecessaryModifier" />
<rule ref="category/java/codestyle.xml/UnnecessaryReturn" />
<rule ref="category/java/codestyle.xml/UseDiamondOperator" />

<!--<rule ref="category/java/design.xml" />-->
<!--<rule ref="category/java/documentation.xml" />-->
Expand All @@ -71,30 +81,40 @@ limitations under the License.
<exclude name="AvoidDuplicateLiterals" />
<exclude name="AvoidFieldNameMatchingMethodName" />
<exclude name="AvoidLiteralsInIfCondition" />
<exclude name="BeanMembersShouldSerialize" />
<exclude name="NonSerializableClass" />
<exclude name="ConstructorCallsOverridableMethod" />
<exclude name="DataflowAnomalyAnalysis" />
<exclude name="DoNotCallSystemExit" />
<exclude name="DoNotTerminateVM" />
<exclude name="EmptyCatchBlock" />
<exclude name="EmptyIfStmt" />
<exclude name="LoggerIsNotStaticFinal" />
<exclude name="MissingBreakInSwitch" />
<exclude name="ProperLogger" />
<exclude name="ImplicitSwitchFallThrough" />
<exclude name="MissingSerialVersionUID" />
<exclude name="MoreThanOneLogger" />
<exclude name="NullAssignment" />
<exclude name="ReturnEmptyArrayRatherThanNull" />
<exclude name="ReturnEmptyCollectionRatherThanNull" />
<exclude name="UseProperClassLoader" />
<exclude name="TestClassWithoutTestCases" />
<exclude name="AvoidAccessibilityAlteration" />
<exclude name="ConfusingArgumentToVarargsMethod" />
<exclude name="CloneMethodReturnTypeMustMatchClassName" />
<exclude name="CloseResource" />
<exclude name="CompareObjectsWithEquals" />
</rule>
<rule ref="category/java/multithreading.xml">
<exclude name="AvoidSynchronizedAtMethodLevel" />
<exclude name="UseConcurrentHashMap" />
<exclude name="DoNotUseThreads" />
<exclude name="AvoidSynchronizedStatement" />
</rule>
<rule ref="category/java/performance.xml">
<exclude name="AvoidInstantiatingObjectsInLoops" />
<exclude name="InefficientEmptyStringCheck" />
<exclude name="SimplifyStartsWith" />
<exclude name="TooFewBranchesForASwitchStatement" />
<exclude name="TooFewBranchesForSwitch" />
<exclude name="UseStringBufferForStringAppends" />
<exclude name="AppendCharacterWithChar" />
<exclude name="ConsecutiveAppendsShouldReuse" />
<exclude name="UseArraysAsList" />
<exclude name="StringInstantiation" />
<exclude name="InsufficientStringBufferDeclaration" />
</rule>
<rule ref="category/java/security.xml" />
</ruleset>
41 changes: 41 additions & 0 deletions gateway-demo-ldap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
<dependency>
<groupId>org.apache.directory.api</groupId>
<artifactId>api-ldap-client-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.directory.api</groupId>
Expand All @@ -71,6 +72,7 @@
<dependency>
<groupId>org.apache.mina</groupId>
<artifactId>mina-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
Expand All @@ -89,4 +91,43 @@
<artifactId>bcprov-jdk18on</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals><goal>shade</goal></goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<shadedArtifactAttached>false</shadedArtifactAttached>
<filters>
<!-- Strip schema LDIFs contributed by ANYONE -->
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>schema/**</exclude>
<exclude>**/*.ldif</exclude>
</excludes>
</filter>
<!-- remove signatures from every included artifact -->
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/*.EC</exclude>
<exclude>META-INF/*.sig</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
11 changes: 11 additions & 0 deletions gateway-openapi-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,16 @@
<groupId>org.apache.knox</groupId>
<artifactId>gateway-service-metadata</artifactId>
</dependency>

<!-- JAXB dependencies required for swagger-maven-plugin in JDK 17+ -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${xml-jaxb.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
</dependency>
</dependencies>
</project>
6 changes: 5 additions & 1 deletion gateway-performance-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down Expand Up @@ -123,4 +127,4 @@
</build>
</profile>
</profiles>
</project>
</project>
9 changes: 9 additions & 0 deletions gateway-provider-identity-assertion-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<dependency>
<groupId>org.apache.knox</groupId>
<artifactId>gateway-spi-common</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.knox</groupId>
Expand Down Expand Up @@ -71,9 +72,15 @@
<artifactId>commons-lang3</artifactId>
</dependency>

<dependency>
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<scope>test</scope>
</dependency>

<dependency>
Expand All @@ -88,6 +95,7 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
Expand All @@ -96,6 +104,7 @@
<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-api</artifactId>
<scope>test</scope>
</dependency>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
import org.apache.knox.gateway.security.PrimaryPrincipal;
import org.apache.knox.gateway.security.SubjectUtils;

import de.thetaphi.forbiddenapis.SuppressForbidden;

public abstract class AbstractIdentityAssertionFilter extends
AbstractIdentityAssertionBase implements Filter {

Expand Down Expand Up @@ -87,6 +89,7 @@ public AbstractIdentityAssertionFilter() {
*/
public abstract String mapUserPrincipal(String principalName);

@SuppressForbidden
protected void continueChainAsPrincipal(HttpServletRequestWrapper request, ServletResponse response,
FilterChain chain, String mappedPrincipalName, String[] groups) throws IOException,
ServletException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;

import de.thetaphi.forbiddenapis.SuppressForbidden;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.knox.gateway.IdentityAsserterMessages;
Expand Down Expand Up @@ -221,6 +222,7 @@ public void destroy() {
* to the identity to be asserted as appropriate and create the provider specific
* assertion token. Add the assertion token to the request.
*/
@SuppressForbidden
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
Expand Down
9 changes: 5 additions & 4 deletions gateway-provider-identity-assertion-hadoop-groups/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@
<groupId>org.apache.knox</groupId>
<artifactId>gateway-spi</artifactId>
</dependency>
<dependency>
<groupId>org.apache.knox</groupId>
<artifactId>gateway-spi-common</artifactId>
</dependency>
<dependency>
<groupId>org.apache.knox</groupId>
<artifactId>gateway-provider-identity-assertion-common</artifactId>
Expand Down Expand Up @@ -77,6 +73,11 @@
<artifactId>jetty-servlet</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.knox</groupId>
<artifactId>gateway-spi-common</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.xmlmatchers</groupId>
Expand Down
9 changes: 9 additions & 0 deletions gateway-provider-jersey/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,24 @@
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
<artifactId>shrinkwrap-descriptors-api-javaee</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>

<dependency>
<groupId>org.apache.knox</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* 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.
*/
package org.apache.knox.gateway.jersey;

import org.glassfish.jersey.servlet.spi.FilterUrlMappingsProvider;
import javax.servlet.FilterConfig;
import java.util.Collections;
import java.util.List;

/**
* Custom FilterUrlMappingsProvider for Knox that handles null FilterRegistration objects
* gracefully. Jersey 2.47+ expects FilterRegistration objects to be available in the
* ServletContext, but Knox's dynamic filter loading doesn't always provide them.
* This provider returns empty collections to prevent NullPointerExceptions.
*/
public class KnoxFilterUrlMappingsProvider implements FilterUrlMappingsProvider {
@Override
public List<String> getFilterUrlMappings(FilterConfig filterConfig) {
// Return empty list instead of trying to access potentially null FilterRegistration
// This prevents the NullPointerException that occurs in Jersey's FilterUrlMappingsProviderImpl
return Collections.emptyList();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
##########################################################################
# 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.
##########################################################################

org.apache.knox.gateway.jersey.KnoxFilterUrlMappingsProvider
4 changes: 4 additions & 0 deletions gateway-provider-rewrite-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
<artifactId>gateway-util-urltemplate</artifactId>
</dependency>

<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>jakarta.activation</artifactId>
</dependency>
<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
Expand Down
Loading
Loading