By: Alex Moniatovsky user 30 Nov 2017 at 6:38 p.m. CST

5 Responses
Alex Moniatovsky gravatar
Hello, I am using example provided by this link [link ](https://github.com/GluuFederation/oxd-spring), but it fails to get user info by access token, this part of code: ``` GetUserInfoResponse userInfoResponse = tokenResponse .map(c -> authenticationService.getUserInfo(authenticationService.getOxdId(), c.getAccessToken())) .map(c -> c.dataAsResponse(GetUserInfoResponse.class)) .orElseThrow(() -> new BadCredentialsException("Can't get user info")); ``` So BadCredentialsException is thrown because of null response. From oxauth log it looks like no exception is present on OXD side: ``` 2017-12-01 00:24:36,109 INFO [qtp2008017533-12] [org.xdi.oxauth.auth.Authenticator] (Authenticator.java:205) - Authentication success for Client: '@!17E3.A5EE.8587.6492!0001!384E.5254!0008!1FE8.F6C4.E42B.8053' 2017-12-01 00:24:36,112 DEBUG [qtp2008017533-12] [xdi.oxauth.token.ws.rs.TokenRestWebServiceImpl] (TokenRestWebServiceImpl.java:98) - Attempting to request access token: grantType = authorization_code, code = db161a41-a891-4ff7-a0ca-fdd786e2eb41, redirectUri = https://ivaas-dev.navvis.com/uat/api/gluu/callback, username = null, refreshToken = null, clientId = null, ExtraParams = {grant_type=[authorization_code], code=[db161a41-a891-4ff7-a0ca-fdd786e2eb41], redirect_uri=[https://ivaas-dev.navvis.com/uat/api/gluu/callback]}, isSecure = true, codeVerifier = null, ticket = null 2017-12-01 00:24:36,112 DEBUG [qtp2008017533-12] [xdi.oxauth.token.ws.rs.TokenRestWebServiceImpl] (TokenRestWebServiceImpl.java:118) - Starting to validate request parameters 2017-12-01 00:24:36,113 DEBUG [qtp2008017533-12] [xdi.oxauth.token.ws.rs.TokenRestWebServiceImpl] (TokenRestWebServiceImpl.java:126) - Grant type: 'authorization_code' 2017-12-01 00:24:36,113 DEBUG [qtp2008017533-12] [xdi.oxauth.token.ws.rs.TokenRestWebServiceImpl] (TokenRestWebServiceImpl.java:132) - Get sessionClient: 'org.xdi.oxauth.model.session.SessionClient@e4c3b8b' 2017-12-01 00:24:36,114 DEBUG [qtp2008017533-12] [xdi.oxauth.token.ws.rs.TokenRestWebServiceImpl] (TokenRestWebServiceImpl.java:136) - Get client from session: '@!17E3.A5EE.8587.6492!0001!384E.5254!0008!1FE8.F6C4.E42B.8053' 2017-12-01 00:24:36,114 DEBUG [qtp2008017533-12] [xdi.oxauth.token.ws.rs.TokenRestWebServiceImpl] (TokenRestWebServiceImpl.java:149) - Attempting to find authorizationCodeGrant by clinetId: '@!17E3.A5EE.8587.6492!0001!384E.5254!0008!1FE8.F6C4.E42B.8053', code: 'db161a41-a891-4ff7-a0ca-fdd786e2eb41' 2017-12-01 00:24:36,118 DEBUG [qtp2008017533-12] [xdi.oxauth.token.ws.rs.TokenRestWebServiceImpl] (TokenRestWebServiceImpl.java:160) - Issuing access token: ee9d056a-9f85-4ec7-ab4c-3297ba82bad4 2017-12-01 00:24:36,150 DEBUG [qtp2008017533-12] [org.xdi.oxauth.model.common.AuthorizationGrant] (AuthorizationGrant.java:117) - Saving grant: 2cc59ccf-f77a-4369-80ad-db47b47bc92c, code_challenge: null 2017-12-01 00:24:36,164 DEBUG [qtp2008017533-12] [org.xdi.oxauth.model.common.AuthorizationGrant] (AuthorizationGrant.java:117) - Saving grant: 2cc59ccf-f77a-4369-80ad-db47b47bc92c, code_challenge: null 2017-12-01 00:24:36,200 DEBUG [qtp2008017533-16] [xdi.oxauth.userinfo.ws.rs.UserInfoRestWebServiceImpl] (UserInfoRestWebServiceImpl.java:121) - Attempting to request User Info, Access token = ee9d056a-9f85-4ec7-ab4c-3297ba82bad4, Is Secure = true 2017-12-01 00:24:36,204 DEBUG [qtp2008017533-16] [org.xdi.oxauth.service.UserService] (UserService.java:84) - Getting user information from LDAP: userId = admin 2017-12-01 00:24:36,208 DEBUG [qtp2008017533-16] [org.xdi.oxauth.service.UserService] (UserService.java:93) - Found 1 entries for user id = admin 2017-12-01 00:24:36,216 DEBUG [qtp2008017533-16] [org.xdi.oxauth.service.ClientService] (ClientService.java:137) - Found 1 entries for client id = @!17E3.A5EE.8587.6492!0001!384E.5254!0008!1FE8.F6C4.E42B.8053 2017-12-01 00:24:53,572 DEBUG [oxAuthScheduler_Worker-1] [org.xdi.service.timer.RequestJobListener] (RequestJobListener.java:52) - Bound request started 2017-12-01 00:24:53,573 DEBUG [oxAuthScheduler_Worker-1] [org.xdi.service.timer.TimerJob] (TimerJob.java:34) - Fire timer event [org.xdi.service.cdi.event.ConfigurationEvent] with qualifiers [@org.xdi.service.cdi.event.Scheduled()] 2017-12-01 00:24:53,573 DEBUG [oxAuthScheduler_Worker-1] [org.xdi.service.timer.RequestJobListener] (RequestJobListener.java:62) - Bound request ended 2017-12-01 00:24:53,583 DEBUG [oxAuthScheduler_Worker-2] [org.xdi.service.timer.RequestJobListener] (RequestJobListener.java:52) - Bound request started 2017-12-01 00:24:53,583 DEBUG [oxAuthScheduler_Worker-2] [org.xdi.service.timer.TimerJob] (TimerJob.java:34) - Fire timer event [org.xdi.service.cdi.event.LdapStatusEvent] with qualifiers [@org.xdi.service.cdi.event.Scheduled()] 2017-12-01 00:24:53,583 DEBUG [oxAuthScheduler_Worker-2] [org.xdi.service.timer.RequestJobListener] (RequestJobListener.java:62) - Bound request ended 2017-12-01 00:24:53,622 DEBUG [oxAuthScheduler_Worker-3] [org.xdi.service.timer.RequestJobListener] (RequestJobListener.java:52) - Bound request started 2017-12-01 00:24:53,622 DEBUG [oxAuthScheduler_Worker-3] [org.xdi.service.timer.TimerJob] (TimerJob.java:34) - Fire timer event [org.xdi.oxauth.service.cdi.event.AuthConfigurationEvent] with qualifiers [@org.xdi.service.cdi.event.Scheduled()] 2017-12-01 00:24:53,622 DEBUG [oxAuthScheduler_Worker-3] [org.xdi.service.timer.RequestJobListener] (RequestJobListener.java:62) - Bound request ended 2017-12-01 00:24:53,794 DEBUG [oxAuthScheduler_Worker-4] [org.xdi.service.timer.RequestJobListener] (RequestJobListener.java:52) - Bound request started 2017-12-01 00:24:53,794 DEBUG [oxAuthScheduler_Worker-4] [org.xdi.service.timer.TimerJob] (TimerJob.java:34) - Fire timer event [org.xdi.service.cdi.event.UpdateScriptEvent] with qualifiers [@org.xdi.service.cdi.event.Scheduled()] 2017-12-01 00:24:53,806 DEBUG [oxAuthScheduler_Worker-4] [org.xdi.service.timer.RequestJobListener] (RequestJobListener.java:62) - Bound request ended ``` Could you please point me up where did I go wrong? Thank you in advance, Alex

By Yuriy Zabrovarnyy staff 01 Dec 2017 at 9:18 a.m. CST

Yuriy Zabrovarnyy gravatar
Alex, Would you be so kind to provide full `oxd-server.log` and `oxauth.log` files? Thanks, Yuriy Z

By Alex Moniatovsky user 04 Dec 2017 at 9:18 a.m. CST

Alex Moniatovsky gravatar
Yuriy, I am sorry, I have attached log files.

By Yuriy Zabrovarnyy staff 04 Dec 2017 at 9:49 a.m. CST

Yuriy Zabrovarnyy gravatar
Alex, It's bug in `oxd-spring` project. In logs we can see that `oxd-server` returns response successfully. ``` 2017-12-04 11:05:01,189 TRACE [org.xdi.oxd.server.Processor] Command: {"command":"get_user_info","params":{"oxd_id":"58d0003d-b306-40e1-afcd-037fd67e948a","access_token":"9700dc13-08b6-4c5d-8072-49142eec403e"}} 2017-12-04 11:05:01,216 TRACE [org.xdi.oxd.server.Processor] Send back response: {"status":"ok","data":{"claims":{"sub":["LmUTKKqQda2PYqELixhHbgzuvftCIbiHpNq958zj6ZM"],"email_verified":["true"],"name":["Default Admin User"],"inum":["@!17E3.A5EE.8587.6492!0001!384E.5254!0000!A8F2.DE1E.D7FB"],"email":["admin@authdev.navvis.com"]},"refresh_token":null,"access_token":null}} ``` For now please use oxd java client: ``` https://gluu.org/docs/oxd/3.1.1/libraries/languages/java/ https://github.com/GluuFederation/oxd/tree/master/oxd-client ``` Ticket opened here ``` https://github.com/GluuFederation/oxd-spring/issues/6 ``` Thanks, Yuriy Z

By Alex Moniatovsky user 05 Dec 2017 at 3:35 p.m. CST

Alex Moniatovsky gravatar
Thanks Yuriy for your response, I am a little bit confused, oxd-spring is the reference implementation how to configure spring security on top of the oxd-client library. We are using 3.0.1 version. The most strange is that this is the second Gluu(OXD server) we have deployed(we decided to use separate for UAT environment), working against the same web application, we not have an issue in the test(SIT) OXD server but for UAT, we have a null response for CommandType.GET_USER_INFO. Do you have any assumptions, maybe some difference in configuration can be the reason for our issue? Thank you in advance, Alex

By William Lowe user 18 Dec 2017 at 10:50 a.m. CST

William Lowe gravatar
Alex, have you been able to get this working? Which version of oxd are you running? Thanks, Will