Skip to content

Commit

Permalink
refactor aud claim logic - no functional changes
Browse files Browse the repository at this point in the history
refactor aud claim logic to make it more readable and easier to update. No functional changes.
  • Loading branch information
jimmyjames committed Nov 28, 2023
1 parent bad6035 commit b8235d7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/src/main/java/com/auth0/jwt/JWTVerifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,17 @@ private boolean assertInstantIsLessThanOrEqualToNow(Instant claimVal, long leewa
}

private boolean assertValidAudienceClaim(
List<String> audience,
List<String> values,
List<String> actualAudience,
List<String> expectedAudience,
boolean shouldContainAll
) {
return !(audience == null || (shouldContainAll && !audience.containsAll(values))
|| (!shouldContainAll && Collections.disjoint(audience, values)));
if (actualAudience == null) {
return false;
} else if (shouldContainAll) {
return actualAudience.containsAll(expectedAudience);
} else {
return !Collections.disjoint(actualAudience, expectedAudience);
}
}

private void assertPositive(long leeway) {
Expand Down

0 comments on commit b8235d7

Please sign in to comment.