diff --git a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml similarity index 71% rename from components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/pom.xml rename to components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml index 2471b48fed..7fb3f1726f 100644 --- a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml @@ -27,21 +27,13 @@ 4.0.0 - io.entgra.devicemgt.apimgt.extension.rest.api + io.entgra.device.mgt.core.apimgt.extension.rest.api bundle - Entgra - Device API Management Extension Publisher API - Entgra - Device API Management Extension Publisher API + Entgra - Device Management Extension for APIM REST API + Entgra - Device Management Extension for APIM REST API https://entgra.io - - org.apache.httpcomponents.wso2 - httpcore - - - org.wso2.orbit.org.apache.httpcomponents - httpclient - org.wso2.carbon org.wso2.carbon.logging @@ -90,6 +82,11 @@ com.google.code.gson gson + + org.wso2.carbon.apimgt + org.wso2.carbon.apimgt.impl + provided + @@ -110,31 +107,23 @@ ${carbon.device.mgt.version} Publisher API Management Bundle - io.entgra.devicemgt.apimgt.extension.rest.api.internal + io.entgra.device.mgt.core.apimgt.extension.rest.api.internal - !io.entgra.devicemgt.apimgt.extension.rest.api.internal, - io.entgra.devicemgt.apimgt.extension.rest.api.* + !io.entgra.device.mgt.core.apimgt.extension.rest.api.internal, + io.entgra.device.mgt.core.apimgt.extension.rest.api.* javax.net.ssl, - org.apache.commons.logging, - org.apache.http;version="${httpclient.version.range}", - org.apache.http.client;version="${httpclient.version.range}", - org.apache.http.client.methods;version="${httpclient.version.range}", - org.apache.http.conn.socket, - org.apache.http.conn.ssl, - org.apache.http.entity, - org.apache.http.impl.client, - org.apache.http.util;version="${httpclient.version.range}", - org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.wso2.carbon.core, - org.apache.commons.ssl, - org.apache.commons.httpclient, + org.wso2.carbon.core;version="4.6", + org.wso2.carbon.core.util;version="4.6", org.wso2.carbon.apimgt.api.model, okhttp3.*, + org.wso2.carbon.apimgt.impl;version="${carbon.api.mgt.version.range}", + org.wso2.carbon.apimgt.impl.utils;version="${carbon.api.mgt.version.range}", + org.wso2.carbon.apimgt.impl.internal;version="${carbon.api.mgt.version.range}", org.json @@ -166,22 +155,7 @@ - - - - - - - - - - - - - - true - \ No newline at end of file diff --git a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/APIApplicationServices.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/APIApplicationServices.java similarity index 64% rename from components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/APIApplicationServices.java rename to components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/APIApplicationServices.java index d420bbc622..51d7d20b17 100644 --- a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/APIApplicationServices.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/APIApplicationServices.java @@ -16,18 +16,18 @@ * under the License. */ -package io.entgra.devicemgt.apimgt.extension.rest.api; +package io.entgra.device.mgt.core.apimgt.extension.rest.api; -import io.entgra.devicemgt.apimgt.extension.rest.api.dto.APIApplicationKey; -import io.entgra.devicemgt.apimgt.extension.rest.api.dto.AccessTokenInfo; -import io.entgra.devicemgt.apimgt.extension.rest.api.exceptions.APIApplicationServicesException; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException; public interface APIApplicationServices { - APIApplicationKey createAndRetrieveApplicationCredentials() throws APIApplicationServicesException; + APIApplicationKey createAndRetrieveApplicationCredentials() throws APIServicesException; - AccessTokenInfo generateAccessTokenFromRegisteredApplication(String clientId, String clientSecret) throws APIApplicationServicesException; + AccessTokenInfo generateAccessTokenFromRegisteredApplication(String clientId, String clientSecret) throws APIServicesException; - AccessTokenInfo generateAccessTokenFromRefreshToken(String refreshToken, String clientId, String clientSecret) throws APIApplicationServicesException; + AccessTokenInfo generateAccessTokenFromRefreshToken(String refreshToken, String clientId, String clientSecret) throws APIServicesException; } diff --git a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/APIApplicationServicesImpl.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/APIApplicationServicesImpl.java similarity index 80% rename from components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/APIApplicationServicesImpl.java rename to components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/APIApplicationServicesImpl.java index d1613f3d74..bffb97893a 100644 --- a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/APIApplicationServicesImpl.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/APIApplicationServicesImpl.java @@ -16,14 +16,14 @@ * under the License. */ -package io.entgra.devicemgt.apimgt.extension.rest.api; +package io.entgra.device.mgt.core.apimgt.extension.rest.api; import com.google.gson.Gson; -import io.entgra.devicemgt.apimgt.extension.rest.api.dto.APIApplicationKey; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; import org.json.JSONObject; -import io.entgra.devicemgt.apimgt.extension.rest.api.constants.Constants; -import io.entgra.devicemgt.apimgt.extension.rest.api.dto.AccessTokenInfo; -import io.entgra.devicemgt.apimgt.extension.rest.api.exceptions.APIApplicationServicesException; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.constants.Constants; +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 okhttp3.MediaType; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -33,6 +33,8 @@ import okhttp3.Credentials; import okhttp3.ConnectionPool; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.apimgt.impl.APIManagerConfiguration; +import org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocketFactory; @@ -50,22 +52,24 @@ public class APIApplicationServicesImpl implements APIApplicationServices { private static final Gson gson = new Gson(); private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8"); String msg = null; - // private ApiApplicationConfigurations ApplicationConfig = null; + APIManagerConfiguration config = ServiceReferenceHolder.getInstance(). + getAPIManagerConfigurationService().getAPIManagerConfiguration(); @Override public APIApplicationKey createAndRetrieveApplicationCredentials() - throws APIApplicationServicesException { + throws APIServicesException { + + String applicationEndpoint = config.getFirstProperty(Constants.DCR_END_POINT); + String owner = config.getFirstProperty(Constants.SERVER_USER); JSONObject jsonObject = new JSONObject(); jsonObject.put("callbackUrl", Constants.EMPTY_STRING); jsonObject.put("clientName", Constants.CLIENT_NAME); jsonObject.put("grantType", Constants.GRANT_TYPE); - jsonObject.put("owner", Constants.OWNER); + jsonObject.put("owner", owner); jsonObject.put("saasApp", true); RequestBody requestBody = RequestBody.Companion.create(jsonObject.toString(), JSON); - String applicationEndpoint = "https://localhost:9443/client-registration/v0.17/register"; - Request request = new Request.Builder() .url(applicationEndpoint) .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Credentials.basic("admin", "admin")) @@ -76,26 +80,29 @@ public class APIApplicationServicesImpl implements APIApplicationServices { return gson.fromJson(response.body().string(), APIApplicationKey.class); } catch (IOException e) { msg = "Error occurred while processing the response"; - log.error(msg); - throw new APIApplicationServicesException(msg); + log.error(msg, e); + throw new APIServicesException(e); } } @Override public AccessTokenInfo generateAccessTokenFromRegisteredApplication(String consumerKey, String consumerSecret) - throws APIApplicationServicesException { + throws APIServicesException { + + String userName = config.getFirstProperty(Constants.SERVER_USER); + String userPassword = config.getFirstProperty(Constants.SERVER_PASSWORD); + JSONObject params = new JSONObject(); params.put(Constants.GRANT_TYPE_PARAM_NAME, Constants.PASSWORD_GRANT_TYPE); - //ToDo: Remove hardcoded value - params.put(Constants.PASSWORD_GRANT_TYPE_USERNAME, "admin"); - params.put(Constants.PASSWORD_GRANT_TYPE_PASSWORD, "admin"); + params.put(Constants.PASSWORD_GRANT_TYPE_USERNAME, userName); + params.put(Constants.PASSWORD_GRANT_TYPE_PASSWORD, userPassword); params.put(Constants.SCOPE_PARAM_NAME, Constants.SCOPES); return getToken(params, consumerKey, consumerSecret); } @Override public AccessTokenInfo generateAccessTokenFromRefreshToken(String refreshToken, String consumerKey, String consumerSecret) - throws APIApplicationServicesException { + throws APIServicesException { JSONObject params = new JSONObject(); params.put(Constants.GRANT_TYPE_PARAM_NAME, Constants.REFRESH_TOKEN_GRANT_TYPE); @@ -105,11 +112,11 @@ public class APIApplicationServicesImpl implements APIApplicationServices { } public AccessTokenInfo getToken(JSONObject nameValuePairs, String clientId, String clientSecret) - throws APIApplicationServicesException { + throws APIServicesException { - RequestBody requestBody = RequestBody.Companion.create(nameValuePairs.toString(), JSON); - String tokenEndPoint = "https://localhost:9443/oauth2/token"; + String tokenEndPoint = config.getFirstProperty(Constants.TOKE_END_POINT); + RequestBody requestBody = RequestBody.Companion.create(nameValuePairs.toString(), JSON); Request request = new Request.Builder() .url(tokenEndPoint) .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Credentials.basic(clientId, clientSecret)) @@ -121,8 +128,8 @@ public class APIApplicationServicesImpl implements APIApplicationServices { return gson.fromJson(response.body().string(), AccessTokenInfo.class); } catch (IOException e) { msg = "Error occurred while processing the response"; - log.error(msg); - throw new APIApplicationServicesException(msg); + log.error(msg, e); + throw new APIServicesException(e); } } diff --git a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/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 similarity index 72% rename from components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/PublisherRESTAPIServices.java rename to 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 7148286aa3..5fedcca952 100644 --- a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/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 @@ -16,14 +16,14 @@ * under the License. */ -package io.entgra.devicemgt.apimgt.extension.rest.api; +package io.entgra.device.mgt.core.apimgt.extension.rest.api; -import io.entgra.devicemgt.apimgt.extension.rest.api.constants.Constants; -import io.entgra.devicemgt.apimgt.extension.rest.api.dto.APIApplicationKey; -import io.entgra.devicemgt.apimgt.extension.rest.api.dto.AccessTokenInfo; -import io.entgra.devicemgt.apimgt.extension.rest.api.exceptions.APIApplicationServicesException; -import io.entgra.devicemgt.apimgt.extension.rest.api.exceptions.BadRequestException; -import io.entgra.devicemgt.apimgt.extension.rest.api.util.ScopeUtils; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.constants.Constants; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; +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; @@ -39,26 +39,31 @@ import org.wso2.carbon.apimgt.api.model.Scope; import java.io.IOException; -import static io.entgra.devicemgt.apimgt.extension.rest.api.APIApplicationServicesImpl.getOkHttpClient; +import static io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServicesImpl.getOkHttpClient; public class PublisherRESTAPIServices { private static final Log log = LogFactory.getLog(PublisherRESTAPIServices.class); private static final OkHttpClient client = getOkHttpClient(); private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8"); + private static final String host = System.getProperty(Constants.IOT_CORE_HOST); + private static final String port = System.getProperty(Constants.IOT_CORE_HTTPS_PORT); + public JSONObject getScopes(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo) - throws APIApplicationServicesException, BadRequestException { + throws APIServicesException, BadRequestException { + - String getScopesUrl = "https://localhost:9443/api/am/publisher/v2/scopes?limit=1000"; + String getAllScopesUrl = "https://" + "://" + host + ":" + port + Constants.GET_ALL_SCOPES; Request request = new Request.Builder() - .url(getScopesUrl) - .addHeader(Constants.AUTHORIZATION_HEADER_NAME, "Bearer " + accessTokenInfo.getAccess_token()) + .url(getAllScopesUrl) + .addHeader(Constants.AUTHORIZATION_HEADER_NAME, Constants.AUTHORIZATION_HEADER_PREFIX_BEARER + + accessTokenInfo.getAccess_token()) .get() .build(); try { Response response = client.newCall(request).execute(); - if (response.code() == HttpStatus.SC_OK) { + if (HttpStatus.SC_OK == response.code()) { JSONObject jsonObject = new JSONObject(response.body().string()); return jsonObject; } else if (HttpStatus.SC_UNAUTHORIZED == response.code()) { @@ -68,22 +73,24 @@ public class PublisherRESTAPIServices { //TODO: max attempt count return getScopes(apiApplicationKey, refreshedAccessToken); } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { - log.info(response); - throw new BadRequestException(response.toString()); + String msg = "Bad Request, Invalid request"; + log.error(msg); + throw new BadRequestException(msg); } else { return null; } } catch (IOException e) { String msg = "Error occurred while processing the response"; - throw new APIApplicationServicesException(msg); + log.error(msg, e); + throw new APIServicesException(e); } } public boolean isSharedScopeNameExists(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, String key) - throws APIApplicationServicesException, BadRequestException { + throws APIServicesException, BadRequestException { String keyValue = new String(Base64.encodeBase64((key).getBytes())).replace("=", ""); - String getScopeUrl = "https://localhost:9443/api/am/publisher/v2/scopes/" + keyValue; + String getScopeUrl = "https://" + "://" + host + ":" + port + Constants.GET_SCOPE + keyValue; Request request = new Request.Builder() .url(getScopeUrl) @@ -101,21 +108,23 @@ public class PublisherRESTAPIServices { //TODO: max attempt count return isSharedScopeNameExists(apiApplicationKey, refreshedAccessToken, key); } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { - log.info(response); - throw new BadRequestException(response.toString()); + String msg = "Bad Request, Invalid request"; + log.error(msg); + throw new BadRequestException(msg); } else { return false; } } catch (IOException e) { String msg = "Error occurred while processing the response"; - throw new APIApplicationServicesException(msg); + log.error(msg, e); + throw new APIServicesException(e); } } public boolean updateSharedScope(APIApplicationKey apiApplicationKey, AccessTokenInfo accessTokenInfo, Scope scope) - throws APIApplicationServicesException, BadRequestException { + throws APIServicesException, BadRequestException { - String updateScopeUrl = "https://localhost:9443/api/am/publisher/v2/scopes/" + scope.getId(); + String updateScopeUrl = "https://" + "://" + host + ":" + port + Constants.GET_SCOPE + scope.getId(); ScopeUtils scopeUtil = new ScopeUtils(); scopeUtil.setKey(scope.getKey()); @@ -142,14 +151,16 @@ public class PublisherRESTAPIServices { //TODO: max attempt count return updateSharedScope(apiApplicationKey, refreshedAccessToken, scope); } else if (HttpStatus.SC_BAD_REQUEST == response.code()) { - log.info(response); - throw new BadRequestException(response.toString()); + String msg = "Bad Request, Invalid scope object"; + log.error(msg); + throw new BadRequestException(msg); } else { return false; } } catch (IOException e) { String msg = "Error occurred while processing the response"; - throw new APIApplicationServicesException(msg); + log.error(msg, e); + throw new APIServicesException(e); } } } diff --git a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/bean/RegistrationProfile.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/bean/RegistrationProfile.java similarity index 97% rename from components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/bean/RegistrationProfile.java rename to components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/bean/RegistrationProfile.java index 97033b6d5c..455c4704d1 100644 --- a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/bean/RegistrationProfile.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/bean/RegistrationProfile.java @@ -16,7 +16,7 @@ * under the License. */ -package io.entgra.devicemgt.apimgt.extension.rest.api.bean; +package io.entgra.device.mgt.core.apimgt.extension.rest.api.bean; /** * This class represents the data that are required to register diff --git a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/constants/Constants.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/constants/Constants.java similarity index 57% rename from components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/constants/Constants.java rename to components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/constants/Constants.java index 73b4a3a842..11b056298a 100644 --- a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/constants/Constants.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/constants/Constants.java @@ -1,4 +1,22 @@ -package io.entgra.devicemgt.apimgt.extension.rest.api.constants; +/* + * Copyright (c) 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.entgra.device.mgt.core.apimgt.extension.rest.api.constants; public final class Constants { @@ -7,7 +25,8 @@ public final class Constants { public static final String EMPTY_STRING = ""; public static final String CLIENT_NAME = "rest_api_publisher_code"; - public static final String OWNER = "admin"; + public static final String SERVER_USER = "WorkflowConfigurations.ServerUser"; + public static final String SERVER_PASSWORD = "ServerPassword"; public static final String GRANT_TYPE = "client_credentials password refresh_token"; public static final String REFRESH_TOKEN_GRANT_TYPE_PARAM_NAME = "refresh_token"; public static final String OAUTH_EXPIRES_IN = "expires_in"; @@ -16,14 +35,10 @@ public final class Constants { public static final String REFRESH_TOKEN_GRANT_TYPE = "refresh_token"; public static final String SCOPE_PARAM_NAME = "scope"; public static final String SCOPES = "apim:api_create apim:api_view apim:shared_scope_manage"; - + public static final String DCR_END_POINT = "WorkflowConfigurations.DCREndPoint"; + public static final String TOKE_END_POINT = "WorkflowConfigurations.TokenEndPoint"; public static final String ADAPTER_CONF_KEEP_ALIVE = "keepAlive"; public static final int ADAPTER_CONF_DEFAULT_KEEP_ALIVE = 60000; - - public static final String DEFAULT_CALLBACK = ""; - public static final String DEFAULT_PASSWORD = ""; - public static final String TOKEN_SCOPE = "production"; - public static final String APPLICATION_NAME_PREFIX = "OutputAdapter_"; public static final String CLIENT_ID = "clientId"; public static final String CLIENT_SECRET = "clientSecret"; @@ -38,6 +53,10 @@ public final class Constants { public static final String PASSWORD_GRANT_TYPE_SCOPES = "scopes"; public static final String ACCESS_TOKEN_GRANT_TYPE_PARAM_NAME = "access_token"; public static final String GRANT_TYPE_PARAM_NAME = "grant_type"; + public static final String IOT_CORE_HOST = "iot.core.host"; + public static final String IOT_CORE_HTTPS_PORT = "iot.core.https.port"; + public static final String GET_ALL_SCOPES = "/api/am/publisher/v2/scopes?limit=1000"; + public static final String GET_SCOPE = "/api/am/publisher/v2/scopes/"; } diff --git a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/dto/APIApplicationKey.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/dto/APIApplicationKey.java similarity index 97% rename from components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/dto/APIApplicationKey.java rename to components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/APIApplicationKey.java index cbadf626b2..a4b4660bb8 100644 --- a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/dto/APIApplicationKey.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/dto/APIApplicationKey.java @@ -16,7 +16,7 @@ * under the License. */ -package io.entgra.devicemgt.apimgt.extension.rest.api.dto; +package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto; /** * This holds the consumer application information that return from the register application endpoint diff --git a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/dto/AccessTokenInfo.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/dto/AccessTokenInfo.java similarity index 96% rename from components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/dto/AccessTokenInfo.java rename to components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/dto/AccessTokenInfo.java index 061e7e898d..95bc2b34ba 100644 --- a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/dto/AccessTokenInfo.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/dto/AccessTokenInfo.java @@ -16,7 +16,7 @@ * under the License. */ -package io.entgra.devicemgt.apimgt.extension.rest.api.dto; +package io.entgra.device.mgt.core.apimgt.extension.rest.api.dto; /** * This holds the token information that return from the token endpoint. diff --git a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/exceptions/APIApplicationServicesException.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/exceptions/APIServicesException.java similarity index 63% rename from components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/exceptions/APIApplicationServicesException.java rename to components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/exceptions/APIServicesException.java index 35a247a190..3b9c4cfc7d 100644 --- a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/exceptions/APIApplicationServicesException.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/exceptions/APIServicesException.java @@ -16,23 +16,23 @@ * under the License. */ -package io.entgra.devicemgt.apimgt.extension.rest.api.exceptions; +package io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions; -public class APIApplicationServicesException extends Exception { +public class APIServicesException extends Exception { - public APIApplicationServicesException() { + public APIServicesException() { super(); } - public APIApplicationServicesException(String message) { - super(); + public APIServicesException(String message) { + super(message); } - public APIApplicationServicesException(String message, Throwable cause) { - super(); + public APIServicesException(String message, Throwable cause) { + super(message); } - public APIApplicationServicesException(Throwable cause) { - super(); + public APIServicesException(Throwable cause) { + super(cause); } } diff --git a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/exceptions/BadRequestException.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/exceptions/BadRequestException.java similarity index 93% rename from components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/exceptions/BadRequestException.java rename to components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/exceptions/BadRequestException.java index 25cebe82fc..6aa9be1130 100644 --- a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/exceptions/BadRequestException.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/exceptions/BadRequestException.java @@ -19,7 +19,7 @@ /** * Custom exception class for handling bad request exceptions. */ -package io.entgra.devicemgt.apimgt.extension.rest.api.exceptions; +package io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions; public class BadRequestException extends Exception { diff --git a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/internal/PublisherRESTAPIDataHolder.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/internal/PublisherRESTAPIDataHolder.java similarity index 52% rename from components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/internal/PublisherRESTAPIDataHolder.java rename to components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/internal/PublisherRESTAPIDataHolder.java index 9545a94fb4..18398af9d5 100644 --- a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/internal/PublisherRESTAPIDataHolder.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/internal/PublisherRESTAPIDataHolder.java @@ -16,17 +16,22 @@ * under the License. */ -package io.entgra.devicemgt.apimgt.extension.rest.api.internal; +package io.entgra.device.mgt.core.apimgt.extension.rest.api.internal; -import io.entgra.devicemgt.apimgt.extension.rest.api.APIApplicationServices; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices; +import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService; public class PublisherRESTAPIDataHolder { - private static final PublisherRESTAPIDataHolder thisInstance = new PublisherRESTAPIDataHolder(); - private APIApplicationServices apiApplicationServices; + private APIManagerConfigurationService apiManagerConfigurationService; + + private static PublisherRESTAPIDataHolder thisInstance = new PublisherRESTAPIDataHolder(); + + private PublisherRESTAPIDataHolder() { + } - public static PublisherRESTAPIDataHolder getInstance() { + static PublisherRESTAPIDataHolder getInstance() { return thisInstance; } @@ -38,4 +43,15 @@ public class PublisherRESTAPIDataHolder { this.apiApplicationServices = apiApplicationServices; } + public void setAPIManagerConfiguration(APIManagerConfigurationService apiManagerConfigurationService) { + this.apiManagerConfigurationService = apiManagerConfigurationService; + } + + public APIManagerConfigurationService getAPIManagerConfigurationService() { + if (apiManagerConfigurationService == null) { + throw new IllegalStateException("API Manager Configuration service is not initialized properly"); + } + return apiManagerConfigurationService; + } + } diff --git a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/internal/PublisherRESTAPIServiceComponent.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/internal/PublisherRESTAPIServiceComponent.java similarity index 59% rename from components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/internal/PublisherRESTAPIServiceComponent.java rename to components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/internal/PublisherRESTAPIServiceComponent.java index fdf74638c6..989a547729 100644 --- a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/internal/PublisherRESTAPIServiceComponent.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/internal/PublisherRESTAPIServiceComponent.java @@ -16,18 +16,25 @@ * under the License. */ -package io.entgra.devicemgt.apimgt.extension.rest.api.internal; +package io.entgra.device.mgt.core.apimgt.extension.rest.api.internal; -import io.entgra.devicemgt.apimgt.extension.rest.api.APIApplicationServices; -import io.entgra.devicemgt.apimgt.extension.rest.api.APIApplicationServicesImpl; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServicesImpl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; +import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService; /** - * @scr.component name="io.entgra.devicemgt.apimgt.extension.rest.api.internal.PublisherRESTAPIServiceComponent" + * @scr.component name="internal.io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServiceComponent" * immediate="true" + * @scr.reference name="user.apimanagerconfigurationservice.default" + * interface="org.wso2.carbon.apimgt.impl.APIManagerConfigurationService" + * cardinality="1..1" + * policy="dynamic" + * bind="setAPIManagerConfigurationService" + * unbind="unsetAPIManagerConfigurationService" */ public class PublisherRESTAPIServiceComponent { @@ -55,4 +62,18 @@ public class PublisherRESTAPIServiceComponent { protected void deactivate(ComponentContext componentContext) { //do nothing } + + protected void setAPIManagerConfigurationService(APIManagerConfigurationService apiManagerConfigurationService) { + if (log.isDebugEnabled()) { + log.debug("Setting API Manager Configuration Service"); + } + PublisherRESTAPIDataHolder.getInstance().setAPIManagerConfiguration(apiManagerConfigurationService); + } + + protected void unsetAPIManagerConfigurationService(APIManagerConfigurationService apiManagerConfigurationService) { + if (log.isDebugEnabled()) { + log.debug("Unsetting API Manager Configuration Service"); + } + PublisherRESTAPIDataHolder.getInstance().setAPIManagerConfiguration(null); + } } diff --git a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/util/ScopeUtils.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/util/ScopeUtils.java similarity index 96% rename from components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/util/ScopeUtils.java rename to components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/util/ScopeUtils.java index 5716ebfcb1..18944c945c 100644 --- a/components/apimgt-extensions/io.entgra.devicemgt.apimgt.extension.rest.api/src/main/java/io/entgra/devicemgt/apimgt/extension/rest/api/util/ScopeUtils.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/util/ScopeUtils.java @@ -16,7 +16,7 @@ * under the License. */ -package io.entgra.devicemgt.apimgt.extension.rest.api.util; +package io.entgra.device.mgt.core.apimgt.extension.rest.api.util; /** * This class represents the scope data. diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml index d1bc922c54..21c7df3235 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml @@ -124,7 +124,7 @@ org.wso2.carbon.devicemgt - io.entgra.devicemgt.apimgt.extension.rest.api + io.entgra.device.mgt.core.apimgt.extension.rest.api provided @@ -174,9 +174,9 @@ org.scannotation;version="1.0", org.scannotation.archiveiterator;version="1.0", org.w3c.dom, - io.entgra.devicemgt.apimgt.extension.rest.api, - io.entgra.devicemgt.apimgt.extension.rest.api.dto, - io.entgra.devicemgt.apimgt.extension.rest.api.exceptions, + io.entgra.device.mgt.core.apimgt.extension.rest.api, + io.entgra.device.mgt.core.apimgt.extension.rest.api.dto, + io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions, org.wso2.carbon.apimgt.annotations.api, org.wso2.carbon.apimgt.api, org.wso2.carbon.apimgt.api.model, diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherService.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherService.java index fd111a46de..a7299501bd 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherService.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherService.java @@ -18,6 +18,7 @@ */ package org.wso2.carbon.apimgt.webapp.publisher; + import org.wso2.carbon.apimgt.webapp.publisher.exception.APIManagerPublisherException; /** diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java index 5452a4f8bd..ef429bbf50 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -18,13 +18,13 @@ */ package org.wso2.carbon.apimgt.webapp.publisher; -import io.entgra.devicemgt.apimgt.extension.rest.api.APIApplicationServices; -import io.entgra.devicemgt.apimgt.extension.rest.api.APIApplicationServicesImpl; -import io.entgra.devicemgt.apimgt.extension.rest.api.PublisherRESTAPIServices; -import io.entgra.devicemgt.apimgt.extension.rest.api.dto.APIApplicationKey; -import io.entgra.devicemgt.apimgt.extension.rest.api.dto.AccessTokenInfo; -import io.entgra.devicemgt.apimgt.extension.rest.api.exceptions.APIApplicationServicesException; -import io.entgra.devicemgt.apimgt.extension.rest.api.exceptions.BadRequestException; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServicesImpl; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServices; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; +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 org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -373,7 +373,7 @@ public class APIPublisherServiceImpl implements APIPublisherService { apiApplicationKey = apiApplicationServices.createAndRetrieveApplicationCredentials(); accessTokenInfo = apiApplicationServices.generateAccessTokenFromRegisteredApplication( apiApplicationKey.getClientId(), apiApplicationKey.getClientSecret()); - } catch (APIApplicationServicesException e) { + } catch (APIServicesException e) { String errorMsg = "Error while generating application"; log.error(errorMsg, e); throw new APIManagerPublisherException(e); @@ -436,7 +436,8 @@ public class APIPublisherServiceImpl implements APIPublisherService { for (int i = 0; i < scopeList.length(); i++) { JSONObject scopeObj = null; scopeObj = scopeList.getJSONObject(i); - if (scopeObj.getString("name").equals(scopeMapping[2] != null ? StringUtils.trim(scopeMapping[2]) : StringUtils.EMPTY)) { + if (scopeObj.getString("name").equals(scopeMapping[2] != null ? + StringUtils.trim(scopeMapping[2]) : StringUtils.EMPTY)) { jsonObject = scopeObj; } } @@ -454,20 +455,22 @@ public class APIPublisherServiceImpl implements APIPublisherService { } } catch (IOException | DirectoryIteratorException ex) { log.error("failed to read scopes from file.", ex); - } catch (APIApplicationServicesException | BadRequestException e) { - String errorMsg = "Error while Calling APIs"; + } catch (APIServicesException | BadRequestException e) { + String errorMsg = "Error while calling APIs"; log.error(errorMsg, e); throw new APIManagerPublisherException(e); } } } - catch (APIApplicationServicesException e) { - log.error(e); - throw new RuntimeException(e); + catch (APIServicesException e) { + String errorMsg = "Error while processing Publisher REST API response"; + log.error(errorMsg, e); + throw new APIManagerPublisherException(e); } catch (BadRequestException e) { - log.error(e); - throw new RuntimeException(e); + String errorMsg = "Error while calling Publisher REST APIs"; + log.error(errorMsg, e); + throw new APIManagerPublisherException(e); } finally { PrivilegedCarbonContext.endTenantFlow(); } diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index c4bfc0d36d..c2586135da 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -40,7 +40,7 @@ org.wso2.carbon.apimgt.keymgt.extension org.wso2.carbon.apimgt.keymgt.extension.api io.entgra.device.mgt.core.apimgt.analytics.extension - io.entgra.devicemgt.apimgt.extension.rest.api + io.entgra.device.mgt.core.apimgt.extension.rest.api diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml index b6344f6e45..de2739b199 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml @@ -51,6 +51,10 @@ io.swagger swagger-annotations + + org.wso2.carbon.devicemgt + io.entgra.device.mgt.core.apimgt.extension.rest.api + @@ -143,6 +147,9 @@ io.swagger:swagger-annotations:${swagger.version} + + org.wso2.carbon.devicemgt:io.entgra.device.mgt.core.apimgt.extension.rest.api:${carbon.device.mgt.version} + org.wso2.carbon.core.server:${carbon.kernel.version} diff --git a/pom.xml b/pom.xml index e52350555b..e968600416 100644 --- a/pom.xml +++ b/pom.xml @@ -240,7 +240,7 @@ org.wso2.carbon.devicemgt - io.entgra.devicemgt.apimgt.extension.rest.api + io.entgra.device.mgt.core.apimgt.extension.rest.api ${carbon.device.mgt.version}