Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If Gson mapper is chosen, the oauth token response is empty #49

Open
thilaktp opened this issue Mar 25, 2016 · 2 comments
Open

If Gson mapper is chosen, the oauth token response is empty #49

thilaktp opened this issue Mar 25, 2016 · 2 comments

Comments

@thilaktp
Copy link

If I add spring.http.converters.preferred-json-mapper=gson to application.properties and add the gson dependency, the oauth token is not returned.

Removing the spring.http.converters.preferred-json-mapper=gson from the properties makes it work again. Any ideas? I want to use gson for all return types.

@thilaktp
Copy link
Author

2016-03-25 00:37:08.102 DEBUG 71364 --- [           main] o.s.w.s.m.m.a.HttpEntityMethodProcessor  : Written [e51ff52a-853a-46f5-ad72-9500cb2e15d3] as "application/json;charset=UTF-8" using [org.springframework.http.converter.json.GsonHttpMessageConverter@20256a0b]
2016-03-25 00:37:08.102 DEBUG 71364 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Null ModelAndView returned to DispatcherServlet with name '': assuming HandlerAdapter completed request handling
2016-03-25 00:37:08.102 DEBUG 71364 --- [           main] o.s.t.web.servlet.TestDispatcherServlet  : Successfully completed request
2016-03-25 00:37:08.103 DEBUG 71364 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Returning cached instance of singleton bean 'delegatingApplicationListener'
2016-03-25 00:37:08.103 DEBUG 71364 --- [           main] o.s.s.w.a.ExceptionTranslationFilter     : Chain processed normally
2016-03-25 00:37:08.103 DEBUG 71364 --- [           main] s.s.w.c.SecurityContextPersistenceFilter : SecurityContextHolder now cleared, as request processing completed

MockHttpServletRequest:
      HTTP Method = POST
      Request URI = /oauth/token
       Parameters = {username=[craig], password=[spring], grant_type=[password], scope=[read write], client_id=[clientapp], client_secret=[123456]}
          Headers = {Authorization=[Basic Y2xpZW50YXBwOjEyMzQ1Ng==], Content-Type=[application/x-www-form-urlencoded]}

Handler:
             Type = org.springframework.security.oauth2.provider.endpoint.TokenEndpoint
           Method = public org.springframework.http.ResponseEntity<org.springframework.security.oauth2.common.OAuth2AccessToken> org.springframework.security.oauth2.provider.endpoint.TokenEndpoint.postAccessToken(java.security.Principal,java.util.Map<java.lang.String, java.lang.String>) throws org.springframework.web.HttpRequestMethodNotSupportedException

Async:
    Async started = false
     Async result = null

Resolved Exception:
             Type = null

ModelAndView:
        View name = null
             View = null
            Model = null

FlashMap:
       Attributes = null

MockHttpServletResponse:
           Status = 200
    Error message = null
          Headers = {X-Content-Type-Options=[nosniff], X-XSS-Protection=[1; mode=block], Cache-Control=[no-cache, no-store, max-age=0, must-revalidate, no-store], Pragma=[no-cache, no-cache], Expires=[0], X-Frame-Options=[DENY], Content-Type=[application/json;charset=UTF-8]}
     Content type = application/json;charset=UTF-8
             Body = {}
    Forwarded URL = null
   Redirected URL = null
          Cookies = []
2016-03-25 00:37:08.158 DEBUG 71364 --- [           main] c.jayway.jsonpath.internal.CompiledPath  : Evaluating path: $['access_token']

@marcellom
Copy link

Hi, I have this problem as well. I created an issue on the official spring repo: spring-attic/spring-security-oauth#1143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants