Call to j_spring_security_logout not working

前端 未结 6 1245
滥情空心
滥情空心 2020-12-16 11:52

I\'m trying to setup the logut of my application with j_spring_security_logout but for some reason it\'s not working, I keep getting a 404 error.

I\'m calling the fu

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-16 12:08

    In JAVA-BASED Spring MVC config, you have to configure it in your security config class:

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        super.configure(http);
        http.servletApi().rolePrefix("");
        http
          .logout()
              .logoutRequestMatcher(new AntPathRequestMatcher("/logout"));
    }
    

    This answer is doubled from, and is working on my case: Spring Security Java Config not generating logout url

提交回复
热议问题