Skip to content

Commit

Permalink
update audience validation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyjames committed Nov 29, 2023
1 parent 8fd8ca0 commit 4a539e6
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions lib/src/main/java/com/auth0/jwt/JWTVerifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -368,17 +368,11 @@ private boolean assertValidAudienceClaim(
List<String> expectedAudience,
boolean shouldContainAll
) {
if (actualAudience == null && expectedAudience == null) {
return true;
} else if (actualAudience == null || expectedAudience == null) {
if (actualAudience == null || expectedAudience == null) {
return false;
}

if (shouldContainAll) {
// containsAll([]) always returns true
if (expectedAudience.isEmpty() && !actualAudience.isEmpty()) {
return false;
}
return actualAudience.containsAll(expectedAudience);
} else {
return !Collections.disjoint(actualAudience, expectedAudience);
Expand Down

0 comments on commit 4a539e6

Please sign in to comment.