我似乎找不到为什么不生成“记住我”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());
}
暂无答案!
目前还没有任何答案,快来回答吧!