2121
2222import static com .auth0 .jwt .TimeUtil .generateRandomExpDateInFuture ;
2323import static com .auth0 .jwt .TimeUtil .generateRandomIatDateInPast ;
24- import static com .auth0 .jwt .creators .GoogleJwtCreatorTest .NAME ;
2524import static com .auth0 .jwt .creators .GoogleJwtCreatorTest .verifyClaims ;
2625import static java .util .Arrays .asList ;
2726
@@ -61,11 +60,11 @@ public void testExtendedJwtCreatorAllStandardClaimsMustBeRequired() throws Excep
6160 .withAudience (Constants .AUDIENCE )
6261 .withExp (exp )
6362 .withIat (iat )
64- .withName (NAME )
63+ .withName (Constants . NAME )
6564 .sign (algorithm );
6665 GoogleVerification verification = ExtendedJWT .require (algorithm );
6766 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
68- NAME , 1 , 1 , 1 ).build ();
67+ Constants . NAME , 1 , 1 , 1 ).build ();
6968 DecodedJWT jwt = verifier .decode (token );
7069 Map <String , Claim > claims = jwt .getClaims ();
7170 verifyClaims (claims , exp );
@@ -83,11 +82,11 @@ public void testExtendedJwtCreatorBase16Encoding() throws Exception {
8382 .withAudience (Constants .AUDIENCE )
8483 .withExp (exp )
8584 .withIat (iat )
86- .withName (NAME )
85+ .withName (Constants . NAME )
8786 .signBase16Encoding (algorithm );
8887 GoogleVerification verification = ExtendedJWT .require (algorithm );
8988 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
90- NAME , 1 , 1 , 1 ).build ();
89+ Constants . NAME , 1 , 1 , 1 ).build ();
9190 DecodedJWT jwt = verifier .decode16Bytes (token );
9291 Map <String , Claim > claims = jwt .getClaims ();
9392 verifyClaims (claims , exp );
@@ -105,11 +104,11 @@ public void testExtendedJwtCreatorBase32Encoding() throws Exception {
105104 .withAudience (Constants .AUDIENCE )
106105 .withExp (exp )
107106 .withIat (iat )
108- .withName (NAME )
107+ .withName (Constants . NAME )
109108 .signBase32Encoding (algorithm );
110109 GoogleVerification verification = ExtendedJWT .require (algorithm );
111110 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
112- NAME , 1 , 1 , 1 ).build ();
111+ Constants . NAME , 1 , 1 , 1 ).build ();
113112 DecodedJWT jwt = verifier .decode32Bytes (token );
114113 Map <String , Claim > claims = jwt .getClaims ();
115114 verifyClaims (claims , exp );
@@ -129,11 +128,11 @@ public void testExtendedJwtCreatorInvalidIssuer() throws Exception {
129128 .withAudience (Constants .AUDIENCE )
130129 .withExp (exp )
131130 .withIat (iat )
132- .withName (NAME )
131+ .withName (Constants . NAME )
133132 .sign (algorithm );
134133 GoogleVerification verification = ExtendedJWT .require (algorithm );
135134 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
136- NAME , 1 , 1 , 1 ).build ();
135+ Constants . NAME , 1 , 1 , 1 ).build ();
137136 DecodedJWT jwt = verifier .decode (token );
138137 }
139138
@@ -151,11 +150,11 @@ public void testExtendedJwtCreatorInvalidPicture() throws Exception {
151150 .withAudience (Constants .AUDIENCE )
152151 .withExp (exp )
153152 .withIat (iat )
154- .withName (NAME )
153+ .withName (Constants . NAME )
155154 .sign (algorithm );
156155 GoogleVerification verification = ExtendedJWT .require (algorithm );
157156 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
158- NAME , 1 , 1 , 1 ).build ();
157+ Constants . NAME , 1 , 1 , 1 ).build ();
159158 DecodedJWT jwt = verifier .decode (token );
160159 }
161160
@@ -173,11 +172,11 @@ public void testExtendedJwtCreatorInvalidEmail() throws Exception {
173172 .withAudience (Constants .AUDIENCE )
174173 .withExp (exp )
175174 .withIat (iat )
176- .withName (NAME )
175+ .withName (Constants . NAME )
177176 .sign (algorithm );
178177 GoogleVerification verification = ExtendedJWT .require (algorithm );
179178 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
180- NAME , 1 , 1 , 1 ).build ();
179+ Constants . NAME , 1 , 1 , 1 ).build ();
181180 DecodedJWT jwt = verifier .decode (token );
182181 Map <String , Claim > claims = jwt .getClaims ();
183182 verifyClaims (claims , exp );
@@ -197,11 +196,11 @@ public void testExtendedJwtCreatorInvalidAudience() throws Exception {
197196 .withAudience ("invalid" )
198197 .withExp (exp )
199198 .withIat (iat )
200- .withName (NAME )
199+ .withName (Constants . NAME )
201200 .sign (algorithm );
202201 GoogleVerification verification = ExtendedJWT .require (algorithm );
203202 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
204- NAME , 1 , 1 , 1 ).build ();
203+ Constants . NAME , 1 , 1 , 1 ).build ();
205204 DecodedJWT jwt = verifier .decode (token );
206205 Map <String , Claim > claims = jwt .getClaims ();
207206 verifyClaims (claims , exp );
@@ -225,7 +224,7 @@ public void testExtendedJwtCreatorInvalidName() throws Exception {
225224 .sign (algorithm );
226225 GoogleVerification verification = ExtendedJWT .require (algorithm );
227226 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
228- NAME , 1 , 1 , 1 ).build ();
227+ Constants . NAME , 1 , 1 , 1 ).build ();
229228 DecodedJWT jwt = verifier .decode (token );
230229 Map <String , Claim > claims = jwt .getClaims ();
231230 verifyClaims (claims , exp );
@@ -246,13 +245,13 @@ public void testExtendedJwtCreatorNoneAlgorithmNotAllowed() throws Exception {
246245 .withAudience (Constants .AUDIENCE )
247246 .withExp (exp )
248247 .withIat (iat )
249- .withName (NAME )
248+ .withName (Constants . NAME )
250249 .setIsNoneAlgorithmAllowed (false )
251250 .sign (algorithm );
252251
253252 GoogleVerification verification = ExtendedJWT .require (algorithm );
254253 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
255- NAME , 1 , 1 , 1 ).build ();
254+ Constants . NAME , 1 , 1 , 1 ).build ();
256255 DecodedJWT jwt = verifier .decode (token );
257256 }
258257
@@ -271,13 +270,13 @@ public void testExtendedJwtCreatorNoneAlgorithmNotSpecifiedButStillNotAllowed()
271270 .withAudience (Constants .AUDIENCE )
272271 .withExp (exp )
273272 .withIat (iat )
274- .withName (NAME )
273+ .withName (Constants . NAME )
275274 .setIsNoneAlgorithmAllowed (false )
276275 .sign (algorithm );
277276
278277 GoogleVerification verification = ExtendedJWT .require (algorithm );
279278 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
280- NAME , 1 , 1 , 1 ).build ();
279+ Constants . NAME , 1 , 1 , 1 ).build ();
281280 DecodedJWT jwt = verifier .decode (token );
282281 }
283282
@@ -293,13 +292,13 @@ public void testExtendedJwtCreatorNoneAlgorithmAllowed() throws Exception {
293292 .withAudience (Constants .AUDIENCE )
294293 .withExp (exp )
295294 .withIat (iat )
296- .withName (NAME )
295+ .withName (Constants . NAME )
297296 .setIsNoneAlgorithmAllowed (true )
298297 .sign (algorithm );
299298
300299 GoogleVerification verification = ExtendedJWT .require (algorithm );
301300 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
302- NAME , 1 , 1 , 1 ).build ();
301+ Constants . NAME , 1 , 1 , 1 ).build ();
303302 DecodedJWT jwt = verifier .decode (token );
304303 Map <String , Claim > claims = jwt .getClaims ();
305304 verifyClaims (claims , exp );
@@ -317,13 +316,13 @@ public void testExtendedJwtCreatorNonStandardClaimStringValue() throws Exception
317316 .withAudience (Constants .AUDIENCE )
318317 .withExp (exp )
319318 .withIat (iat )
320- .withName (NAME )
319+ .withName (Constants . NAME )
321320 .withNonStandardClaim ("nonStandardClaim" , "nonStandardClaimValue" )
322321 .sign (algorithm );
323322
324323 GoogleVerification verification = ExtendedJWT .require (algorithm );
325324 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
326- NAME , 1 , 1 , 1 ).build ();
325+ Constants . NAME , 1 , 1 , 1 ).build ();
327326 DecodedJWT jwt = verifier .decode (token );
328327 }
329328
@@ -339,13 +338,13 @@ public void testExtendedJwtCreatorNonStandardClaimIntegerValue() throws Exceptio
339338 .withAudience (Constants .AUDIENCE )
340339 .withExp (exp )
341340 .withIat (iat )
342- .withName (NAME )
341+ .withName (Constants . NAME )
343342 .withNonStandardClaim ("nonStandardClaim" , 999 )
344343 .sign (algorithm );
345344
346345 GoogleVerification verification = ExtendedJWT .require (algorithm );
347346 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
348- NAME , 1 , 1 , 1 ).build ();
347+ Constants . NAME , 1 , 1 , 1 ).build ();
349348 DecodedJWT jwt = verifier .decode (token );
350349 }
351350
@@ -361,13 +360,13 @@ public void testExtendedJwtCreatorNonStandardClaimLongValue() throws Exception {
361360 .withAudience (Constants .AUDIENCE )
362361 .withExp (exp )
363362 .withIat (iat )
364- .withName (NAME )
363+ .withName (Constants . NAME )
365364 .withNonStandardClaim ("nonStandardClaim" , 999L )
366365 .sign (algorithm );
367366
368367 GoogleVerification verification = ExtendedJWT .require (algorithm );
369368 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
370- NAME , 1 , 1 , 1 ).build ();
369+ Constants . NAME , 1 , 1 , 1 ).build ();
371370 DecodedJWT jwt = verifier .decode (token );
372371 }
373372
@@ -383,13 +382,13 @@ public void testExtendedJwtCreatorNonStandardClaimDoubleValue() throws Exception
383382 .withAudience (Constants .AUDIENCE )
384383 .withExp (exp )
385384 .withIat (iat )
386- .withName (NAME )
385+ .withName (Constants . NAME )
387386 .withNonStandardClaim ("nonStandardClaim" , 9.99 )
388387 .sign (algorithm );
389388
390389 GoogleVerification verification = ExtendedJWT .require (algorithm );
391390 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
392- NAME , 1 , 1 , 1 ).build ();
391+ Constants . NAME , 1 , 1 , 1 ).build ();
393392 DecodedJWT jwt = verifier .decode (token );
394393 }
395394
@@ -405,13 +404,13 @@ public void testExtendedJwtCreatorNonStandardClaimBooleanValue() throws Exceptio
405404 .withAudience (Constants .AUDIENCE )
406405 .withExp (exp )
407406 .withIat (iat )
408- .withName (NAME )
407+ .withName (Constants . NAME )
409408 .withNonStandardClaim ("nonStandardClaim" , true )
410409 .sign (algorithm );
411410
412411 GoogleVerification verification = ExtendedJWT .require (algorithm );
413412 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
414- NAME , 1 , 1 , 1 ).build ();
413+ Constants . NAME , 1 , 1 , 1 ).build ();
415414 DecodedJWT jwt = verifier .decode (token );
416415 }
417416
@@ -427,13 +426,13 @@ public void testExtendedJwtCreatorNonStandardClaimDateValue() throws Exception {
427426 .withAudience (Constants .AUDIENCE )
428427 .withExp (exp )
429428 .withIat (iat )
430- .withName (NAME )
429+ .withName (Constants . NAME )
431430 .withNonStandardClaim ("nonStandardClaim" , new Date ())
432431 .sign (algorithm );
433432
434433 GoogleVerification verification = ExtendedJWT .require (algorithm );
435434 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
436- NAME , 1 , 1 , 1 ).build ();
435+ Constants . NAME , 1 , 1 , 1 ).build ();
437436 DecodedJWT jwt = verifier .decode (token );
438437 }
439438
@@ -458,13 +457,13 @@ public void testExtendedJwtCreatorExpTimeHasPassed() throws Exception {
458457 .withAudience (Constants .AUDIENCE )
459458 .withExp (expDate )
460459 .withIat (iat )
461- .withName (NAME )
460+ .withName (Constants . NAME )
462461 .withNonStandardClaim ("nonStandardClaim" , new Date ())
463462 .sign (algorithm );
464463
465464 GoogleVerification verification = ExtendedJWT .require (algorithm );
466465 JWT verifier = verification .createVerifierForExtended (Constants .PICTURE , Constants .EMAIL , asList (Constants .ISSUER ), asList (Constants .AUDIENCE ),
467- NAME , 1 , 1 , 1 ).build ();
466+ Constants . NAME , 1 , 1 , 1 ).build ();
468467 DecodedJWT jwt = verifier .decode (token );
469468 }
470469}
0 commit comments