mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-11-10 11:39:02 +00:00
Clarify Nullability in Granted Authority Lambda
Issue gh-17999
This commit is contained in:
parent
9b61533db2
commit
0a2f55d485
@ -18,7 +18,9 @@ package org.springframework.security.authorization;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.security.core.Authentication;
|
||||
@ -48,7 +50,7 @@ public class AuthorityReactiveAuthorizationManager<T> implements ReactiveAuthori
|
||||
// @formatter:off
|
||||
return authentication.filter(Authentication::isAuthenticated)
|
||||
.flatMapIterable(Authentication::getAuthorities)
|
||||
.mapNotNull(GrantedAuthority::getAuthority)
|
||||
.mapNotNull((Function<GrantedAuthority, @Nullable String>) GrantedAuthority::getAuthority)
|
||||
.any((grantedAuthority) -> this.authorities.stream().anyMatch((authority) -> Objects.equals(authority.getAuthority(), grantedAuthority)))
|
||||
.map((granted) -> ((AuthorizationResult) new AuthorityAuthorizationDecision(granted, this.authorities)))
|
||||
.defaultIfEmpty(new AuthorityAuthorizationDecision(false, this.authorities));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user