From ba5effbf65303726bfd1b20a0751106403a620d7 Mon Sep 17 00:00:00 2001 From: pasindu Date: Tue, 25 Apr 2023 18:22:13 +0530 Subject: [PATCH] Remove unwanted dependencies and minor fixes --- .../pom.xml | 8 -------- .../extension/rest/api/PublisherRESTAPIServices.java | 10 ++++++---- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml index 17dbdbf866..7ecbdf7900 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml @@ -34,14 +34,6 @@ https://entgra.io - - org.apache.httpcomponents.wso2 - httpcore - - - org.wso2.orbit.org.apache.httpcomponents - httpclient - org.wso2.carbon org.wso2.carbon.logging diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java index 8ca7fb6172..f7c4430880 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java @@ -24,7 +24,6 @@ import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.util.ScopeUtils; - import okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -67,7 +66,8 @@ public class PublisherRESTAPIServices { } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); AccessTokenInfo refreshedAccessToken = apiApplicationServices. - generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(), apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret()); + generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(), + apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret()); //TODO: max attempt count return getScopes(apiApplicationKey, refreshedAccessToken); } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { @@ -103,7 +103,8 @@ public class PublisherRESTAPIServices { } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); AccessTokenInfo refreshedAccessToken = apiApplicationServices. - generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(), apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret()); + generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(), + apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret()); //TODO: max attempt count return isSharedScopeNameExists(apiApplicationKey, refreshedAccessToken, key); } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { @@ -147,7 +148,8 @@ public class PublisherRESTAPIServices { } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { APIApplicationServices apiApplicationServices = new APIApplicationServicesImpl(); AccessTokenInfo refreshedAccessToken = apiApplicationServices. - generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(), apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret()); + generateAccessTokenFromRefreshToken(accessTokenInfo.getRefresh_token(), + apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret()); //TODO: max attempt count return updateSharedScope(apiApplicationKey, refreshedAccessToken, scope); } else if (HttpStatus.SC_BAD_REQUEST == response.code()) {