@@ -168,7 +168,7 @@ public Verification withArrayClaim(String name, Integer... items) throws Illegal
168
168
requireClaim (name , items );
169
169
return this ;
170
170
}
171
-
171
+
172
172
/**
173
173
* Require a specific Array Claim to contain at least the given items.
174
174
*
@@ -178,11 +178,11 @@ public Verification withArrayClaim(String name, Integer... items) throws Illegal
178
178
* @throws IllegalArgumentException if the name is null.
179
179
*/
180
180
@ Override
181
- public Verification withArrayClaim (String name , Long ... items ) throws IllegalArgumentException {
181
+ public Verification withArrayClaim (String name , Long ... items ) throws IllegalArgumentException {
182
182
assertNonNull (name );
183
183
requireClaim (name , items );
184
184
return this ;
185
- }
185
+ }
186
186
187
187
@ Override
188
188
public JWTVerifier build () {
@@ -220,7 +220,7 @@ private void addLeewayToDateClaims() {
220
220
if (!claims .containsKey (PublicClaims .NOT_BEFORE )) {
221
221
claims .put (PublicClaims .NOT_BEFORE , defaultLeeway );
222
222
}
223
- if (ignoreIssuedAt ) {
223
+ if (ignoreIssuedAt ) {
224
224
claims .remove (PublicClaims .ISSUED_AT );
225
225
return ;
226
226
}
@@ -329,18 +329,18 @@ private void assertValidClaim(Claim claim, String claimName, Object value) {
329
329
Object [] claimAsObject = claim .as (Object [].class );
330
330
331
331
// Jackson uses 'natural' mapping which uses Integer if value fits in 32 bits.
332
- if (value instanceof Long []) {
332
+ if (value instanceof Long []) {
333
333
// convert Integers to Longs for comparison with equals
334
334
claimArr = new ArrayList <>(claimAsObject .length );
335
- for (Object cao : claimAsObject ) {
336
- if (cao instanceof Integer ) {
337
- claimArr .add (((Integer )cao ).longValue ());
335
+ for (Object cao : claimAsObject ) {
336
+ if (cao instanceof Integer ) {
337
+ claimArr .add (((Integer ) cao ).longValue ());
338
338
} else {
339
339
claimArr .add (cao );
340
340
}
341
341
}
342
342
} else {
343
- claimArr = Arrays .asList (claim .as (Object [].class ));
343
+ claimArr = claim . isNull () ? Collections . emptyList () : Arrays .asList (claim .as (Object [].class ));
344
344
}
345
345
List <Object > valueArr = Arrays .asList ((Object []) value );
346
346
isValid = claimArr .containsAll (valueArr );
0 commit comments