Fix get default token issues

4.x.x
shamalka 4 years ago
parent 2adda8ba6d
commit 2ec29701a1

@ -1338,7 +1338,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
@GET @GET
@Path("/{clientId}/{clientSecret}/default-token") @Path("/{clientId}/{clientSecret}/default-token")
@Override @Override
public Response getDefaultToken(String clientId, String clientSecret) { public Response getDefaultToken(@PathParam("clientId") String clientId, @PathParam("clientSecret") String clientSecret) {
JWTClientManagerService jwtClientManagerService = DeviceMgtAPIUtils.getJWTClientManagerService(); JWTClientManagerService jwtClientManagerService = DeviceMgtAPIUtils.getJWTClientManagerService();
try { try {
JWTClient jwtClient = jwtClientManagerService.getJWTClient(); JWTClient jwtClient = jwtClientManagerService.getJWTClient();

@ -104,10 +104,10 @@ public class DefaultTokenHandler extends HttpServlet {
newDefaultAuthData.setClientId(clientId); newDefaultAuthData.setClientId(clientId);
newDefaultAuthData.setClientSecret(clientSecret); newDefaultAuthData.setClientSecret(clientSecret);
String defaultToken = jTokenResultAsJsonObject.get("access_token").getAsString(); String defaultToken = jTokenResultAsJsonObject.get("accessToken").getAsString();
newDefaultAuthData.setAccessToken(defaultToken); newDefaultAuthData.setAccessToken(defaultToken);
newDefaultAuthData.setRefreshToken(jTokenResultAsJsonObject.get("refresh_token").getAsString()); newDefaultAuthData.setRefreshToken(jTokenResultAsJsonObject.get("refreshToken").getAsString());
newDefaultAuthData.setScope(jTokenResultAsJsonObject.get("scope").getAsString()); newDefaultAuthData.setScope(jTokenResultAsJsonObject.get("scopes").getAsString());
httpSession.setAttribute(HandlerConstants.SESSION_DEFAULT_AUTH_DATA_KEY, newDefaultAuthData); httpSession.setAttribute(HandlerConstants.SESSION_DEFAULT_AUTH_DATA_KEY, newDefaultAuthData);
HandlerUtil.handleSuccess(resp, constructSuccessProxyResponse(defaultToken)); HandlerUtil.handleSuccess(resp, constructSuccessProxyResponse(defaultToken));

Loading…
Cancel
Save