mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-10-22 02:08:48 +00:00
Add Nullability to spring-security-data
Closes gh-17789
This commit is contained in:
parent
d9210c6596
commit
29bb4919ca
@ -1,3 +1,7 @@
|
|||||||
|
plugins {
|
||||||
|
id 'security-nullability'
|
||||||
|
}
|
||||||
|
|
||||||
apply plugin: 'io.spring.convention.spring-module'
|
apply plugin: 'io.spring.convention.spring-module'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -29,6 +29,8 @@ import org.springframework.security.core.context.SecurityContext;
|
|||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.security.core.context.SecurityContextHolderStrategy;
|
import org.springframework.security.core.context.SecurityContextHolderStrategy;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
import org.jspecify.annotations.Nullable;
|
||||||
|
import org.jspecify.annotations.NullUnmarked;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -93,7 +95,7 @@ public class SecurityEvaluationContextExtension implements EvaluationContextExte
|
|||||||
private SecurityContextHolderStrategy securityContextHolderStrategy = SecurityContextHolder
|
private SecurityContextHolderStrategy securityContextHolderStrategy = SecurityContextHolder
|
||||||
.getContextHolderStrategy();
|
.getContextHolderStrategy();
|
||||||
|
|
||||||
private Authentication authentication;
|
private @Nullable Authentication authentication;
|
||||||
|
|
||||||
private AuthenticationTrustResolver trustResolver = new AuthenticationTrustResolverImpl();
|
private AuthenticationTrustResolver trustResolver = new AuthenticationTrustResolverImpl();
|
||||||
|
|
||||||
@ -146,7 +148,7 @@ public class SecurityEvaluationContextExtension implements EvaluationContextExte
|
|||||||
this.securityContextHolderStrategy = securityContextHolderStrategy;
|
this.securityContextHolderStrategy = securityContextHolderStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Authentication getAuthentication() {
|
private @Nullable Authentication getAuthentication() {
|
||||||
if (this.authentication != null) {
|
if (this.authentication != null) {
|
||||||
return this.authentication;
|
return this.authentication;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user