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();
}
}

 

928 total views, 2 views today

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

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.