Spring Boot 2.0 disable default security

后端 未结 11 2601
闹比i
闹比i 2020-12-02 11:28

I want to use Spring Security for JWT authentication. But it comes with default authentication. I am trying to disable it, but the old approach of doing this - disabling it

11条回答
  •  萌比男神i
    2020-12-02 12:02

    This worked for me:

    @Configuration
    public class SecurityConfig  extends WebSecurityConfigurerAdapter {
    
        @Override
        protected void configure(HttpSecurity http) throws Exception {
            http.csrf().disable().authorizeRequests().anyRequest().permitAll();
        }
    }
    

提交回复
热议问题