En esta clase cuando elimino del metodo configure estas lineas .anyRequest().authenticated().and().formLogin() la request sirve de forma que quiero pero si las agrego me regresa un html
@Configuration
@AllArgsConstructor
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter{
private final AppUserService appUserUervice;
private final BCryptPasswordEncoder bCryptPasswordEncoder;
@Override
protected void configure(HttpSecurity http) throws Exception {
// TODO Auto-generated method stub
http
.csrf().disable()
.authorizeRequests()
.antMatchers("api/v1/registration/**")
.permitAll()
//.anyRequest().authenticated().and().formLogin() ;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// TODO Auto-generated method stub
auth.authenticationProvider(daoAuthenticationProvider());
}
@Bean
public DaoAuthenticationProvider daoAuthenticationProvider() {
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
provider.setPasswordEncoder(bCryptPasswordEncoder);
provider.setUserDetailsService(appUserUervice);
return provider;
}
}
El problema es que estoy siguiendo un tutorial y en este las linas .anyRequest().authenticated().and().formLogin() estan agregadas y si sirve el metodo