-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[jwtk#519] Add moditect-generated module-info.java files and a simple…
… IT. - uses lots of more profiles - requires Java 8+ for a release - requires Java 9+ for running the integration test - does not deploy integration tests - maven.compiler.release is set instead of source and target for Java9+ - maven.compiler.source/target is now only set on Java7 and Java8 so the javadoc and sources plugin will work correctly. - Does not contain ITs for neither GSON nor org.json. - Ugly workaround for the fact that the old bundle-plugin crashes on Java9+ module-info.java files, had to provide an empty static MANIFEST.MF file and disable the bundle-plugin on ITs. - I found it odd that the extensions do not reference their correct parent pom as parent pom, instead the root is chosen. This is probably a maven anti-pattern and was corrected by khmarbaise for Shiro. - parentLocation = ../pom.xml is redundant for /api and /impl, but did not bother to correct it here - some pom.xml files were missing a final line break as required by unix spec.
- Loading branch information
Showing
12 changed files
with
363 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
32 changes: 32 additions & 0 deletions
32
...-tests/unsigned-jackson/src/main/java/io/jsonwebtoken/it/unsigned/UnsignedJwtCreator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
integration-tests/unsigned-jackson/src/main/java/module-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
} |
Empty file.
31 changes: 31 additions & 0 deletions
31
...ts/unsigned-jackson/src/test/java/io/jsonwebtoken/it/unsigned/UnsignedJwtCreatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Header, Claims> 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")); | ||
} | ||
|
||
} |
Oops, something went wrong.