From 88a38013bb7721fa4a9f7ff7ffc8b33a925b98df Mon Sep 17 00:00:00 2001 From: "minseok.park" Date: Mon, 10 Mar 2025 08:57:10 +0900 Subject: [PATCH] Add validation for auth checks in AbstractUserDetailsAuthenticationProvider Add assertions to validate that preAuthenticationChecks and postAuthenticationChecks are not null during initialization. This allows errors to be detected earlier in the application lifecycle. Closes PR-16710 Signed-off-by: minseok.park --- .../dao/AbstractUserDetailsAuthenticationProvider.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/org/springframework/security/authentication/dao/AbstractUserDetailsAuthenticationProvider.java b/core/src/main/java/org/springframework/security/authentication/dao/AbstractUserDetailsAuthenticationProvider.java index 71199587ce..d107f9aa22 100644 --- a/core/src/main/java/org/springframework/security/authentication/dao/AbstractUserDetailsAuthenticationProvider.java +++ b/core/src/main/java/org/springframework/security/authentication/dao/AbstractUserDetailsAuthenticationProvider.java @@ -117,6 +117,8 @@ public abstract class AbstractUserDetailsAuthenticationProvider public final void afterPropertiesSet() throws Exception { Assert.notNull(this.userCache, "A user cache must be set"); Assert.notNull(this.messages, "A message source must be set"); + Assert.notNull(this.preAuthenticationChecks, "A pre authentication checks must be set"); + Assert.notNull(this.postAuthenticationChecks, "A post authentication checks must be set"); doAfterPropertiesSet(); }