From dc086da2e200922774ab286e6cfcc949c7762a50 Mon Sep 17 00:00:00 2001 From: tanya732 Date: Fri, 31 Jan 2025 15:00:18 +0530 Subject: [PATCH 1/3] upgraded java-jwt plugin --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 5791291..8d8b25f 100644 --- a/build.gradle +++ b/build.gradle @@ -126,7 +126,7 @@ dependencies { implementation 'commons-codec:commons-codec:1.15' api 'com.auth0:auth0:1.45.1' - api 'com.auth0:java-jwt:3.19.4' + api 'com.auth0:java-jwt:4.5.0' api 'com.auth0:jwks-rsa:0.22.1' testImplementation 'org.bouncycastle:bcprov-jdk15on:1.64' From 2ee0da88c9d41e1f24f297d3c58d5a87b4569d4c Mon Sep 17 00:00:00 2001 From: tanya732 Date: Fri, 28 Feb 2025 07:44:35 +0530 Subject: [PATCH 2/3] updated the artifact version to v4 --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 5d43230..b480018 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -22,7 +22,7 @@ jobs: - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d with: flags: unittests - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: Reports path: lib/build/reports From d5aef0918d6d8e6123feead6755d6f849f288a08 Mon Sep 17 00:00:00 2001 From: tanya732 Date: Fri, 21 Mar 2025 09:21:32 +0530 Subject: [PATCH 3/3] upgraded other dependencies --- build.gradle | 15 +++++++------- .../java/com/auth0/SignatureVerifierTest.java | 20 +++++++++++++------ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 8d8b25f..c19ad8d 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { dependencies { // https://github.com/melix/japicmp-gradle-plugin/issues/36 - classpath 'com.google.guava:guava:31.1-jre' + classpath 'com.google.guava:guava:32.0.1-jre' } } @@ -121,21 +121,20 @@ test { dependencies { implementation 'javax.servlet:javax.servlet-api:3.1.0' - implementation 'org.apache.commons:commons-lang3:3.12.0' - implementation 'com.google.guava:guava-annotations:r03' + implementation 'org.apache.commons:commons-lang3:3.13.0' + implementation 'com.google.guava:guava:32.0.1-jre' implementation 'commons-codec:commons-codec:1.15' api 'com.auth0:auth0:1.45.1' api 'com.auth0:java-jwt:4.5.0' api 'com.auth0:jwks-rsa:0.22.1' - testImplementation 'org.bouncycastle:bcprov-jdk15on:1.64' - testImplementation 'org.hamcrest:java-hamcrest:2.0.0.0' - testImplementation 'org.hamcrest:hamcrest-core:1.3' - testImplementation 'org.mockito:mockito-core:2.8.9' + testImplementation 'org.hamcrest:hamcrest:2.2' + testImplementation 'org.mockito:mockito-core:4.8.1' testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1' testImplementation 'org.springframework:spring-test:4.3.14.RELEASE' - testImplementation 'com.squareup.okhttp3:okhttp:4.11.0' + testImplementation 'com.squareup.okhttp3:okhttp:4.12.0' + testImplementation "com.squareup.okio:okio:3.5.0" } apply from: rootProject.file('gradle/maven-publish.gradle') diff --git a/src/test/java/com/auth0/SignatureVerifierTest.java b/src/test/java/com/auth0/SignatureVerifierTest.java index 326387f..b0b6678 100644 --- a/src/test/java/com/auth0/SignatureVerifierTest.java +++ b/src/test/java/com/auth0/SignatureVerifierTest.java @@ -4,9 +4,9 @@ import com.auth0.jwk.JwkException; import com.auth0.jwk.JwkProvider; import com.auth0.jwt.interfaces.DecodedJWT; -import org.bouncycastle.util.io.pem.PemReader; import org.junit.jupiter.api.Test; +import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; @@ -18,6 +18,7 @@ import java.security.interfaces.RSAPublicKey; import java.security.spec.EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; +import java.util.Base64; import java.util.Scanner; import static org.hamcrest.CoreMatchers.notNullValue; @@ -146,7 +147,7 @@ private JwkProvider getRSProvider(String rsaPath) throws Exception { private static RSAPublicKey readPublicKeyFromFile(final String path) throws IOException { Scanner scanner = null; - PemReader pemReader = null; + BufferedReader reader = null; try { scanner = new Scanner(Paths.get(path)); if (scanner.hasNextLine() && scanner.nextLine().startsWith("-----BEGIN CERTIFICATE-----")) { @@ -157,8 +158,15 @@ private static RSAPublicKey readPublicKeyFromFile(final String path) throws IOEx fs.close(); return (RSAPublicKey) key; } else { - pemReader = new PemReader(new FileReader(path)); - byte[] keyBytes = pemReader.readPemObject().getContent(); + reader = new BufferedReader(new FileReader(path)); + StringBuilder pemContent = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + if (!line.startsWith("-----BEGIN") && !line.startsWith("-----END")) { + pemContent.append(line); + } + } + byte[] keyBytes = Base64.getDecoder().decode(pemContent.toString()); KeyFactory kf = KeyFactory.getInstance("RSA"); EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes); return (RSAPublicKey) kf.generatePublic(keySpec); @@ -169,8 +177,8 @@ private static RSAPublicKey readPublicKeyFromFile(final String path) throws IOEx if (scanner != null) { scanner.close(); } - if (pemReader != null) { - pemReader.close(); + if (reader != null) { + reader.close(); } } }