Skip to content

Commit

Permalink
Build with JDK 16, 17, 18 (#504)
Browse files Browse the repository at this point in the history
* add java 17 build
* ignore cassandra test when jdk >= 15 && add 16 and 18 jdk
* add java LTS version to build
* skip javadoc for java 17+ for openam oauth2
* add cargo jvm args
* add exports sun.security.x509
* add 16 and 18 java to build jobs matrix
* fix jdk 16 build
* skip cassandra tests for jdk >= 15
  • Loading branch information
maximthomas authored May 30, 2022
1 parent c4a8a24 commit 5613c25
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [ '8', '11' ]
java: [ '8', '11', '16','17','18' ]
os: [ 'ubuntu-latest', 'macos-10.15', 'windows-latest' ]
steps:
- uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import com.sun.identity.shared.datastruct.CollectionHelper;
import com.sun.identity.shared.encode.Base64;

import sun.security.util.DerInputStream;
import sun.security.util.DerValue;
import sun.security.util.ObjectIdentifier;
import sun.security.x509.CertificateExtensions;
Expand Down Expand Up @@ -574,7 +575,7 @@ private void getTokenFromSubjectAltExt(X509Certificate cert)
(SubjectAlternativeNameExtension.SUBJECT_NAME);

GeneralName generalname = null;
ObjectIdentifier upnoid = new ObjectIdentifier(UPNOID);
ObjectIdentifier upnoid = new ObjectIdentifier(new DerInputStream(UPNOID.getBytes()));
Iterator itr = (Iterator) names.iterator();
while ((userTokenId == null) && itr.hasNext()) {
generalname = (GeneralName) itr.next();
Expand Down
2 changes: 1 addition & 1 deletion openam-cassandra/openam-cassandra-datastore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static void init() throws SSOException, IdRepoException{

cassandra=new Server();
cassandra.run();

HashMap<String, Set<String>> configParams=new HashMap<String, Set<String>>();
//System.setProperty("DC", "DC1");
configParams.put("sun-idrepo-ldapv3-config-organization_name", new HashSet<String>(Arrays.asList(new String[] {"realm_name"})));
Expand Down
19 changes: 19 additions & 0 deletions openam-cassandra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,24 @@
<artifactId>openam-core</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
<id>jdk-15-cassandra</id>
<activation>
<jdk>[15,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static void extractZip(File zipFile, final Path destinationDirectory) thr
Files.createDirectories(destinationDirectory);
}

try (java.nio.file.FileSystem zipFileSystem = FileSystems.newFileSystem(zipFile.toPath(), null)) {
try (java.nio.file.FileSystem zipFileSystem = FileSystems.newFileSystem(zipFile.toPath(), (ClassLoader)null)) {
Path root = zipFileSystem.getPath("/");
Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
@Override
Expand Down
19 changes: 19 additions & 0 deletions openam-oauth2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,23 @@
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>jdk-17-oauth2</id>
<activation>
<jdk>[17,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
2 changes: 1 addition & 1 deletion openam-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
<properties>
<cargo.rmi.port>8206</cargo.rmi.port>
<cargo.servlet.port>8207</cargo.servlet.port>
<cargo.jvmargs>-Xms4g -Xmx4g</cargo.jvmargs>
<cargo.jvmargs>${java.surefire.options} -Xms4g -Xmx4g</cargo.jvmargs>
</properties>
</configuration>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ public class AESWrapEncryption implements AMEncryption, ConfigurableKey {
private static final int AESWRAP_BLOCK_SIZE = 8;

private static final int CACHE_SIZE = Integer.getInteger("amCryptoCacheSize", 500);
private static final CipherProvider CIPHER_PROVIDER = Providers.cipherProvider("AESWrap", null, CACHE_SIZE);

private static final String CIPHER_PROVIDER_ALGORITHM
= Double.parseDouble(System.getProperty("java.specification.version")) >= 17 ? "AESWrapPad" : "AESWrap";

private static final CipherProvider CIPHER_PROVIDER = Providers.cipherProvider(CIPHER_PROVIDER_ALGORITHM, null, CACHE_SIZE);

private static final int KEY_SIZE = Integer.getInteger("org.forgerock.openam.encryption.key.size", 128);

Expand Down
45 changes: 43 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,45 @@
<!-- Disable Doclint on JDK8+ -->
<javadoc.opts>-Xdoclint:none</javadoc.opts>
<!-- Surefire Argument Line -->
<java.surefire.options>-Xmx1g --add-exports java.base/jdk.internal.ref=ALL-UNNAMED</java.surefire.options>
<java.surefire.options>
-Xmx1g
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.lang.module=ALL-UNNAMED
--add-opens java.base/java.lang.reflect=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
--add-opens java.base/java.net=ALL-UNNAMED
--add-opens java.base/java.io=ALL-UNNAMED
--add-opens java.base/java.util.regex=ALL-UNNAMED
--add-opens java.base/java.security=ALL-UNNAMED
--add-opens java.naming/javax.naming.spi=ALL-UNNAMED
--add-opens java.base/javax.security.auth.login=ALL-UNNAMED
--add-opens java.base/java.nio.charset=ALL-UNNAMED
--add-opens java.base/java.security.cert=ALL-UNNAMED
--add-opens java.base/jdk.internal.loader=ALL-UNNAMED
--add-opens java.base/jdk.internal.ref=ALL-UNNAMED
--add-opens java.base/jdk.internal.reflect=ALL-UNNAMED
--add-opens java.base/jdk.internal.math=ALL-UNNAMED
--add-opens java.base/jdk.internal.module=ALL-UNNAMED
--add-opens java.base/jdk.internal.util.jar=ALL-UNNAMED
--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
--add-opens java.base/sun.nio.ch=ALL-UNNAMED
--add-opens java.base/java.util.concurrent=ALL-UNNAMED
--add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED
--add-opens java.base/java.nio=ALL-UNNAMED

--add-exports java.base/jdk.internal.ref=ALL-UNNAMED
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED
--add-exports java.base/sun.nio.ch=ALL-UNNAMED
--add-exports java.base/sun.security.util=ALL-UNNAMED
--add-exports java.base/sun.security.jca=ALL-UNNAMED
--add-exports java.base/sun.security.x509=ALL-UNNAMED
--add-exports java.base/jdk.internal.util.random=ALL-UNNAMED
--add-exports java.base/sun.security.tools.keytool=ALL-UNNAMED
--add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED
--add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED
--add-exports java.rmi/sun.rmi.server=ALL-UNNAMED
--add-exports java.sql/java.sql=ALL-UNNAMED
</java.surefire.options>
<!-- JavaDoc Setting Properties -->
<javadoc.options>-J-Xms2g -J-Xmx2g</javadoc.options>
</properties>
Expand Down Expand Up @@ -1943,6 +1981,9 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>${java.surefire.options}</argLine>
</configuration>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -2141,7 +2182,7 @@
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.10.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
Expand Down

0 comments on commit 5613c25

Please sign in to comment.