java—记住我的功能在springboot中不起作用,Cookie不会生成

xpszyzbs  于 2021-07-03  发布在  Java
关注(0)|答案(0)|浏览(272)

我在demo by java方法教程中尝试过它,它在那里工作过……但是这里面临的问题是它不能生成任何cookie……请帮助我,我尝试了大约3到4天……请帮助我,提前谢谢
这是checkbox name=“记住我”

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    private JwtAuthenticationProvider jwtAuthenticationProvider;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable()
        .authorizeRequests()
        .antMatchers("/","/login","/new-pwd", "/fp","/cfp", "/fph","/terms-conditions").permitAll()
        .anyRequest().authenticated() 
        .and()
            .rememberMe()
            .rememberMeParameter("remember-me")
            .rememberMeCookieName("remember-me")
            .tokenValiditySeconds(24 * 60 * 60)
        .and().exceptionHandling().accessDeniedPage("/login")
        .and().exceptionHandling().authenticationEntryPoint(new CognitoAuthenticationEntryPoint())
        .and().addFilterBefore(new JWTLoginFilter("/doLogin", authenticationManager()), UsernamePasswordAuthenticationFilter.class)
        .addFilterBefore(new JWTAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);

      }

 @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception{
      auth.authenticationProvider(jwtAuthenticationProvider);
    }

    @Override
    public void configure(WebSecurity web) throws Exception {
        web
           .ignoring()
           .antMatchers("/jwks.json","/jwks.json","/.pdf","/.pdf", "/terms-conditions","/resources/**", "/static/**", "/css/**", "/js/**", "/images/**","/resources/**", "/static/**", "/css/**", "/js/**", "/images/**");
    }
}```

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题