diff --git a/api/pom.xml b/api/pom.xml index fac58aa6e..156d0b319 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 35e458e27..1677ab9bf 100644 --- a/extensions/gson/pom.xml +++ b/extensions/gson/pom.xml @@ -53,4 +53,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 469789f61..dcfa00fea 100644 --- a/extensions/jackson/pom.xml +++ b/extensions/jackson/pom.xml @@ -69,4 +69,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 5d9da307f..da6bd1e76 100644 --- a/extensions/orgjson/pom.xml +++ b/extensions/orgjson/pom.xml @@ -69,4 +69,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 4d10f5581..b2980da7b 100644 --- a/impl/pom.xml +++ b/impl/pom.xml @@ -68,4 +68,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 9827e61e6..f24d52242 100644 --- a/pom.xml +++ b/pom.xml @@ -103,6 +103,7 @@ 1.6 0.13.1 1.6.1 + 1.0.0.RC2 4.2.rc3 true @@ -555,8 +556,6 @@ maven-compiler-plugin ${maven.compiler.version} - ${jdk.version} - ${jdk.version} ${project.build.sourceEncoding} @@ -667,6 +666,11 @@ coveralls-maven-plugin 4.4.1 + + org.moditect + moditect-maven-plugin + ${moditect.version} + @@ -734,6 +738,9 @@ -html5 ${test.addOpens}, --illegal-access=debug + + integration-tests + jdk17AndLater