Logout link with Spring and Thymeleaf

后端 未结 6 1278
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-03 23:23

According with the official example (Secure Web Content), I have to use a form and a button with the aim to perform a logout with Spring Security. Is there a way to use a li

6条回答
  •  悲哀的现实
    2021-01-03 23:48

    The solution (deprecated!) is:

           .logout()
                .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
                    .logoutSuccessUrl("/login");
    

    It is recommended to use POST instead of a GET request for security, as mentioned above.

提交回复
热议问题