Skip to content

Commit

Permalink
null checks instead of mutating args
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyjames committed Nov 29, 2023
1 parent dd6215e commit 8fd8ca0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/src/main/java/com/auth0/jwt/JWTVerifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,11 @@ private boolean assertValidAudienceClaim(
List<String> expectedAudience,
boolean shouldContainAll
) {
// normalize to lists if null
actualAudience = actualAudience == null ? Collections.emptyList() : actualAudience;
expectedAudience = expectedAudience == null ? Collections.emptyList() : expectedAudience;
if (actualAudience == null && expectedAudience == null) {
return true;

Check warning on line 372 in lib/src/main/java/com/auth0/jwt/JWTVerifier.java

View check run for this annotation

Codecov / codecov/patch

lib/src/main/java/com/auth0/jwt/JWTVerifier.java#L372

Added line #L372 was not covered by tests
} else if (actualAudience == null || expectedAudience == null) {
return false;
}

if (shouldContainAll) {
// containsAll([]) always returns true
Expand Down

0 comments on commit 8fd8ca0

Please sign in to comment.