Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protect against NPE #1858

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
Expand Down Expand Up @@ -71,10 +72,7 @@ public static boolean verify(SignedJWT jwt, JWKSet jwkSet, JwkValidator jwkValid
* @return whether this signature configuration supports this algorithm
*/
public static boolean supports(JWSAlgorithm algorithm, JWKSet jwkSet) {
return jwkSet.getKeys()
.stream()
.map(JWK::getAlgorithm)
.anyMatch(algorithm::equals);
return supports(algorithm, jwkSet.getKeys());
}

/**
Expand All @@ -88,6 +86,7 @@ public static boolean supports(JWSAlgorithm algorithm, List<JWK> keys) {
return keys
.stream()
.map(JWK::getAlgorithm)
.filter(Objects::nonNull)
.anyMatch(algorithm::equals);
}

Expand All @@ -106,6 +105,7 @@ public static String supportedAlgorithmsMessage(JWKSet jwkSet) {
public static String supportedAlgorithmsMessage(List<JWK> keys) {
return keys.stream()
.map(JWK::getAlgorithm)
.filter(Objects::nonNull)
.map(Algorithm::getName)
.distinct()
.reduce((a, b) -> a + ", " + b)
Expand Down
Loading