Formatting as well as adding a missing defer

Issue gh-15699
This commit is contained in:
Josh Cummings
2024-10-07 16:40:22 -06:00
parent 2ca2e56383
commit b26f2af5d5
3 changed files with 12 additions and 7 deletions

View File

@@ -54,7 +54,7 @@ public final class OneTimeTokenReactiveAuthenticationManager implements Reactive
return Mono.empty();
}
return this.oneTimeTokenService.consume(otpAuthenticationToken)
.switchIfEmpty(Mono.error(new InvalidOneTimeTokenException("Invalid token")))
.switchIfEmpty(Mono.defer(() -> Mono.error(new InvalidOneTimeTokenException("Invalid token"))))
.flatMap((consumed) -> this.userDetailsService.findByUsername(consumed.getUsername()))
.map(onSuccess(otpAuthenticationToken));
}