@Override
    public Mono<Boolean> confirmPassword(String username, String rawPassword) {
        return getUser(username)
            .filter(user -> {
                if (!StringUtils.hasText(user.getSpec().getPassword())) {
                    // If the password is not set, return true directly.
                    return true;
                }
                if (!StringUtils.hasText(rawPassword)) {
                    return false;
                }
                return passwordEncoder.matches(rawPassword, user.getSpec().getPassword());
            })
            .hasElement();
    }
@Test
    void confirmPasswordWhenPasswordNotSet() {
        var user = new User();
        user.setSpec(new User.UserSpec());
        when(client.get(User.class, "fake-user")).thenReturn(Mono.just(user));
        userService.confirmPassword("fake-user", "fake-password")
            .as(StepVerifier::create)
            .expectNext(true)
            .verifyComplete();

        user.getSpec().setPassword("");
        userService.confirmPassword("fake-user", "fake-password")
            .as(StepVerifier::create)
            .expectNext(true)
            .verifyComplete();
    }