Как выйти из системы в приложении springboot - PullRequest
1 голос
/ 11 октября 2019

Я пытаюсь выйти из системы в моем приложении Springboot, но он все еще регистрирует меня. Я ссылался на это, но у меня не получилось Выход из системы Spring Security не работает - не очищает контекст безопасности и аутентифицированного пользователявсе еще существует

Это мой код SecurityMiddleware

@EnableWebSecurity
public class SecurityMiddleware implements WebSecurityConfigurer {

    @Autowired
    private UserRepository userRepository;

    @Override
    public void configure(HttpSecurity http) throws Exception {
        http
                .cors()
                .and()
                .csrf()
                .disable()
                .authorizeRequests()
                .anyRequest().authenticated()
                .and()
                .anonymous()
                .disable()
                .addFilterAt(new JWTAuthorizationFilter(userRepository), BasicAuthenticationFilter.class)
                .logout().clearAuthentication(true).logoutUrl("/logout").logoutSuccessUrl("/login").deleteCookies("JSESSIONID").invalidateHttpSession(true)
                .and()
                .exceptionHandling()
                .authenticationEntryPoint(new Http401ForbiddenEntryPoint());

    }

    @Override
    public void configure(WebSecurity webSecurity) throws Exception {
        webSecurity.ignoring().antMatchers("/login/**");
    }
}```
...