Skip to content

Commit a0073c9

Browse files
smolnar82moresandeeppzampinobonampak
authored
KNOX-3162 - Build support for JDK 17 (#1114)
* Update Knox to JDK 17 * Fix issues with SecureKnoxShellTest * KNOX-3216: Upgrade Spring to 6.x (#1109) * KNOX-3217: fix TestHashicorpVaultAliasService test failures. (spring vault library needs to be upgraded to 3.2.0 that is compatible with Spring 6.2). Removed spring-vault-dependencies as it is unavailable since 3.0+. Added httpclient and httpcore libraries to managed dependencies as these were taken from spring-vault-dependencies now. Removed duplicated dependencies from gateway pom.xml --------- Co-authored-by: Sandeep Moré <moresandeep@gmail.com> Co-authored-by: Phil Zampino <pzampino@apache.org> Co-authored-by: bonampak <14160522+bonampak@users.noreply.github.com>
1 parent 074c960 commit a0073c9

File tree

152 files changed

+1536
-2446
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+1536
-2446
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
runs-on: ubuntu-latest
3131
strategy:
3232
matrix:
33-
java: [ 8, 11 ]
33+
java: [ 17 ]
3434
fail-fast: false
3535
name: CI - Java ${{ matrix.java }}
3636
steps:

build-tools/src/main/resources/build-tools/pmd/pmd-ruleset.xml

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,42 @@ limitations under the License.
3232
<exclude name="ConstantsInInterface" />
3333
<exclude name="ForLoopVariableCount" />
3434
<exclude name="GuardLogStatement" />
35-
<exclude name="JUnitAssertionsShouldIncludeMessage" />
36-
<exclude name="JUnitTestContainsTooManyAsserts" />
37-
<exclude name="JUnitTestsShouldIncludeAssert" />
35+
<exclude name="UnitTestShouldIncludeAssert" />
3836
<exclude name="MethodReturnsInternalArray" />
3937
<exclude name="OneDeclarationPerLine" />
4038
<exclude name="PreserveStackTrace" />
4139
<exclude name="ReplaceEnumerationWithIterator" />
4240
<exclude name="ReplaceHashtableWithMap" />
43-
<exclude name="SwitchStmtsShouldHaveDefault" />
41+
<exclude name="NonExhaustiveSwitch" />
4442
<exclude name="SystemPrintln" />
4543
<exclude name="UseTryWithResources" />
4644
<exclude name="UseVarargs" />
45+
<exclude name="UnitTestAssertionsShouldIncludeMessage" />
46+
<exclude name="LooseCoupling" />
47+
<exclude name="UnitTestContainsTooManyAsserts" />
48+
<exclude name="UnusedAssignment" />
49+
<exclude name="LiteralsFirstInComparisons" />
50+
<exclude name="UnusedLocalVariable" />
51+
<exclude name="UnusedPrivateField" />
52+
<exclude name="UnnecessaryVarargsArrayCreation" />
53+
<exclude name="UnitTestShouldUseTestAnnotation" />
54+
<exclude name="UnitTestShouldUseBeforeAnnotation" />
55+
<exclude name="CheckResultSet" />
56+
<exclude name="UseEnumCollections" />
57+
<exclude name="UnitTestShouldUseAfterAnnotation" />
58+
<exclude name="SimplifiableTestAssertion" />
59+
<exclude name="DoubleBraceInitialization" />
60+
<exclude name="UseCollectionIsEmpty" />
4761
</rule>
4862

4963
<!--<rule ref="category/java/codestyle.xml" />-->
5064
<rule ref="category/java/codestyle.xml/AvoidProtectedFieldInFinalClass" />
5165
<rule ref="category/java/codestyle.xml/ControlStatementBraces" />
52-
<rule ref="category/java/codestyle.xml/DontImportJavaLang" />
53-
<rule ref="category/java/codestyle.xml/DuplicateImports" />
5466
<rule ref="category/java/codestyle.xml/ExtendsObject" />
5567
<rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop" />
5668
<rule ref="category/java/codestyle.xml/NoPackage" />
5769
<rule ref="category/java/codestyle.xml/PackageCase" />
5870
<rule ref="category/java/codestyle.xml/UnnecessaryModifier" />
59-
<rule ref="category/java/codestyle.xml/UnnecessaryReturn" />
60-
<rule ref="category/java/codestyle.xml/UseDiamondOperator" />
6171

6272
<!--<rule ref="category/java/design.xml" />-->
6373
<!--<rule ref="category/java/documentation.xml" />-->
@@ -71,30 +81,40 @@ limitations under the License.
7181
<exclude name="AvoidDuplicateLiterals" />
7282
<exclude name="AvoidFieldNameMatchingMethodName" />
7383
<exclude name="AvoidLiteralsInIfCondition" />
74-
<exclude name="BeanMembersShouldSerialize" />
84+
<exclude name="NonSerializableClass" />
7585
<exclude name="ConstructorCallsOverridableMethod" />
76-
<exclude name="DataflowAnomalyAnalysis" />
77-
<exclude name="DoNotCallSystemExit" />
86+
<exclude name="DoNotTerminateVM" />
7887
<exclude name="EmptyCatchBlock" />
79-
<exclude name="EmptyIfStmt" />
80-
<exclude name="LoggerIsNotStaticFinal" />
81-
<exclude name="MissingBreakInSwitch" />
88+
<exclude name="ProperLogger" />
89+
<exclude name="ImplicitSwitchFallThrough" />
8290
<exclude name="MissingSerialVersionUID" />
8391
<exclude name="MoreThanOneLogger" />
8492
<exclude name="NullAssignment" />
85-
<exclude name="ReturnEmptyArrayRatherThanNull" />
93+
<exclude name="ReturnEmptyCollectionRatherThanNull" />
8694
<exclude name="UseProperClassLoader" />
95+
<exclude name="TestClassWithoutTestCases" />
96+
<exclude name="AvoidAccessibilityAlteration" />
97+
<exclude name="ConfusingArgumentToVarargsMethod" />
98+
<exclude name="CloneMethodReturnTypeMustMatchClassName" />
99+
<exclude name="CloseResource" />
100+
<exclude name="CompareObjectsWithEquals" />
87101
</rule>
88102
<rule ref="category/java/multithreading.xml">
89103
<exclude name="AvoidSynchronizedAtMethodLevel" />
90104
<exclude name="UseConcurrentHashMap" />
105+
<exclude name="DoNotUseThreads" />
106+
<exclude name="AvoidSynchronizedStatement" />
91107
</rule>
92108
<rule ref="category/java/performance.xml">
93109
<exclude name="AvoidInstantiatingObjectsInLoops" />
94110
<exclude name="InefficientEmptyStringCheck" />
95-
<exclude name="SimplifyStartsWith" />
96-
<exclude name="TooFewBranchesForASwitchStatement" />
111+
<exclude name="TooFewBranchesForSwitch" />
97112
<exclude name="UseStringBufferForStringAppends" />
113+
<exclude name="AppendCharacterWithChar" />
114+
<exclude name="ConsecutiveAppendsShouldReuse" />
115+
<exclude name="UseArraysAsList" />
116+
<exclude name="StringInstantiation" />
117+
<exclude name="InsufficientStringBufferDeclaration" />
98118
</rule>
99119
<rule ref="category/java/security.xml" />
100120
</ruleset>

gateway-demo-ldap/pom.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
<dependency>
5555
<groupId>org.apache.directory.api</groupId>
5656
<artifactId>api-ldap-client-api</artifactId>
57+
<scope>test</scope>
5758
</dependency>
5859
<dependency>
5960
<groupId>org.apache.directory.api</groupId>
@@ -71,6 +72,7 @@
7172
<dependency>
7273
<groupId>org.apache.mina</groupId>
7374
<artifactId>mina-core</artifactId>
75+
<scope>test</scope>
7476
</dependency>
7577

7678
<dependency>
@@ -89,4 +91,43 @@
8991
<artifactId>bcprov-jdk18on</artifactId>
9092
</dependency>
9193
</dependencies>
94+
<build>
95+
<plugins>
96+
<plugin>
97+
<groupId>org.apache.maven.plugins</groupId>
98+
<artifactId>maven-shade-plugin</artifactId>
99+
<executions>
100+
<execution>
101+
<phase>package</phase>
102+
<goals><goal>shade</goal></goals>
103+
<configuration>
104+
<createDependencyReducedPom>false</createDependencyReducedPom>
105+
<shadedArtifactAttached>false</shadedArtifactAttached>
106+
<filters>
107+
<!-- Strip schema LDIFs contributed by ANYONE -->
108+
<filter>
109+
<artifact>*:*</artifact>
110+
<excludes>
111+
<exclude>schema/**</exclude>
112+
<exclude>**/*.ldif</exclude>
113+
</excludes>
114+
</filter>
115+
<!-- remove signatures from every included artifact -->
116+
<filter>
117+
<artifact>*:*</artifact>
118+
<excludes>
119+
<exclude>META-INF/*.SF</exclude>
120+
<exclude>META-INF/*.DSA</exclude>
121+
<exclude>META-INF/*.RSA</exclude>
122+
<exclude>META-INF/*.EC</exclude>
123+
<exclude>META-INF/*.sig</exclude>
124+
</excludes>
125+
</filter>
126+
</filters>
127+
</configuration>
128+
</execution>
129+
</executions>
130+
</plugin>
131+
</plugins>
132+
</build>
92133
</project>

gateway-openapi-ui/pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,16 @@
8686
<groupId>org.apache.knox</groupId>
8787
<artifactId>gateway-service-metadata</artifactId>
8888
</dependency>
89+
90+
<!-- JAXB dependencies required for swagger-maven-plugin in JDK 17+ -->
91+
<dependency>
92+
<groupId>javax.xml.bind</groupId>
93+
<artifactId>jaxb-api</artifactId>
94+
<version>${xml-jaxb.version}</version>
95+
</dependency>
96+
<dependency>
97+
<groupId>org.glassfish.jaxb</groupId>
98+
<artifactId>jaxb-runtime</artifactId>
99+
</dependency>
89100
</dependencies>
90101
</project>

gateway-performance-test/pom.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
<groupId>javax.servlet</groupId>
6868
<artifactId>javax.servlet-api</artifactId>
6969
</dependency>
70+
<dependency>
71+
<groupId>com.fasterxml.jackson.core</groupId>
72+
<artifactId>jackson-core</artifactId>
73+
</dependency>
7074
<dependency>
7175
<groupId>org.apache.commons</groupId>
7276
<artifactId>commons-lang3</artifactId>
@@ -123,4 +127,4 @@
123127
</build>
124128
</profile>
125129
</profiles>
126-
</project>
130+
</project>

gateway-provider-identity-assertion-common/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
<dependency>
4141
<groupId>org.apache.knox</groupId>
4242
<artifactId>gateway-spi-common</artifactId>
43+
<scope>test</scope>
4344
</dependency>
4445
<dependency>
4546
<groupId>org.apache.knox</groupId>
@@ -71,9 +72,15 @@
7172
<artifactId>commons-lang3</artifactId>
7273
</dependency>
7374

75+
<dependency>
76+
<groupId>de.thetaphi</groupId>
77+
<artifactId>forbiddenapis</artifactId>
78+
</dependency>
79+
7480
<dependency>
7581
<groupId>org.apache.httpcomponents</groupId>
7682
<artifactId>httpclient</artifactId>
83+
<scope>test</scope>
7784
</dependency>
7885

7986
<dependency>
@@ -88,6 +95,7 @@
8895
<dependency>
8996
<groupId>org.eclipse.jetty</groupId>
9097
<artifactId>jetty-util</artifactId>
98+
<scope>test</scope>
9199
</dependency>
92100
<dependency>
93101
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
@@ -96,6 +104,7 @@
96104
<dependency>
97105
<groupId>org.jboss.shrinkwrap</groupId>
98106
<artifactId>shrinkwrap-api</artifactId>
107+
<scope>test</scope>
99108
</dependency>
100109

101110

gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/filter/AbstractIdentityAssertionFilter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
import org.apache.knox.gateway.security.PrimaryPrincipal;
5353
import org.apache.knox.gateway.security.SubjectUtils;
5454

55+
import de.thetaphi.forbiddenapis.SuppressForbidden;
56+
5557
public abstract class AbstractIdentityAssertionFilter extends
5658
AbstractIdentityAssertionBase implements Filter {
5759

@@ -87,6 +89,7 @@ public AbstractIdentityAssertionFilter() {
8789
*/
8890
public abstract String mapUserPrincipal(String principalName);
8991

92+
@SuppressForbidden
9093
protected void continueChainAsPrincipal(HttpServletRequestWrapper request, ServletResponse response,
9194
FilterChain chain, String mappedPrincipalName, String[] groups) throws IOException,
9295
ServletException {

gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/filter/CommonIdentityAssertionFilter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import javax.servlet.http.HttpServletRequestWrapper;
4646
import javax.servlet.http.HttpServletResponse;
4747

48+
import de.thetaphi.forbiddenapis.SuppressForbidden;
4849
import org.apache.commons.lang3.ArrayUtils;
4950
import org.apache.commons.lang3.StringUtils;
5051
import org.apache.knox.gateway.IdentityAsserterMessages;
@@ -221,6 +222,7 @@ public void destroy() {
221222
* to the identity to be asserted as appropriate and create the provider specific
222223
* assertion token. Add the assertion token to the request.
223224
*/
225+
@SuppressForbidden
224226
@Override
225227
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
226228
throws IOException, ServletException {

gateway-provider-identity-assertion-hadoop-groups/pom.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
<groupId>org.apache.knox</groupId>
3838
<artifactId>gateway-spi</artifactId>
3939
</dependency>
40-
<dependency>
41-
<groupId>org.apache.knox</groupId>
42-
<artifactId>gateway-spi-common</artifactId>
43-
</dependency>
4440
<dependency>
4541
<groupId>org.apache.knox</groupId>
4642
<artifactId>gateway-provider-identity-assertion-common</artifactId>
@@ -77,6 +73,11 @@
7773
<artifactId>jetty-servlet</artifactId>
7874
<scope>test</scope>
7975
</dependency>
76+
<dependency>
77+
<groupId>org.apache.knox</groupId>
78+
<artifactId>gateway-spi-common</artifactId>
79+
<scope>test</scope>
80+
</dependency>
8081

8182
<dependency>
8283
<groupId>org.xmlmatchers</groupId>

gateway-provider-jersey/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,24 @@
4242
<groupId>org.glassfish.jersey.core</groupId>
4343
<artifactId>jersey-server</artifactId>
4444
</dependency>
45+
<dependency>
46+
<groupId>org.glassfish.jersey.inject</groupId>
47+
<artifactId>jersey-hk2</artifactId>
48+
</dependency>
4549

4650
<dependency>
4751
<groupId>org.jboss.shrinkwrap</groupId>
4852
<artifactId>shrinkwrap-api</artifactId>
53+
<scope>test</scope>
4954
</dependency>
5055
<dependency>
5156
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
5257
<artifactId>shrinkwrap-descriptors-api-javaee</artifactId>
5358
</dependency>
59+
<dependency>
60+
<groupId>javax.servlet</groupId>
61+
<artifactId>javax.servlet-api</artifactId>
62+
</dependency>
5463

5564
<dependency>
5665
<groupId>org.apache.knox</groupId>

0 commit comments

Comments
 (0)