Hey all,
I have been trying to protect my APIs with spring oauth2. I have looked at and taken numerous examples, and it all looks easy enough using Spring 4.x, the @EnableAuthorizationServer, and so forth. However, despite trying in memory, jwt and jdbc, whenever I try to create a token using the /token endpoint, I see in my log output:
2017-01-19 12:21:05.047 WARN 30061 --- [243-8081-exec-4] o.s.web.servlet.PageNotFound : No mapping found for HTTP request with URI [/api/error] in DispatcherServlet with name 'dispatcherServlet'
which makes me think I am missing something that allows the server forward to some page that needs to be sent back as an error response. I dont have anything hosted at /api/error endpolint, I assumed that the magic of Spring OAUTH2 and such properly returned a JSON chunk of error and the 401 error code.
From time to time I seem to send in the right POST call that generated a different error, basically telling me:
No adapter for handler [public org.springframework.http.ResponseEntity<org.springframework.security.oauth2.common.OAuth2AccessToken>
So this last one makes me think that the auth worked, but somehow I am again missing something on my runtime classpath to handle the OAuth2AccessToken response type. Which again is baffling to me because I assumed with all the POM dependencies set up, and annotations in my code configured as other examples show, it just all magically worked. Nothing I have found explains anything else on configuration, etc for either of these issues I am seeing.
I built a Postman request to
http://<ip>:80801/api/token?client_id=foo&grant_types=client_credentials
That is a POST call, with Accept: application/json set as a header.
I am trying to set up the ability for an API consumer to create a token that they can then use to make API calls with e.g. Bearer <token> in Authorization header.
Any help would be appreciated.