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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new version metadata for jjwt gson library #596

Open
wants to merge 1 commit 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions metadata/io.jsonwebtoken/jjwt-gson/0.12.6/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
"reflect-config.json",
"resource-config.json"
]
21,221 changes: 21,221 additions & 0 deletions metadata/io.jsonwebtoken/jjwt-gson/0.12.6/reflect-config.json

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions metadata/io.jsonwebtoken/jjwt-gson/0.12.6/resource-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"resources":{
"includes":[{
"pattern":"\\QMETA-INF/dgminfo\\E"
}, {
"pattern":"\\QMETA-INF/groovy/org.codehaus.groovy.runtime.ExtensionModule\\E"
}, {
"pattern":"\\QMETA-INF/services/io.jsonwebtoken.io.Deserializer\\E"
}, {
"pattern":"\\QMETA-INF/services/io.jsonwebtoken.io.Serializer\\E"
}, {
"pattern":"\\QMETA-INF/services/java.lang.System$LoggerFinder\\E"
}, {
"pattern":"\\QMETA-INF/services/java.nio.file.spi.FileSystemProvider\\E"
}, {
"pattern":"\\QMETA-INF/services/java.time.zone.ZoneRulesProvider\\E"
}, {
"pattern":"\\QMETA-INF/services/org.apache.maven.surefire.spi.MasterProcessChannelProcessorFactory\\E"
}, {
"pattern":"\\QMETA-INF/services/org.codehaus.groovy.runtime.ExtensionModule\\E"
}]},
"bundles":[]
}
9 changes: 8 additions & 1 deletion metadata/io.jsonwebtoken/jjwt-gson/index.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
[
{
"latest": true,
"metadata-version": "0.11.5",
"module": "io.jsonwebtoken:jjwt-gson",
"tested-versions": [
"0.11.5"
]
},
{
"latest": true,
"metadata-version": "0.12.6",
"module": "io.jsonwebtoken:jjwt-gson",
"tested-versions": [
"0.12.6"
]
}
]
40 changes: 23 additions & 17 deletions tests/src/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@
"name" : "io.jsonwebtoken:jjwt-gson",
"versions" : [ "0.11.5" ]
} ]
}, {
"test-project-path" : "io.jsonwebtoken/jjwt-gson/0.12.6",
"libraries" : [ {
"name" : "io.jsonwebtoken:jjwt-gson",
"versions" : [ "0.12.6" ]
} ]
}, {
"test-project-path" : "io.jsonwebtoken/jjwt-jackson/0.11.5",
"libraries" : [ {
Expand All @@ -173,28 +179,28 @@
"versions" : [ "2.16.11" ]
} ]
}, {
"test-project-path" : "io.netty/netty-common/4.1.80.Final",
"test-project-path" : "io.netty/netty-common/4.1.115.Final",
"libraries" : [ {
"name" : "io.netty:netty-common",
"versions" : [ "4.1.80.Final" ]
"versions" : [ "4.1.115.Final" ]
} ]
}, {
"test-project-path" : "io.netty/netty-transport/4.1.80.Final",
"test-project-path" : "io.netty/netty-common/4.1.80.Final",
"libraries" : [ {
"name" : "io.netty:netty-transport",
"name" : "io.netty:netty-common",
"versions" : [ "4.1.80.Final" ]
} ]
}, {
"test-project-path" : "io.netty/netty-common/4.1.115.Final",
"test-project-path" : "io.netty/netty-transport/4.1.115.Final",
"libraries" : [ {
"name" : "io.netty:netty-common",
"name" : "io.netty:netty-transport",
"versions" : [ "4.1.115.Final" ]
} ]
}, {
"test-project-path" : "io.netty/netty-transport/4.1.115.Final",
"test-project-path" : "io.netty/netty-transport/4.1.80.Final",
"libraries" : [ {
"name" : "io.netty:netty-transport",
"versions" : [ "4.1.115.Final" ]
"versions" : [ "4.1.80.Final" ]
} ]
}, {
"test-project-path" : "io.opentelemetry/opentelemetry-exporter-jaeger/1.19.0",
Expand Down Expand Up @@ -425,16 +431,16 @@
"versions" : [ "10.15.0" ]
} ]
}, {
"test-project-path": "org.flywaydb/flyway-core/10.20.0",
"libraries": [ {
"name": "org.flywaydb:flyway-core",
"versions": [ "10.20.0" ]
"test-project-path" : "org.flywaydb/flyway-core/10.20.0",
"libraries" : [ {
"name" : "org.flywaydb:flyway-core",
"versions" : [ "10.20.0" ]
} ]
}, {
"test-project-path": "org.flywaydb/flyway-core/10.20.1",
"libraries": [ {
"name": "org.flywaydb:flyway-core",
"versions": [ "10.20.1" ]
"test-project-path" : "org.flywaydb/flyway-core/10.20.1",
"libraries" : [ {
"name" : "org.flywaydb:flyway-core",
"versions" : [ "10.20.1" ]
} ]
}, {
"test-project-path" : "org.flywaydb/flyway-core/9.0.1",
Expand Down Expand Up @@ -664,4 +670,4 @@
"name" : "samples:docker",
"versions" : [ "image-pull" ]
} ]
} ]
} ]
4 changes: 4 additions & 0 deletions tests/src/io.jsonwebtoken/jjwt-gson/0.12.6/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
gradlew.bat
gradlew
gradle/
build/
35 changes: 35 additions & 0 deletions tests/src/io.jsonwebtoken/jjwt-gson/0.12.6/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright and related rights waived via CC0
*
* You should have received a copy of the CC0 legalcode along with this
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/

