diff --git a/api/pom.xml b/api/pom.xml index 61667e7a9..aba3f5def 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -50,4 +50,41 @@ - \ No newline at end of file + + + nonJDK7 + + [1.8,) + + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + + + io.jsonwebtoken.jjwt.api + + io.jsonwebtoken; + io.jsonwebtoken.*; + + + + + + + + + + + + + diff --git a/extensions/gson/pom.xml b/extensions/gson/pom.xml index 6b6985e83..21333a497 100644 --- a/extensions/gson/pom.xml +++ b/extensions/gson/pom.xml @@ -44,4 +44,37 @@ - \ No newline at end of file + + + nonJDK7 + + [1.8,) + + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + + + io.jsonwebtoken.jjwt.ext.gson + + + + + + + + + + + + diff --git a/extensions/jackson/pom.xml b/extensions/jackson/pom.xml index 79b0959ab..fde25ba8a 100644 --- a/extensions/jackson/pom.xml +++ b/extensions/jackson/pom.xml @@ -77,4 +77,37 @@ - \ No newline at end of file + + + + nonJDK7 + + [1.8,) + + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + + + io.jsonwebtoken.jjwt.ext.jackson + + + + + + + + + + + diff --git a/extensions/orgjson/pom.xml b/extensions/orgjson/pom.xml index f0ea88409..894bb9d7b 100644 --- a/extensions/orgjson/pom.xml +++ b/extensions/orgjson/pom.xml @@ -77,4 +77,37 @@ - \ No newline at end of file + + + + nonJDK7 + + [1.8,) + + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + + + io.jsonwebtoken.jjwt.ext.orgjson + + + + + + + + + + + diff --git a/impl/pom.xml b/impl/pom.xml index b1aaf92e1..f9c753cdf 100644 --- a/impl/pom.xml +++ b/impl/pom.xml @@ -66,4 +66,44 @@ - \ No newline at end of file + + + nonJDK7 + + [1.8,) + + + + + org.moditect + moditect-maven-plugin + + + add-module-infos + package + + add-module-info + + + + + io.jsonwebtoken.jjwt.impl + + io.jsonwebtoken.jjwt.api; + + + io.jsonwebtoken.CompressionCodec; + io.jsonwebtoken.io.Deserializer; + io.jsonwebtoken.io.Serializer; + + + + + + + + + + + + diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml new file mode 100644 index 000000000..e41ba0562 --- /dev/null +++ b/integration-tests/pom.xml @@ -0,0 +1,25 @@ + + + 4.0.0 + + + io.jsonwebtoken + jjwt-root + 0.11.3-SNAPSHOT + + + jjwt-integration-tests + JJWT :: Integration-Tests + pom + + + true + + + + unsigned-jackson + + + diff --git a/integration-tests/unsigned-jackson/pom.xml b/integration-tests/unsigned-jackson/pom.xml new file mode 100644 index 000000000..b69f264cf --- /dev/null +++ b/integration-tests/unsigned-jackson/pom.xml @@ -0,0 +1,70 @@ + + + 4.0.0 + + + io.jsonwebtoken + jjwt-integration-tests + 0.11.3-SNAPSHOT + + + jjwt-integration-tests-unsigned-jackson + JJWT :: Integration-Tests :: unsigned-jackson + Create and parse an unsigned JWT using Jackson and JPMS. + jar + + + 9 + true + + + + + io.jsonwebtoken + jjwt-api + + + io.jsonwebtoken + jjwt-impl + 0.11.3-SNAPSHOT + runtime + + + io.jsonwebtoken + jjwt-jackson + runtime + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + true + false + + + + + org.apache.felix + maven-bundle-plugin + + + bundle-manifest + none + + + + + + + diff --git a/integration-tests/unsigned-jackson/src/main/java/io/jsonwebtoken/it/unsigned/UnsignedJwtCreator.java b/integration-tests/unsigned-jackson/src/main/java/io/jsonwebtoken/it/unsigned/UnsignedJwtCreator.java new file mode 100644 index 000000000..6f3740f15 --- /dev/null +++ b/integration-tests/unsigned-jackson/src/main/java/io/jsonwebtoken/it/unsigned/UnsignedJwtCreator.java @@ -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 read(String jwt) { + final JwtParser jwtParser = Jwts.parserBuilder() + .requireSubject("jjwt") + .build(); + + return jwtParser.parseClaimsJwt(jwt); + } +} diff --git a/integration-tests/unsigned-jackson/src/main/java/module-info.java b/integration-tests/unsigned-jackson/src/main/java/module-info.java new file mode 100644 index 000000000..71d5b72a0 --- /dev/null +++ b/integration-tests/unsigned-jackson/src/main/java/module-info.java @@ -0,0 +1,4 @@ +module io.jsonwebtoken.jjwt.it.unsigned { + requires io.jsonwebtoken.jjwt.api; + +} diff --git a/integration-tests/unsigned-jackson/src/main/resources/META-INF/MANIFEST.MF b/integration-tests/unsigned-jackson/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 000000000..e69de29bb diff --git a/integration-tests/unsigned-jackson/src/test/java/io/jsonwebtoken/it/unsigned/UnsignedJwtCreatorTest.java b/integration-tests/unsigned-jackson/src/test/java/io/jsonwebtoken/it/unsigned/UnsignedJwtCreatorTest.java new file mode 100644 index 000000000..a651c4b43 --- /dev/null +++ b/integration-tests/unsigned-jackson/src/test/java/io/jsonwebtoken/it/unsigned/UnsignedJwtCreatorTest.java @@ -0,0 +1,31 @@ +package io.jsonwebtoken.it.unsigned; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Header; +import io.jsonwebtoken.Jwt; +import org.junit.Test; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + + +public class UnsignedJwtCreatorTest { + + @Test + public void testUnsignedJwt() { + // given: + final UnsignedJwtCreator jwtCreator = new UnsignedJwtCreator(); + final String jwtString = jwtCreator.create(); + + // when + final Jwt readBackJwt = jwtCreator.read(jwtString); + + // then + final Claims jwtBody = readBackJwt.getBody(); + assertEquals("jjwt-0", jwtBody.getId()); + assertEquals("jjwt", jwtBody.getSubject()); + assertTrue(jwtBody.get("roles", List.class).contains("admin")); + } + +} diff --git a/pom.xml b/pom.xml index fe2bea294..e935f0e2b 100644 --- a/pom.xml +++ b/pom.xml @@ -69,6 +69,7 @@ 3.8.0 3.1.1 1.6.1 + 1.0.0.RC2 1.7 UTF-8 @@ -251,9 +252,6 @@ org.apache.maven.plugins maven-javadoc-plugin 2.10.4 - - ${jdk.version} - jdk9AndLater [1.9,) + + integration-tests + --add-opens java.base/jdk.internal.loader=ALL-UNNAMED + ${jdk.version}