Question

In my SecurityConfig.java,

    @Override
protected void configure(AuthenticationManagerBuilder auth)
        throws Exception {
    auth.inMemoryAuthentication().withUser("user").password("password")
            .roles("USER");
}

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers("/**").hasRole("USER")
            .anyRequest().anonymous().and().httpBasic();
}

How do I totally disable Spring Security, in a way that I am able to access my web service without having to input "user" and "password"?

Was it helpful?

Solution

Use this Spring Security configuration:

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

Make note that this does not disable in Spring Security from the request chain, it just tells Spring Security to allow all requests

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top