logout()
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.formLogin()
.loginPage("/login")
.and()
.logout()
.logoutSuccessUrl("/")
...
}
In spring logout is implement using the filter functionality.
So, that logout filter intercept the request to the /logout Url.
So, you have to add the href link or call to that /logout url.
<a href="<c:url value="/logout" />">Logout</a>
logout clears the rememberme token from the cookies or any loggedIn user details.
So, once user logout, credentials are required for the specific URLs where the authentication is required.
you can also specify the logout success url: .logoutSuccessUrl("/")
you can also override the default LogoutFilter path (/logout) usint the .logoutUrl("/signout") method