I trying to write Web REST backend with api. Now I can authorization with any request which send user data something like this:

But I don't like this, I want to use only one resource for authorization /api/user/login
I have this CustomWebSecurityConfigurerAdapter.java:
@Configuration
@EnableWebSecurity
public class CustomWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
@Autowired
private DataSource dataSource;
@Autowired
private AuthenticationEntryPoint authenticationEntryPoint;
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.jdbcAuthentication().dataSource(dataSource)
.usersByUsernameQuery(
"select username, password, true from users where username=?")
.authoritiesByUsernameQuery(
"select username, role from users where username=?")
.passwordEncoder(new BCryptPasswordEncoder());
}
@Override
public void configure(WebSecurity web) {
web.ignoring()
.antMatchers("/api/test/getting")
.antMatchers("/api/user/register")
.antMatchers("/webjars/**")
.antMatchers("/api/swagger-resources/configuration/ui")
.antMatchers("/swagger-ui.html*");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest().authenticated()
.and()
.httpBasic()
.authenticationEntryPoint(authenticationEntryPoint);
}
}
Can you explain me how it works?