Skip to content

Instantly share code, notes, and snippets.

@rbaul
Created January 2, 2019 14:00
Show Gist options
  • Save rbaul/d364451572aea4a6005ab537dba003dd to your computer and use it in GitHub Desktop.
Save rbaul/d364451572aea4a6005ab537dba003dd to your computer and use it in GitHub Desktop.
Spring Boot 2.0 - Disable security configuration (default enabled)
import org.springframework.context.annotation.Profile;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@EnableWebSecurity
public class SecurityConfigDisable extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests().anyRequest().permitAll();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment