Skip to content

Commit 29bb491

Browse files
committed
Add Nullability to spring-security-data
Closes gh-17789
1 parent d9210c6 commit 29bb491

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

data/spring-security-data.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
plugins {
2+
id 'security-nullability'
3+
}
4+
15
apply plugin: 'io.spring.convention.spring-module'
26

37
dependencies {

data/src/main/java/org/springframework/security/data/repository/query/SecurityEvaluationContextExtension.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import org.springframework.security.core.context.SecurityContextHolder;
3030
import org.springframework.security.core.context.SecurityContextHolderStrategy;
3131
import org.springframework.util.Assert;
32+
import org.jspecify.annotations.Nullable;
33+
import org.jspecify.annotations.NullUnmarked;
3234

3335
/**
3436
* <p>
@@ -93,7 +95,7 @@ public class SecurityEvaluationContextExtension implements EvaluationContextExte
9395
private SecurityContextHolderStrategy securityContextHolderStrategy = SecurityContextHolder
9496
.getContextHolderStrategy();
9597

96-
private Authentication authentication;
98+
private @Nullable Authentication authentication;
9799

98100
private AuthenticationTrustResolver trustResolver = new AuthenticationTrustResolverImpl();
99101

@@ -146,7 +148,7 @@ public void setSecurityContextHolderStrategy(SecurityContextHolderStrategy secur
146148
this.securityContextHolderStrategy = securityContextHolderStrategy;
147149
}
148150

149-
private Authentication getAuthentication() {
151+
private @Nullable Authentication getAuthentication() {
150152
if (this.authentication != null) {
151153
return this.authentication;
152154
}

0 commit comments

Comments
 (0)