Spring Security Java Config not generating logout url

后端 未结 1 2025
陌清茗
陌清茗 2020-12-09 19:01

I am using Spring 4.0.5.RELEASE and Spring Security 3.2.4.

I am trying to create a simple sample app using java config (based on th

相关标签:
1条回答
  • 2020-12-09 19:27

    By default POST request is required to the logout url. To perform logout on GET request you need:

    http
          .logout()
              .logoutRequestMatcher(new AntPathRequestMatcher("/logout"));
    

    Or if you want to support PUT or other method, pass this as a parameter:

    http
          .logout()
              .logoutRequestMatcher(new AntPathRequestMatcher("/logout", "PUT"));
    

    See the Docs: http://docs.spring.io/spring-security/site/docs/3.2.4.RELEASE/reference/htmlsingle/ (section 6.5.3. Logging Out)

    0 讨论(0)
提交回复
热议问题