Spring Security permitall denies access when sending authorization header

Viewed 1121

My security configuration is as follows:

http.authorizeRequests().antMatchers("/authenticate").fullyAuthenticated().anyRequest().permitAll().and().httpBasic();

It works and all the endpoints but /authenticate are not secured. But when the client sends Authorization header to any of the unsecured endpoints then Spring Security returns 401.

curl -s -u asdf:asdf http://127.0.0.1:22000/info
{"timestamp":1511348485989,"status":401,"error":"Unauthorized","message":"Bad credentials","path":"/info"}

How I must to configure security to ignore Authorization header on unsecured endpoints if it is sent?

Thanks in advance

0 Answers
Related