Помните меня, userDetailsService получает (com.example. User@45029325) -Springboot с Thymeleaf - PullRequest
0 голосов
/ 05 мая 2020

Я могу войти с установленным remember me. Как только я закрываю браузер и снова открываю ту же страницу, возникает проблема. Ниже приведены блоки кода

    //Login page
    <form th:action="@{/login}" method="post" id="login">
     <input type="checkbox" id="remember-me" name="remember-me" />
    public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
      ...

      @Override
      public void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.authenticationProvider(customAuthProvider);

      }
      @Override
      protected void configure(HttpSecurity http) throws Exception { 
              ....
             .rememberMe()
                .rememberMeCookieName("example-app-remember-me")
                .tokenValiditySeconds(24 * 60 * 60).userDetailsService(userDetailsService)
      }
    }

UserDetailsServiceImpl:

 public class UserDetailsServiceImpl implements UserDetailsService {
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
               //Printing username is com.example.User@45029325
 }  

Поскольку имя пользователя печатается неправильно при закрытии и повторном открытии браузера, я не смог найти пользователя по имени пользователя .

Могу я получить информацию для решения этой проблемы.

Спасибо.

...