1
0
mirror of synced 2026-08-23 02:27:44 +00:00

Validate Parameter in setPostAuthenticationChecks

The null check in setPostAuthenticationChecks of
AbstractUserDetailsReactiveAuthenticationManager asserted the current
field value, which is initialized to a default and can never be null,
instead of the method parameter. As a result, null was silently
accepted and the next authenticate call failed with a raw
NullPointerException instead of failing fast with a clear message.

Closes gh-19276

Signed-off-by: dae won <eodnjs01477@gmail.com>
This commit is contained in:
dae won
2026-06-07 04:28:59 +09:00
committed by Josh Cummings
parent 65a1099ccb
commit 5b923c78ea
2 changed files with 7 additions and 1 deletions
@@ -184,7 +184,7 @@ public abstract class AbstractUserDetailsReactiveAuthenticationManager
* @since 5.2
*/
public void setPostAuthenticationChecks(UserDetailsChecker postAuthenticationChecks) {
Assert.notNull(this.postAuthenticationChecks, "postAuthenticationChecks cannot be null");
Assert.notNull(postAuthenticationChecks, "postAuthenticationChecks cannot be null");
this.postAuthenticationChecks = postAuthenticationChecks;
}
@@ -90,6 +90,12 @@ public class UserDetailsRepositoryReactiveAuthenticationManagerTests {
assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> this.manager.setScheduler(null));
}
@Test
public void setPostAuthenticationChecksWhenNullThenIllegalArgumentException() {
assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> this.manager.setPostAuthenticationChecks(null));
}
@Test
public void authenticateWhenCustomSchedulerThenUsed() {
given(this.scheduler.schedule(any())).willAnswer((a) -> {