how to use login credentials for spring app in postman?

hey guys. can smb help me out? i cant use login and password auth in postman for my spring app. i have this websecurityconfig:
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    private MyUserDetailsService userDetailsService;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .authorizeRequests()
//                .antMatchers("/communicationTests").permitAll()
                .antMatchers("/importBgwCurrent").permitAll()

                .anyRequest().authenticated()
                .and().formLogin().loginPage("/login").permitAll()
                .and().logout().permitAll()
                .and().csrf().disable();
    }

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.userDetailsService(userDetailsService);
        auth.authenticationProvider(authProvider());
    }

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new CryptEncoder();
    }

    @Bean
    public DaoAuthenticationProvider authProvider() {
        DaoAuthenticationProvider authProvider = new DaoAuthenticationProvider();
        authProvider.setUserDetailsService(userDetailsService);
        authProvider.setPasswordEncoder(passwordEncoder());
        return authProvider;
    }
}

if i disable permitAll, then i select basic auth in postman, enter my username us3rnam3 and pa55word, but in the response i still get login page html. but if i have permitAll disabled and go to my endpoint with browser, i get login page, enter credentials and everything works fine.
if i enable permitAll, then everything is fine in postman and browser too.

can smb explain what im doing wrong? thanks
Was this page helpful?