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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#519] Add moditect-generated module-info.java files and a simple IT. #722

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 39 additions & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,42 @@
</plugins>
</build>

</project>
<profiles>
<profile>
<id>nonJDK7</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<executions>
<execution>
<id>add-module-infos</id>
<phase>package</phase>
<goals>
<goal>add-module-info</goal>
</goals>
<configuration>
<module>
<moduleInfoSource>
module io.jsonwebtoken.jjwt.api {
exports io.jsonwebtoken;
exports io.jsonwebtoken.io;
exports io.jsonwebtoken.lang;
exports io.jsonwebtoken.security;
}
</moduleInfoSource>
</module>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
45 changes: 44 additions & 1 deletion extensions/gson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,47 @@
</dependency>
</dependencies>

</project>
<profiles>
<profile>
<id>nonJDK7</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<executions>
<execution>
<id>add-module-infos</id>
<phase>package</phase>
<goals>
<goal>add-module-info</goal>
</goals>
<configuration>
<module>
<moduleInfoSource>
module io.jsonwebtoken.jjwt.ext.gson {
requires transitive com.google.gson;
requires io.jsonwebtoken.jjwt.api;

exports io.jsonwebtoken.gson.io;

provides io.jsonwebtoken.io.Deserializer with
io.jsonwebtoken.gson.io.GsonDeserializer;
provides io.jsonwebtoken.io.Serializer with
io.jsonwebtoken.gson.io.GsonSerializer;
}
</moduleInfoSource>
</module>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
47 changes: 46 additions & 1 deletion extensions/jackson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,49 @@
</plugin>
</plugins>
</build>
</project>

<profiles>
<profile>
<id>nonJDK7</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<executions>
<execution>
<id>add-module-infos</id>
<phase>package</phase>
<goals>
<goal>add-module-info</goal>
</goals>
<configuration>
<module>
<moduleInfoSource>
module io.jsonwebtoken.jjwt.ext.jackson {
requires transitive com.fasterxml.jackson.core;
requires transitive com.fasterxml.jackson.databind;
requires io.jsonwebtoken.jjwt.api;

exports io.jsonwebtoken.jackson.io;

provides io.jsonwebtoken.io.Deserializer with
io.jsonwebtoken.jackson.io.JacksonDeserializer;
provides io.jsonwebtoken.io.Serializer with
io.jsonwebtoken.jackson.io.JacksonSerializer;

}
</moduleInfoSource>
</module>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
44 changes: 43 additions & 1 deletion extensions/orgjson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,46 @@
</plugin>
</plugins>
</build>
</project>

<profiles>
<profile>
<id>nonJDK7</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<executions>
<execution>
<id>add-module-infos</id>
<phase>package</phase>
<goals>
<goal>add-module-info</goal>
</goals>
<configuration>
<module>
<moduleInfoSource>
module io.jsonwebtoken.jjwt.ext.orgjson {
requires transitive json;
requires io.jsonwebtoken.jjwt.api;

exports io.jsonwebtoken.orgjson.io;

provides io.jsonwebtoken.io.Deserializer with io.jsonwebtoken.orgjson.io.OrgJsonDeserializer;
provides io.jsonwebtoken.io.Serializer with io.jsonwebtoken.orgjson.io.OrgJsonSerializer;
}

</moduleInfoSource>
</module>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
50 changes: 49 additions & 1 deletion impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,52 @@
</dependency>
</dependencies>

</project>
<profiles>
<profile>
<id>nonJDK7</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<executions>
<execution>
<id>add-module-infos</id>
<phase>package</phase>
<goals>
<goal>add-module-info</goal>
</goals>
<configuration>
<module>
<moduleInfoSource>
module io.jsonwebtoken.jjwt.impl {
requires io.jsonwebtoken.jjwt.api;

exports io.jsonwebtoken.impl;
exports io.jsonwebtoken.impl.compression;
exports io.jsonwebtoken.impl.crypto;
exports io.jsonwebtoken.impl.lang;

provides io.jsonwebtoken.CompressionCodec with
io.jsonwebtoken.impl.compression.DeflateCompressionCodec,
io.jsonwebtoken.impl.compression.GzipCompressionCodec;

uses io.jsonwebtoken.CompressionCodec;
uses io.jsonwebtoken.io.Deserializer;
uses io.jsonwebtoken.io.Serializer;
}

</moduleInfoSource>
</module>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
25 changes: 25 additions & 0 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-root</artifactId>
<version>0.11.3-SNAPSHOT</version>
</parent>

<artifactId>jjwt-integration-tests</artifactId>
<name>JJWT :: Integration-Tests</name>
<packaging>pom</packaging>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<modules>
<module>unsigned-jackson</module>
</modules>

</project>
70 changes: 70 additions & 0 deletions integration-tests/unsigned-jackson/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-integration-tests</artifactId>
<version>0.11.3-SNAPSHOT</version>
</parent>

<artifactId>jjwt-integration-tests-unsigned-jackson</artifactId>
<name>JJWT :: Integration-Tests :: unsigned-jackson</name>
<description>Create and parse an unsigned JWT using Jackson and JPMS.</description>
<packaging>jar</packaging>

<properties>
<maven.compiler.release>9</maven.compiler.release>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

<dependencies>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.11.3-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<skip>true</skip>
<detectJavaApiLink>false</detectJavaApiLink>
</configuration>
</plugin>
<!--
this plugin needs to be disabled as long as we are stuck with plugin version 3.3.0, as it cannot
handle Java 9 module-info.class files.
This will also use an empty MANIFEST.MF file, since there is no way in maven to unsetting
an entry (like archive/manifestFile for the jar plugin).
-->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.jsonwebtoken.it.unsigned;

import io.jsonwebtoken.*;

import java.time.Instant;
import java.util.Date;
import java.util.List;

public class UnsignedJwtCreator {

public UnsignedJwtCreator() {
// explicit
}

public String create() {
return Jwts.builder()
.claim("roles", List.of("admin"))
.setSubject("jjwt")
.setId("jjwt-0")
.setIssuedAt(Date.from(Instant.now()))
.setNotBefore(Date.from(Instant.now()))
.compact();
}

public Jwt<Header, Claims> read(String jwt) {
final JwtParser jwtParser = Jwts.parserBuilder()
.requireSubject("jjwt")
.build();

return jwtParser.parseClaimsJwt(jwt);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module io.jsonwebtoken.jjwt.it.unsigned {
requires io.jsonwebtoken.jjwt.api;

}