Merge branch 'new-improvements' into 'master'

Fix issues of getting default token

See merge request entgra/carbon-device-mgt!597
revert-70ac1926
Dharmakeerthi Lasantha 5 years ago
commit 0c2a7fe0dd

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

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

Loading…
Cancel
Save