1
0
mirror of synced 2026-08-05 17:57:15 +00:00

Use UsernameNotFoundException Factory

Issue gh-17179
This commit is contained in:
Josh Cummings
2025-05-28 14:13:02 -06:00
parent da2d9aa868
commit 215547f8c8
6 changed files with 6 additions and 7 deletions
@@ -62,7 +62,7 @@ public class ReactivePreAuthenticatedAuthenticationManager implements ReactiveAu
.filter(this::supports)
.map(Authentication::getName)
.flatMap(this.userDetailsService::findByUsername)
.switchIfEmpty(Mono.error(() -> new UsernameNotFoundException("User not found")))
.switchIfEmpty(Mono.error(() -> UsernameNotFoundException.fromUsername(authentication.getName())))
.doOnNext(this.userDetailsChecker::check)
.map((userDetails) -> {
PreAuthenticatedAuthenticationToken result = new PreAuthenticatedAuthenticationToken(userDetails,