Авторизуется через сайт, через постман нет

Делаю небольшое REST приложение с авторизацией через DaoAuthenticationProvider

 @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
                .antMatchers("/house/**").authenticated()
                .and()
                .formLogin()
                .and()
                .logout().logoutSuccessUrl("/");
    }
 @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }

    @Bean
    public DaoAuthenticationProvider daoAuthenticationProvider() {
        DaoAuthenticationProvider authenticationProvider = new DaoAuthenticationProvider();
        authenticationProvider.setPasswordEncoder(passwordEncoder());
        authenticationProvider.setUserDetailsService(userService);
        return authenticationProvider;
    }

На сайте авторизуется и возвращается JSON Читал что надо отключать FormLogin Но я все равно не могу получить запрос через постман postman site


Ответы (1 шт):

Автор решения: Fleckinger

Попробуйте отключить CSRF, с помощью метода .csrf().disable().

    http
            .csrf().disable()
            .authorizeRequests()
            .antMatchers("/house/**").authenticated()
            .and()
            .formLogin()
            .and()
            .logout().logoutSuccessUrl("/");
→ Ссылка