mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-11-10 19:48:50 +00:00
Add Nullable Annotations
Added Nullable to methods that may return a null value Closes gh-18046
This commit is contained in:
parent
63f28a7e1f
commit
5662e17370
@ -58,7 +58,7 @@ public class RequestAttributeAuthenticationFilter extends AbstractPreAuthenticat
|
|||||||
* missing and {@code exceptionIfVariableMissing} is set to {@code true}.
|
* missing and {@code exceptionIfVariableMissing} is set to {@code true}.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
|
protected @Nullable Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
|
||||||
String principal = (String) request.getAttribute(this.principalEnvironmentVariable);
|
String principal = (String) request.getAttribute(this.principalEnvironmentVariable);
|
||||||
if (principal == null && this.exceptionIfVariableMissing) {
|
if (principal == null && this.exceptionIfVariableMissing) {
|
||||||
throw new PreAuthenticatedCredentialsNotFoundException(
|
throw new PreAuthenticatedCredentialsNotFoundException(
|
||||||
@ -73,7 +73,7 @@ public class RequestAttributeAuthenticationFilter extends AbstractPreAuthenticat
|
|||||||
* credentials value. Otherwise a dummy value will be used.
|
* credentials value. Otherwise a dummy value will be used.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Object getPreAuthenticatedCredentials(HttpServletRequest request) {
|
protected @Nullable Object getPreAuthenticatedCredentials(HttpServletRequest request) {
|
||||||
if (this.credentialsEnvironmentVariable != null) {
|
if (this.credentialsEnvironmentVariable != null) {
|
||||||
return request.getAttribute(this.credentialsEnvironmentVariable);
|
return request.getAttribute(this.credentialsEnvironmentVariable);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,7 +59,7 @@ public class RequestHeaderAuthenticationFilter extends AbstractPreAuthenticatedP
|
|||||||
* {@code exceptionIfHeaderMissing} is set to {@code true}.
|
* {@code exceptionIfHeaderMissing} is set to {@code true}.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
|
protected @Nullable Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
|
||||||
String principal = request.getHeader(this.principalRequestHeader);
|
String principal = request.getHeader(this.principalRequestHeader);
|
||||||
if (principal == null && this.exceptionIfHeaderMissing) {
|
if (principal == null && this.exceptionIfHeaderMissing) {
|
||||||
throw new PreAuthenticatedCredentialsNotFoundException(
|
throw new PreAuthenticatedCredentialsNotFoundException(
|
||||||
@ -74,7 +74,7 @@ public class RequestHeaderAuthenticationFilter extends AbstractPreAuthenticatedP
|
|||||||
* will be used.
|
* will be used.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Object getPreAuthenticatedCredentials(HttpServletRequest request) {
|
protected @Nullable Object getPreAuthenticatedCredentials(HttpServletRequest request) {
|
||||||
if (this.credentialsRequestHeader != null) {
|
if (this.credentialsRequestHeader != null) {
|
||||||
return request.getHeader(this.credentialsRequestHeader);
|
return request.getHeader(this.credentialsRequestHeader);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user