From 4bcf35023618de5b302361795285def0a8ff6db0 Mon Sep 17 00:00:00 2001 From: harshanl Date: Thu, 6 Oct 2016 19:43:23 +0530 Subject: [PATCH] EMM-1678:Updated the oauth component versions --- .../jaggeryapps/devicemgt/app/conf/config.json | 2 +- .../identity/jwt/client/extension/JWTClient.java | 11 +++++++---- .../policy/mgt/core/mgt/impl/PolicyManagerImpl.java | 8 ++++---- pom.xml | 4 ++-- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json index 97b955ae7d..9322773d37 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json @@ -19,7 +19,7 @@ "owner": "admin@carbon.super", "dynamicClientAppRegistrationServiceURL": "%https.ip%/dynamic-client-web/register", "apiManagerClientAppRegistrationServiceURL": "%https.ip%/api-application-registration/register/tenants", - "grantType": "password refresh_token urn:ietf:params:oauth:grant-type:saml2-bearer", + "grantType": "password refresh_token urn:ietf:params:oauth:grant-type:saml2-bearer urn:ietf:params:oauth:grant-type:jwt-bearer", "tokenScope": "admin", "callbackUrl": "%https.ip%/api/device-mgt/v1.0" }, diff --git a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/src/main/java/org/wso2/carbon/identity/jwt/client/extension/JWTClient.java b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/src/main/java/org/wso2/carbon/identity/jwt/client/extension/JWTClient.java index 55da4229b3..d117ef1eca 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/src/main/java/org/wso2/carbon/identity/jwt/client/extension/JWTClient.java +++ b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/src/main/java/org/wso2/carbon/identity/jwt/client/extension/JWTClient.java @@ -129,10 +129,13 @@ public class JWTClient { JSONParser jsonParser = new JSONParser(); JSONObject jsonObject = (JSONObject) jsonParser.parse(response); AccessTokenInfo accessTokenInfo = new AccessTokenInfo(); - accessTokenInfo.setAccessToken((String) jsonObject.get(JWTConstants.ACCESS_TOKEN_GRANT_TYPE_PARAM_NAME)); - accessTokenInfo.setRefreshToken((String) jsonObject.get(JWTConstants.REFRESH_TOKEN_GRANT_TYPE_PARAM_NAME)); - accessTokenInfo.setExpiresIn((Long) jsonObject.get(JWTConstants.OAUTH_EXPIRES_IN)); - accessTokenInfo.setTokenType((String) jsonObject.get(JWTConstants.OAUTH_TOKEN_TYPE)); + String accessToken = (String) jsonObject.get(JWTConstants.ACCESS_TOKEN_GRANT_TYPE_PARAM_NAME); + if (accessToken != null && !accessToken.isEmpty()) { + accessTokenInfo.setAccessToken(accessToken); + accessTokenInfo.setRefreshToken((String) jsonObject.get(JWTConstants.REFRESH_TOKEN_GRANT_TYPE_PARAM_NAME)); + accessTokenInfo.setExpiresIn((Long) jsonObject.get(JWTConstants.OAUTH_EXPIRES_IN)); + accessTokenInfo.setTokenType((String) jsonObject.get(JWTConstants.OAUTH_TOKEN_TYPE)); + } return accessTokenInfo; } catch (MalformedURLException e) { throw new JWTClientException("Invalid URL for token endpoint " + jwtConfig.getTokenEndpoint(), e); diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java index 3c390780e6..ee86ca0804 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java @@ -147,7 +147,7 @@ public class PolicyManagerImpl implements PolicyManager { List existingFeaturesList = new ArrayList<>(); List newFeaturesList = new ArrayList<>(); - List feturesToDelete = new ArrayList<>(); + List featuresToDelete = new ArrayList<>(); List temp = new ArrayList<>(); List updateDFes = new ArrayList<>(); @@ -169,7 +169,7 @@ public class PolicyManagerImpl implements PolicyManager { // Check for the features to delete for (ProfileFeature feature : existingProfileFeaturesList) { if (!updateDFes.contains(feature.getFeatureCode())) { - feturesToDelete.add(feature); + featuresToDelete.add(feature); } } @@ -194,8 +194,8 @@ public class PolicyManagerImpl implements PolicyManager { featureDAO.addProfileFeatures(newFeaturesList, profileId); } - if (!feturesToDelete.isEmpty()) { - for (ProfileFeature pf : feturesToDelete) + if (!featuresToDelete.isEmpty()) { + for (ProfileFeature pf : featuresToDelete) featureDAO.deleteProfileFeatures(pf.getId()); } diff --git a/pom.xml b/pom.xml index 378ead1e73..acacfbbc51 100644 --- a/pom.xml +++ b/pom.xml @@ -1791,8 +1791,8 @@ 4.7.0 - 5.2.0 - 5.1.2 + 5.2.1 + 5.1.3 5.1.1