I'm trying to insert data using a POST request but I'm getting a 403 error. When I use GET, basic authentication works. For testing I use Fiddler.
What's the problem?
Security config:
@Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/**").hasRole("USER").and() .httpBasic(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth .inMemoryAuthentication() .withUser("user") .password("password") .roles("USER"); } } Request - POST:
User-Agent: Fiddler Host: localhost:8080 Content-Length: 200 Content-Type: application/json Authorization: Basic dXNlcjpwYXNzd29yZA== Request body:
{"name" : "name1", "description" : "desc1"}