Skip to content

Commit 84459bc

Browse files
committed
X509
1 parent 92f43dc commit 84459bc

11 files changed

Lines changed: 205 additions & 22 deletions

File tree

lib/src/main/java/com/auth0/jwt/algorithms/Algorithm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ public String toString() {
385385
*/
386386
public abstract void verify(DecodedJWT jwt, EncodeType encodeType) throws Exception;
387387

388-
public abstract void verifyWithX509(DecodedJWT jwt, EncodeType encodeType, String jwksFile, String pemFile) throws Exception;
388+
public abstract void verifyWithX509(DecodedJWT jwt, String jwksFile, String pemFile) throws Exception;
389389

390390
/**
391391
* Sign the given content using this Algorithm instance.

lib/src/main/java/com/auth0/jwt/algorithms/ECDSAAlgorithm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void verify(DecodedJWT jwt, EncodeType encodeType) throws Exception {
115115
}
116116

117117
@Override
118-
public void verifyWithX509(DecodedJWT jwt, EncodeType encodeType, String jwksFile, String pemFile) throws Exception {
118+
public void verifyWithX509(DecodedJWT jwt, String jwksFile, String pemFile) throws Exception {
119119
throw new UnsupportedOperationException("X509 is not supported for ECDSA");
120120
}
121121

lib/src/main/java/com/auth0/jwt/algorithms/HMACAlgorithm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public void verify(DecodedJWT jwt, EncodeType encodeType) throws Exception {
100100
}
101101

102102
@Override
103-
public void verifyWithX509(DecodedJWT jwt, EncodeType encodeType, String jwksFile, String pemFile) throws Exception {
103+
public void verifyWithX509(DecodedJWT jwt, String jwksFile, String pemFile) throws Exception {
104104
throw new UnsupportedOperationException("X509 is not supported for HMAC");
105105
}
106106

lib/src/main/java/com/auth0/jwt/algorithms/NoneAlgorithm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void verify(DecodedJWT jwt, EncodeType encodeType) throws Exception {
6060
}
6161

6262
@Override
63-
public void verifyWithX509(DecodedJWT jwt, EncodeType encodeType, String jwksFile, String pemFile) throws Exception {
63+
public void verifyWithX509(DecodedJWT jwt, String jwksFile, String pemFile) throws Exception {
6464
throw new UnsupportedOperationException("X509 is not supported for None algorithm");
6565
}
6666

lib/src/main/java/com/auth0/jwt/algorithms/RSAAlgorithm.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.auth0.jwk.JwkProvider;
2424
import com.auth0.jwk.UrlJwkProvider;
2525
import com.auth0.jwt.creators.EncodeType;
26+
import com.auth0.jwt.creators.JWTCreator;
2627
import com.auth0.jwt.exceptions.SignatureGenerationException;
2728
import com.auth0.jwt.exceptions.SignatureVerificationException;
2829
import com.auth0.jwt.interfaces.DecodedJWT;
@@ -63,8 +64,8 @@ class RSAAlgorithm extends Algorithm {
6364
}
6465

6566
@Override
66-
public void verifyWithX509(DecodedJWT jwt, EncodeType encodeType, String jwksFile, String pemFile) throws Exception {
67-
List<byte[]> byteArrayList = decode(jwt, encodeType);
67+
public void verifyWithX509(DecodedJWT jwt, String jwksFile, String pemFile) throws Exception {
68+
List<byte[]> byteArrayList = fetchContentAndSignatureByteArrays(jwt, JWTCreator.Builder.encodeTypeStatic);
6869
byte[] contentBytes = byteArrayList.get(0);
6970
byte[] signatureBytes = byteArrayList.get(1);
7071
try {
@@ -103,7 +104,7 @@ public void verifyWithX509(DecodedJWT jwt, EncodeType encodeType, String jwksFil
103104

104105
@Override
105106
public void verify(DecodedJWT jwt, EncodeType encodeType) throws Exception {
106-
List<byte[]> byteArrayList = decode(jwt, encodeType);
107+
List<byte[]> byteArrayList = fetchContentAndSignatureByteArrays(jwt, encodeType);
107108
byte[] contentBytes = byteArrayList.get(0);
108109
byte[] signatureBytes = byteArrayList.get(1);
109110
try {
@@ -120,7 +121,7 @@ public void verify(DecodedJWT jwt, EncodeType encodeType) throws Exception {
120121
}
121122
}
122123

123-
private List<byte[]> decode(DecodedJWT jwt, EncodeType encodeType) throws Exception{
124+
private List<byte[]> fetchContentAndSignatureByteArrays(DecodedJWT jwt, EncodeType encodeType) throws Exception{
124125
byte[] contentBytes = String.format("%s.%s", jwt.getHeader(), jwt.getPayload()).getBytes(StandardCharsets.UTF_8);
125126
byte[] signatureBytes = null;
126127
String signature = jwt.getSignature();

lib/src/main/java/com/auth0/jwt/creators/JWTCreator.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,16 @@
2929
import com.fasterxml.jackson.databind.MapperFeature;
3030
import com.fasterxml.jackson.databind.ObjectMapper;
3131
import com.fasterxml.jackson.databind.module.SimpleModule;
32-
import org.apache.commons.codec.Encoder;
3332
import org.apache.commons.codec.binary.Base32;
3433
import org.apache.commons.codec.binary.Base64;
3534
import org.apache.commons.codec.binary.Hex;
36-
import org.apache.commons.codec.binary.StringUtils;
3735

3836
import java.io.*;
39-
import java.net.URLDecoder;
4037
import java.net.URLEncoder;
4138
import java.nio.charset.StandardCharsets;
42-
import java.util.Arrays;
4339
import java.util.Date;
4440
import java.util.HashMap;
4541
import java.util.Map;
46-
import java.util.logging.Logger;
4742

4843
/**
4944
* The JWTCreator class holds the sign method to generate a complete JWT (with Signature) from a given Header and Payload content.
@@ -87,6 +82,7 @@ public static class Builder {
8782
private final Map<String, Object> payloadClaims;
8883
private Map<String, Object> headerClaims;
8984
private boolean isNoneAlgorithmAllowed;
85+
public static EncodeType encodeTypeStatic = null;
9086

9187
Builder() {
9288
this.payloadClaims = new HashMap<>();
@@ -379,12 +375,15 @@ public String sign(Algorithm algorithm, EncodeType encodeType) throws Exception
379375
switch (encodeType) {
380376
case Base16:
381377
token = jwtCreator.signBase16Encoding();
378+
encodeTypeStatic = EncodeType.Base16;
382379
break;
383380
case Base32:
384381
token = jwtCreator.signBase32Encoding();
382+
encodeTypeStatic = EncodeType.Base32;
385383
break;
386384
case Base64:
387385
token = jwtCreator.defaultSign();
386+
encodeTypeStatic = EncodeType.Base64;
388387
break;
389388
}
390389

lib/src/main/java/com/auth0/jwt/jwts/JWT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public DecodedJWT decode(String token) throws Exception {
8181
public DecodedJWT decodeWithX509(String token, String jwksFile, String pemFile) throws Exception {
8282
DecodedJWT jwt = new JWTDecoder(token, EncodeType.Base64);
8383
VerificationAndAssertion.verifyAlgorithm(jwt, algorithm);
84-
algorithm.verifyWithX509(jwt, EncodeType.Base64, jwksFile, pemFile);
84+
algorithm.verifyWithX509(jwt, jwksFile, pemFile);
8585
VerificationAndAssertion.verifyClaims(clock, jwt, claims);
8686
return jwt;
8787
}
@@ -121,7 +121,7 @@ public DecodedJWT decode16Bytes(String token) throws Exception {
121121
public DecodedJWT decode16BytesWithX509(String token, String jwksFile, String pemFile) throws Exception {
122122
DecodedJWT jwt = new JWTDecoder(token, EncodeType.Base16);
123123
VerificationAndAssertion.verifyAlgorithm(jwt, algorithm);
124-
algorithm.verifyWithX509(jwt, EncodeType.Base16, jwksFile, pemFile);
124+
algorithm.verifyWithX509(jwt, jwksFile, pemFile);
125125
VerificationAndAssertion.verifyClaims(clock, jwt, claims);
126126
return jwt;
127127
}
@@ -161,7 +161,7 @@ public DecodedJWT decode32Bytes(String token) throws Exception {
161161
public DecodedJWT decode32BytesWithX509(String token, String jwksFile, String pemFile) throws Exception {
162162
DecodedJWT jwt = new JWTDecoder(token, EncodeType.Base32);
163163
VerificationAndAssertion.verifyAlgorithm(jwt, algorithm);
164-
algorithm.verifyWithX509(jwt, EncodeType.Base32, jwksFile, pemFile);
164+
algorithm.verifyWithX509(jwt, jwksFile, pemFile);
165165
VerificationAndAssertion.verifyClaims(clock, jwt, claims);
166166
return jwt;
167167
}

lib/src/test/java/com/auth0/jwt/creators/JWTCreatorTest.java

Lines changed: 151 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.auth0.jwt.PemUtils;
2424
import com.auth0.jwt.TokenUtils;
2525
import com.auth0.jwt.algorithms.Algorithm;
26+
import com.auth0.jwt.exceptions.SignatureVerificationException;
2627
import com.auth0.jwt.interfaces.DecodedJWT;
2728
import com.auth0.jwt.interfaces.ECDSAKeyProvider;
2829
import com.auth0.jwt.interfaces.RSAKeyProvider;
@@ -49,6 +50,15 @@
4950
public class JWTCreatorTest {
5051

5152
private static final String PRIVATE_KEY_FILE_RSA = "src/test/resources/rsa-private-base16-64.pem";
53+
private static final String PUBLIC_KEY_FILE_RSA = "src/test/resources/rsa-public-base16-64.pem";
54+
private static final String PRIVATE_KEY_FILE = "src/test/resources/rsa-private.pem";
55+
private static final String PUBLIC_KEY_FILE = "src/test/resources/rsa-public.pem";
56+
private static final String PUBLIC_KEY_FILE_INVALID = "src/test/resources/rsa-public_invalid.pem";
57+
private static final String PRIVATE_KEY_FILE_PKCS8 = "./src/test/resources/example_key_pcks8.pem";
58+
private static final String PEM_FILE = "./src/main/java/com/auth0/jwt/algorithms/jwks.pem";
59+
private static final String JWKS_FILE = "./jwksRSA.json";
60+
private static final String JWKS_FILE_ANOTHER_EXAMPLE = "./src/test/resources/example_jwk.json";
61+
private static final String INVALID_JWKS_FILE = "./jwksRSA.doc";
5262
private static final String PRIVATE_KEY_FILE_EC_256 = "src/test/resources/ec256-key-private.pem";
5363

5464
@Rule
@@ -119,8 +129,79 @@ public void shouldAddKeyIdIfAvailableFromRSAAlgorithmsForBase16() throws Excepti
119129
.sign(algorithm, EncodeType.Base16);
120130

121131
JWT jwt = JWT.require(Algorithm.RSA256(provider)).withIssuer("auth0").build();
122-
DecodedJWT decoded = jwt.decode16BytesWithX509(signed,"./jwksRSA.json", "./src/main/java/com/auth0/jwt/algorithms/jwks.pem");
123-
algorithm.verifyWithX509(decoded, EncodeType.Base16,"./jwksRSA.json", "./src/main/java/com/auth0/jwt/algorithms/jwks.pem");
132+
DecodedJWT decoded = jwt.decode16BytesWithX509(signed, JWKS_FILE, PEM_FILE);
133+
}
134+
135+
@Test
136+
public void shouldAddKeyIdIfAvailableFromRSAAlgorithmsForBase16NotAProperJwksFile() throws Exception {
137+
exception.expect(IllegalArgumentException.class);
138+
exception.expectMessage("Not a proper jwks file");
139+
RSAPrivateKey privateKey = (RSAPrivateKey) PemUtils.readPrivateKeyFromFile(PRIVATE_KEY_FILE_RSA, "RSA");
140+
RSAKeyProvider provider = mock(RSAKeyProvider.class);
141+
when(provider.getPrivateKeyId()).thenReturn("8RGoVdVjD8fItyR3FFo0hVNaZYtPGwoP6xKi9e_V7bI");
142+
when(provider.getPrivateKey()).thenReturn(privateKey);
143+
Algorithm algorithm = Algorithm.RSA256(provider);
144+
145+
String signed = JWTCreator.init()
146+
.withKeyId("8RGoVdVjD8fItyR3FFo0hVNaZYtPGwoP6xKi9e_V7bI")
147+
.withIssuer("auth0")
148+
.sign(algorithm, EncodeType.Base16);
149+
150+
JWT jwt = JWT.require(Algorithm.RSA256(provider)).withIssuer("auth0").build();
151+
DecodedJWT decoded = jwt.decode16BytesWithX509(signed, INVALID_JWKS_FILE, PEM_FILE);
152+
}
153+
154+
@Test
155+
public void shouldAddKeyIdIfAvailableFromRSAAlgorithmsForBase16UsingRolandKeys() throws Exception {
156+
RSAPrivateKey privateKey = (RSAPrivateKey) PemUtils.readPrivateKeyFromFile(PRIVATE_KEY_FILE_PKCS8, "RSA");
157+
RSAKeyProvider provider = mock(RSAKeyProvider.class);
158+
when(provider.getPrivateKeyId()).thenReturn("dnVrY0tQcUZCUWh2T25EaVk3Q0ZLRW9VdnRxU0tiUHNiVkVGS3k1V1Jidw");
159+
when(provider.getPrivateKey()).thenReturn(privateKey);
160+
Algorithm algorithm = Algorithm.RSA256(provider);
161+
162+
String signed = JWTCreator.init()
163+
.withKeyId("dnVrY0tQcUZCUWh2T25EaVk3Q0ZLRW9VdnRxU0tiUHNiVkVGS3k1V1Jidw")
164+
.withIssuer("auth0")
165+
.sign(algorithm, EncodeType.Base16);
166+
167+
JWT jwt = JWT.require(Algorithm.RSA256(provider)).withIssuer("auth0").build();
168+
DecodedJWT decoded = jwt.decode16BytesWithX509(signed, JWKS_FILE_ANOTHER_EXAMPLE, PUBLIC_KEY_FILE_RSA);
169+
}
170+
171+
@Test
172+
public void shouldAddKeyIdIfAvailableFromRSAAlgorithmsForBase16UsingAuth0Keys() throws Exception {
173+
RSAPrivateKey privateKey = (RSAPrivateKey) PemUtils.readPrivateKeyFromFile(PRIVATE_KEY_FILE, "RSA");
174+
RSAKeyProvider provider = mock(RSAKeyProvider.class);
175+
when(provider.getPrivateKeyId()).thenReturn("8RGoVdVjD8fItyR3FFo0hVNaZYtPGwoP6xKi9e_V7bI");
176+
when(provider.getPrivateKey()).thenReturn(privateKey);
177+
Algorithm algorithm = Algorithm.RSA256(provider);
178+
179+
String signed = JWTCreator.init()
180+
.withKeyId("8RGoVdVjD8fItyR3FFo0hVNaZYtPGwoP6xKi9e_V7bI")
181+
.withIssuer("auth0")
182+
.sign(algorithm, EncodeType.Base16);
183+
184+
JWT jwt = JWT.require(Algorithm.RSA256(provider)).withIssuer("auth0").build();
185+
DecodedJWT decoded = jwt.decode16BytesWithX509(signed, JWKS_FILE, PUBLIC_KEY_FILE);
186+
}
187+
188+
@Test
189+
public void shouldAddKeyIdIfAvailableFromRSAAlgorithmsForBase16UsingAuth0KeysInvalidSignatureVerification() throws Exception {
190+
exception.expect(SignatureVerificationException.class);
191+
exception.expectMessage("The Token's Signature resulted invalid when verified using the Algorithm: SHA256withRSA");
192+
RSAPrivateKey privateKey = (RSAPrivateKey) PemUtils.readPrivateKeyFromFile(PRIVATE_KEY_FILE, "RSA");
193+
RSAKeyProvider provider = mock(RSAKeyProvider.class);
194+
when(provider.getPrivateKeyId()).thenReturn("8RGoVdVjD8fItyR3FFo0hVNaZYtPGwoP6xKi9e_V7bI");
195+
when(provider.getPrivateKey()).thenReturn(privateKey);
196+
Algorithm algorithm = Algorithm.RSA256(provider);
197+
198+
String signed = JWTCreator.init()
199+
.withKeyId("8RGoVdVjD8fItyR3FFo0hVNaZYtPGwoP6xKi9e_V7bI")
200+
.withIssuer("auth0")
201+
.sign(algorithm, EncodeType.Base16);
202+
203+
JWT jwt = JWT.require(Algorithm.RSA256(provider)).withIssuer("auth0").build();
204+
DecodedJWT decoded = jwt.decode16BytesWithX509(signed, JWKS_FILE, PUBLIC_KEY_FILE_INVALID);
124205
}
125206

126207
@Test
@@ -137,10 +218,42 @@ public void shouldAddKeyIdIfAvailableFromRSAAlgorithmsForBase32() throws Excepti
137218
.sign(algorithm, EncodeType.Base32);
138219

139220
JWT jwt = JWT.require(Algorithm.RSA256(provider)).withIssuer("auth0").build();
140-
DecodedJWT decoded = jwt.decode32BytesWithX509(signed, "./jwksRSA.json", "./src/main/java/com/auth0/jwt/algorithms/jwks.pem");
141-
algorithm.verifyWithX509(decoded, EncodeType.Base32,"./jwksRSA.json", "./src/main/java/com/auth0/jwt/algorithms/jwks.pem");
221+
DecodedJWT decoded = jwt.decode32BytesWithX509(signed, JWKS_FILE, PEM_FILE);
222+
}
223+
224+
@Test
225+
public void shouldAddKeyIdIfAvailableFromRSAAlgorithmsForBase32UsingRolandKeys() throws Exception {
226+
RSAPrivateKey privateKey = (RSAPrivateKey) PemUtils.readPrivateKeyFromFile(PRIVATE_KEY_FILE_PKCS8, "RSA");
227+
RSAKeyProvider provider = mock(RSAKeyProvider.class);
228+
when(provider.getPrivateKeyId()).thenReturn("dnVrY0tQcUZCUWh2T25EaVk3Q0ZLRW9VdnRxU0tiUHNiVkVGS3k1V1Jidw");
229+
when(provider.getPrivateKey()).thenReturn(privateKey);
230+
Algorithm algorithm = Algorithm.RSA256(provider);
231+
232+
String signed = JWTCreator.init()
233+
.withKeyId("dnVrY0tQcUZCUWh2T25EaVk3Q0ZLRW9VdnRxU0tiUHNiVkVGS3k1V1Jidw")
234+
.withIssuer("auth0")
235+
.sign(algorithm, EncodeType.Base32);
236+
237+
JWT jwt = JWT.require(Algorithm.RSA256(provider)).withIssuer("auth0").build();
238+
DecodedJWT decoded = jwt.decode32BytesWithX509(signed, JWKS_FILE_ANOTHER_EXAMPLE, PUBLIC_KEY_FILE_RSA);
142239
}
143240

241+
@Test
242+
public void shouldAddKeyIdIfAvailableFromRSAAlgorithmsForBase32UsingAuth0Keys() throws Exception {
243+
RSAPrivateKey privateKey = (RSAPrivateKey) PemUtils.readPrivateKeyFromFile(PRIVATE_KEY_FILE, "RSA");
244+
RSAKeyProvider provider = mock(RSAKeyProvider.class);
245+
when(provider.getPrivateKeyId()).thenReturn("8RGoVdVjD8fItyR3FFo0hVNaZYtPGwoP6xKi9e_V7bI");
246+
when(provider.getPrivateKey()).thenReturn(privateKey);
247+
Algorithm algorithm = Algorithm.RSA256(provider);
248+
249+
String signed = JWTCreator.init()
250+
.withKeyId("8RGoVdVjD8fItyR3FFo0hVNaZYtPGwoP6xKi9e_V7bI")
251+
.withIssuer("auth0")
252+
.sign(algorithm, EncodeType.Base32);
253+
254+
JWT jwt = JWT.require(Algorithm.RSA256(provider)).withIssuer("auth0").build();
255+
DecodedJWT decoded = jwt.decode32BytesWithX509(signed, JWKS_FILE, PUBLIC_KEY_FILE);
256+
}
144257
@Test
145258
public void shouldAddKeyIdIfAvailableFromRSAAlgorithmsForBase64() throws Exception {
146259
RSAPrivateKey privateKey = (RSAPrivateKey) PemUtils.readPrivateKeyFromFile(PRIVATE_KEY_FILE_RSA, "RSA");
@@ -160,10 +273,42 @@ public void shouldAddKeyIdIfAvailableFromRSAAlgorithmsForBase64() throws Excepti
160273
JWT jwt = JWT.require(Algorithm.RSA256(provider)).withIssuer("https://agaton-sax.com/")
161274
.withNonStandardClaim("foo","bar")
162275
.withNonStandardClaim("kit", "kat").build();
163-
DecodedJWT decoded = jwt.decodeWithX509(signed, "./jwksRSA.json", "./src/main/java/com/auth0/jwt/algorithms/jwks.pem");
164-
algorithm.verifyWithX509(decoded, EncodeType.Base64, "./jwksRSA.json", "./src/main/java/com/auth0/jwt/algorithms/jwks.pem");
276+
DecodedJWT decoded = jwt.decodeWithX509(signed, JWKS_FILE, PEM_FILE);
277+
}
278+
279+
@Test
280+
public void shouldAddKeyIdIfAvailableFromRSAAlgorithmsForBase64UsingRolandKeys() throws Exception {
281+
RSAPrivateKey privateKey = (RSAPrivateKey) PemUtils.readPrivateKeyFromFile(PRIVATE_KEY_FILE_PKCS8, "RSA");
282+
RSAKeyProvider provider = mock(RSAKeyProvider.class);
283+
when(provider.getPrivateKeyId()).thenReturn("dnVrY0tQcUZCUWh2T25EaVk3Q0ZLRW9VdnRxU0tiUHNiVkVGS3k1V1Jidw");
284+
when(provider.getPrivateKey()).thenReturn(privateKey);
285+
Algorithm algorithm = Algorithm.RSA256(provider);
286+
287+
String signed = JWTCreator.init()
288+
.withKeyId("dnVrY0tQcUZCUWh2T25EaVk3Q0ZLRW9VdnRxU0tiUHNiVkVGS3k1V1Jidw")
289+
.withIssuer("auth0")
290+
.sign(algorithm, EncodeType.Base64);
291+
292+
JWT jwt = JWT.require(Algorithm.RSA256(provider)).withIssuer("auth0").build();
293+
DecodedJWT decoded = jwt.decodeWithX509(signed, JWKS_FILE_ANOTHER_EXAMPLE, PUBLIC_KEY_FILE_RSA);
165294
}
166295

296+
@Test
297+
public void shouldAddKeyIdIfAvailableFromRSAAlgorithmsForBase64UsingAuth0Keys() throws Exception {
298+
RSAPrivateKey privateKey = (RSAPrivateKey) PemUtils.readPrivateKeyFromFile(PRIVATE_KEY_FILE, "RSA");
299+
RSAKeyProvider provider = mock(RSAKeyProvider.class);
300+
when(provider.getPrivateKeyId()).thenReturn("8RGoVdVjD8fItyR3FFo0hVNaZYtPGwoP6xKi9e_V7bI");
301+
when(provider.getPrivateKey()).thenReturn(privateKey);
302+
Algorithm algorithm = Algorithm.RSA256(provider);
303+
304+
String signed = JWTCreator.init()
305+
.withKeyId("8RGoVdVjD8fItyR3FFo0hVNaZYtPGwoP6xKi9e_V7bI")
306+
.withIssuer("auth0")
307+
.sign(algorithm, EncodeType.Base64);
308+
309+
JWT jwt = JWT.require(Algorithm.RSA256(provider)).withIssuer("auth0").build();
310+
DecodedJWT decoded = jwt.decodeWithX509(signed, JWKS_FILE, PUBLIC_KEY_FILE);
311+
}
167312

168313
@Test
169314
public void shouldNotOverwriteKeyIdIfAddedFromRSAAlgorithms() throws Exception {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"keys":[{"kty": "RSA", "use": "sig", "kid": "dnVrY0tQcUZCUWh2T25EaVk3Q0ZLRW9VdnRxU0tiUHNiVkVGS3k1V1Jidw", "n": "sZI5mt1nKLpbtab8wDx65B8-tgDOAiJ0oGi8VwvPpZcanlA1hBEoGol49j1CCj7mhidrFss5kDB9xMPSY51NXf3Fj6kB6VpNEG5JWPhYXcIrCXE9-9tSdvSAdpqCSD3pjgRdCrkP3OV23gF-LdYIaplLXWyOV8XNkyodW52bw5KQbXHMFqn4dDFq3IY7WSRQs5OJMKWcGMl7sdNH6aoevdBE-sRR5rHVGS2W1TH6Zjz9BA408-S3tvHWTeAceFAmwlOCNj63hBpx-u88GyLc1Q5Ta0IRdbnZFtK7DjYjtaiR36CZlyUKeNvfqH2BTl34WhTJmqEIXiiIlTECZ8424w", "e": "AQAB", "x5c": ["MIIDLjCCAhagAwIBAgIURpHFbC1b+Z8ILtRD+W54wunTh5AwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCU0UxDTALBgNVBAcMBFVtZWExEjAQBgNVBAoMCUNhdGFsb2dpeDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTE3MTIyMDIyNTExOFoXDTE3MTIzMDIyNTExOFowRDELMAkGA1UEBhMCU0UxDTALBgNVBAcMBFVtZWExEjAQBgNVBAoMCUNhdGFsb2dpeDESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsZI5mt1nKLpbtab8wDx65B8+tgDOAiJ0oGi8VwvPpZcanlA1hBEoGol49j1CCj7mhidrFss5kDB9xMPSY51NXf3Fj6kB6VpNEG5JWPhYXcIrCXE9+9tSdvSAdpqCSD3pjgRdCrkP3OV23gF+LdYIaplLXWyOV8XNkyodW52bw5KQbXHMFqn4dDFq3IY7WSRQs5OJMKWcGMl7sdNH6aoevdBE+sRR5rHVGS2W1TH6Zjz9BA408+S3tvHWTeAceFAmwlOCNj63hBpx+u88GyLc1Q5Ta0IRdbnZFtK7DjYjtaiR36CZlyUKeNvfqH2BTl34WhTJmqEIXiiIlTECZ8424wIDAQABoxgwFjAUBgNVHREEDTALgglsb2NhbGhvc3QwDQYJKoZIhvcNAQELBQADggEBAA/3G++KM8jV9M/Qsn+wiVjGcF0mmjKOzpNFPP6qolGhQ72Y/abm18Wd9WMhm0U96kYvvj+lD+iW4YZsdqh6M1fP4i00tW5ZwecbNKfOgi0xRqqR3ID6w9tn/E/eN21xkNnFrmgr6ORV4h41nxRZoroJRtj7Dqg83eH6uyxxHEWApiuwbHOll1xXoQHFXv6h1/ZA5clFlmnvgzTUguBY80tIXD2j+gvMHvp5TqFqzPzqShbmOgAVAht3C4bnVLysW2ts7qde186WurSiWK185MfWijW0glD1sN2hDwkArbGCewbSNtkW0bk998z9rcyM9pZiZ8+iFa2ar97Sh1zyBpU="]}]}

0 commit comments

Comments
 (0)