我似乎找不到配置上的问题,为什么没有生成remember-me cookie。唯一被创建的cookie是JSESSIONID。我注意到,当我去"/"路径时,未经认证,它已经创建了一个空的内容记住我的cookie。
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/", "/public/**").permitAll()
.antMatchers("/users/**").hasAuthority("ADMIN")
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.failureUrl("/login?error")
.usernameParameter("e" + "mail")
.permitAll()
.and()
.logout()
.logoutUrl("/logout")
.deleteCookies("remember-me")
.logoutSuccessUrl("/")
.permitAll()
.and()
.rememberMe()
.rememberMeCookieName("remember-me");
}
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.userDetailsService(userDetailsService)
.passwordEncoder(new BCryptPasswordEncoder());
}
StackOverflow:https://stackoverflow.com/questions/68216577/remember-me-cookie-not-being-created-using-userdetailsservice