POST request "Full authentication required to access this resource"

Has anyone encountered the "Full authentication is required to access this resource" error while trying to authenticate with a POST oauth / token request?

Curl Command:

curl localhost:85/oauth/token -d grant_type=password -d client_id=web_app -d username=reader -d password=reader 

Answer:

 {"timestamp":1486841819620,"status":401,"error":"Unauthorized","message":"Full authentication is required to access this resource","path":"/oauth/token"} 

ResourceServerConfiguration

 http .csrf().disable() .authorizeRequests() .antMatchers("/**").authenticated() .antMatchers(HttpMethod.GET, "/me").hasAuthority("FOO_READ") 

Configure WebSecurityConfig

 http .csrf().disable() .exceptionHandling() .authenticationEntryPoint((request, response, authException) -> response.sendError(HttpServletResponse.SC_UNAUTHORIZED)) 

Thanks!

+8
source share
1 answer

Additional details answer above。

e.g. base64 encode your_client_id: your_client_secret ==> eW91cl9jbGllbnRfaWQ6eW91cl9jbGllbnRfc2VjcmV0

Curl Command:

curl localhost: 85 / oauth / token -d grant_type = password -d client_id = web_app -d username = reader -d password = reader -H 'Authorization: Basic eW91cl9jbGllbnRfaWQ6eW91cl9jbGllbnRfc2VjcmV0'

0
source

Source: https://habr.com/ru/post/1264110/


All Articles