There was an unexpected error (type=Not Found, status=404)
Авторизация работает, а выход с аккаунта не хочет появляется whitelabel error page. WebSecurityConfig
import com.WebKurs.demo.security.AuthProviderImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private AuthProviderImpl authProvider;
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(authProvider);
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/signIn","/login","/logout","/registration").anonymous()
.antMatchers("/personalCabinet","/vacancy/add","/vacancy/{id}/remove").authenticated()
.and()
.formLogin()
.loginPage("/login")
.loginProcessingUrl("/login/process")
.and()
.logout()
.and()
.csrf().disable();
}
}
место с полем выхода
<nav class="my-2 my-md-0 mr-md-3">
<form th:action="@{/logout}" method="post">
<a class="p-2 text-dark" href="/">Главная</a>
<a class="p-2 text-dark" href="/personalCabinet">Личный кабинет</a>
<a class="p-2 text-dark" href="/vacancy/add">Добавить вакансию</a>
<a id="signIn" class="p-2 text-dark" href="/signIn">Войти</a>
<input id="signOut" class="p-2 text-dark" type="submit" value="Sign Out"/>
</form>
</nav>