plugins {
id "org.graalvm.internal.tck"
}

String libraryVersion = tck.testedLibraryVersion.get()

dependencies {
testImplementation "io.jsonwebtoken:jjwt-gson:$libraryVersion"
testImplementation 'org.assertj:assertj-core:3.22.0'
testImplementation "io.jsonwebtoken:jjwt-api:$libraryVersion"
testImplementation "io.jsonwebtoken:jjwt-impl:$libraryVersion"
}

graalvmNative {
agent {
defaultMode = "conditional"
modes {
conditional {
userCodeFilterPath = "user-code-filter.json"
}
}
metadataCopy {
mergeWithExisting = true
inputTaskNames.add("test")
outputDirectories.add("src/test/resources/META-INF/native-image/io.jsonwebtoken/jjwt-gson")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
library.version = 0.12.6
metadata.dir = io.jsonwebtoken/jjwt-gson/0.12.6/
13 changes: 13 additions & 0 deletions tests/src/io.jsonwebtoken/jjwt-gson/0.12.6/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pluginManagement {
def tckPath = Objects.requireNonNullElse(
System.getenv("GVM_TCK_TCKDIR"),
"../../../../tck-build-logic"
)
includeBuild(tckPath)
}

plugins {
id "org.graalvm.internal.tck-settings" version "1.0.0-SNAPSHOT"
}

rootProject.name = 'io.jsonwebtoken.jjwt-gson_tests'
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package io_jsonwebtoken.jjwt_gson;

import io.jsonwebtoken.JwtParserBuilder;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.io.Decoders;
import io.jsonwebtoken.io.Encoders;
import io.jsonwebtoken.security.Keys;
import org.junit.jupiter.api.Test;

import javax.crypto.SecretKey;
import java.util.Date;
import java.util.UUID;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

/**
* @author Oguz Kahraman <[email protected]> 12/02/2025
*/
class Jjwt_gsonTest {

@Test
void testSignedJWTs() {
SecretKey firstKey = Jwts.SIG.HS256.key().build();
String secretString = Encoders.BASE64.encode(firstKey.getEncoded());
SecretKey secondKey = Keys.hmacShaKeyFor(Decoders.BASE64.decode(secretString));
assertThat(Jwts.parser().verifyWith(firstKey).build().parseSignedClaims(
Jwts.builder().subject("Joe").signWith(firstKey).compact()
).getPayload().getSubject()).isEqualTo("Joe");
assertThat(Jwts.parser().verifyWith(secondKey).build().parseSignedClaims(
Jwts.builder().subject("Joe").signWith(secondKey).compact()
).getPayload().getSubject()).isEqualTo("Joe");
}

@Test
void testCreatingAJWS() {
Date firstDate = new Date();
Date secondDate = new Date(System.currentTimeMillis() + 24 * 60 * 60 * 1000L);
String uuidString = UUID.randomUUID().toString();
SecretKey firstKey = Jwts.SIG.HS256.key().build();
String firstCompactJws = Jwts.builder()
.subject("Joe")
.header().add("kid", "myKeyId")
.and()
.issuer("Aaron")
.audience().add("Abel").and()
.expiration(secondDate)
.notBefore(firstDate)
.issuedAt(firstDate)
.id(uuidString)
.claim("exampleClaim", "Adam")
.signWith(firstKey, Jwts.SIG.HS256)
.compact();
JwtParserBuilder jwtParserBuilder = Jwts.parser().clockSkewSeconds(180).verifyWith(firstKey);
assertThat(jwtParserBuilder.build().parseSignedClaims(firstCompactJws).getPayload().getSubject()).isEqualTo("Joe");
assertDoesNotThrow(() -> jwtParserBuilder.requireSubject("Joe").build().parseSignedClaims(firstCompactJws));
assertDoesNotThrow(() -> jwtParserBuilder.requireIssuer("Aaron").build().parseSignedClaims(firstCompactJws));
assertDoesNotThrow(() -> jwtParserBuilder.requireAudience("Abel").build().parseSignedClaims(firstCompactJws));
}

@Test
void testCompression() {
SecretKey firstKey = Jwts.SIG.HS256.key().build();
assertThat(Jwts.parser().verifyWith(firstKey).build().parseSignedClaims(
Jwts.builder().subject("Joe").signWith(firstKey).compact()
).getPayload().getSubject()).isEqualTo("Joe");
assertThat(Jwts.parser().verifyWith(firstKey).build().parseSignedClaims(
Jwts.builder().subject("Joe").signWith(firstKey).compact()
).getPayload().getSubject()).isEqualTo("Joe");
}

}