Skip to content

Commit 0a2f55d

Browse files
committed
Clarify Nullability in Granted Authority Lambda
Issue gh-17999
1 parent 9b61533 commit 0a2f55d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/main/java/org/springframework/security/authorization/AuthorityReactiveAuthorizationManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919
import java.util.List;
2020
import java.util.Objects;
21+
import java.util.function.Function;
2122

23+
import org.jspecify.annotations.Nullable;
2224
import reactor.core.publisher.Mono;
2325

2426
import org.springframework.security.core.Authentication;
@@ -48,7 +50,7 @@ public Mono<AuthorizationResult> authorize(Mono<Authentication> authentication,
4850
// @formatter:off
4951
return authentication.filter(Authentication::isAuthenticated)
5052
.flatMapIterable(Authentication::getAuthorities)
51-
.mapNotNull(GrantedAuthority::getAuthority)
53+
.mapNotNull((Function<GrantedAuthority, @Nullable String>) GrantedAuthority::getAuthority)
5254
.any((grantedAuthority) -> this.authorities.stream().anyMatch((authority) -> Objects.equals(authority.getAuthority(), grantedAuthority)))
5355
.map((granted) -> ((AuthorizationResult) new AuthorityAuthorizationDecision(granted, this.authorities)))
5456
.defaultIfEmpty(new AuthorityAuthorizationDecision(false, this.authorities));

0 commit comments

Comments
 (0)