How to disable the default spring security in spring boot ?

How to disable the default spring security in spring boot ?

To disable the spring boot’s default spring security / to disable the security for all the urls then include the below method in your custom security class which extends WebSecurityConfigurerAdapter

Method to include:

/* to permit all */
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests().anyRequest().permitAll();
}

Full class for reference:

 


@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public class CustomJDSecurityConfig extends WebSecurityConfigurerAdapter {

protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests().anyRequest().permitAll();
}
}

 

846 total views, 4 views today

About: Mirthbees

Blogger, Innovator, Developer and Enterpreneur. Founder of GuruRecharge, Readymade online recharge script. Lead Developer in Bookrate.in