disabling spring security in spring boot app
Try this. Make a new class
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity.authorizeRequests().antMatchers("/").permitAll();
}
}
Basically this tells Spring to allow access to every url. @Configuration
tells spring it's a configuration class
security.ignored is deprecated since Spring Boot 2.
For me simply extend the Annotation of your Application class did the Trick:
@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
I think you must also remove security auto config from your @SpringBootApplication
annotated class:
@EnableAutoConfiguration(exclude = {
org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.class,
org.springframework.boot.actuate.autoconfigure.ManagementSecurityAutoConfiguration.class})
Use security.ignored
property:
security.ignored=/**
security.basic.enable: false
will just disable some part of the security auto-configurations but your WebSecurityConfig
still will be registered.
There is a default security password generated at startup
Try to Autowired
the AuthenticationManagerBuilder
:
@Override
@Autowired
protected void configure(AuthenticationManagerBuilder auth) throws Exception { ... }