1

As per the title I put some basic authentication in spring boot but how we access some API without authentication login

@Override
protected void configure(HttpSecurity http) throws Exception {
    http
      .authorizeRequests()
      .anyRequest()
      .authenticated()
      .and()
      .httpBasic();
}
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62

2 Answers2

0
http.ignoring().antMatchers("/authFailure");

We can use like the above to ignore specific URL paths.

Check this out.

whoami
  • 1,517
  • 1
  • 21
  • 29
0

Filter out the APIs and permit for all without authentication

Example

.antMatchers(GET, "/home","/health").permitAll()

This will allow GET request on 2 endpoints for all requests, even without authentication

Complete sample

   http
        .authorizeRequests()
        .antMatchers(GET, "/home","/health").permitAll()
        .anyRequest()
        .authenticated()
        .and()
        .httpBasic();

Note : It takes ordering to account