Win a copy of Fixing your Scrum this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Spring boot oauth2 authorization server problems

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
I am a man of mystery. Mostly because of this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic