how to enable basic auth in java spring app?

hey guys. i have java spring app. in WebSecurityConfig i have this:
 @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .authorizeRequests()
                .antMatchers("/perlas").permitAll()
                .anyRequest().authenticated()
                .and().formLogin().loginPage("/login").permitAll()
                .and().logout().permitAll()
                .and().csrf().disable();
    }

and i want to enable basic auth. i know that i can do it in nginx, but i was wondering if i can do it in my spring app config somehow. can smb help me out? thx
Was this page helpful?