diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/DeviceManagementConfigService.java b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/DeviceManagementConfigService.java index 14e0e1ded1..2cf90d4659 100644 --- a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/DeviceManagementConfigService.java +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/DeviceManagementConfigService.java @@ -194,4 +194,30 @@ public interface DeviceManagementConfigService { value = "The device transfer request", required = true) DeviceTransferRequest deviceTransferRequest); + + @GET + @Path("/ui-config") + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + produces = MediaType.APPLICATION_JSON, + httpMethod = "GET", + value = "get application management UI configuration", + notes = "This will get all UI configuration of application management" + ) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Successfully got UI config."), + @ApiResponse( + code = 404, + message = "Not Found. There doesn't have an defined UI config." + + "query."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Error occurred while getting the UI config.", + response = ErrorResponse.class) + }) + Response getUiConfig(); } diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java index 6fac3b8d8d..11fc0a2677 100644 --- a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java @@ -38,6 +38,8 @@ import org.wso2.carbon.device.mgt.core.DeviceManagementConstants; import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig; import org.wso2.carbon.device.mgt.core.config.keymanager.KeyManagerConfigurations; +import org.wso2.carbon.device.mgt.core.config.ui.UIConfiguration; +import org.wso2.carbon.device.mgt.core.config.ui.UIConfigurationManager; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil; import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; @@ -157,6 +159,26 @@ public class DeviceManagementConfigServiceImpl implements DeviceManagementConfig } } + @GET + @Override + @Consumes("application/json") + @Path("/ui-config") + public Response getUiConfig() { + UIConfigurationManager uiConfigurationManager = UIConfigurationManager.getInstance(); + if (uiConfigurationManager == null) { + String msg = "IoTS UI configuration manager is not initialized."; + log.error(msg); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } + UIConfiguration uiConfiguration = uiConfigurationManager.getUIConfig(); + if (uiConfiguration == null) { + String msg = "IoTS UI configuration is not defined."; + log.error(msg); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } + return Response.status(Response.Status.OK).entity(uiConfiguration).build(); + } + private String parseUriParamsToJSON(String uriParams) { uriParams = uriParams.replaceAll("=", "\":\""); uriParams = uriParams.replaceAll("&", "\",\""); diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/web.xml b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/web.xml index 0c2afe4a6f..6b397c9fbe 100644 --- a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/web.xml +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/web.xml @@ -48,7 +48,8 @@ nonSecuredEndPoints - /api/device-mgt-config/v1.0/configurations + /api/device-mgt-config/v1.0/configurations, + /api/device-mgt-config/v1.0/configurations/ui-config diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ConfigurationManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ConfigurationManagementService.java index 868ae6f169..ce744e42bb 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ConfigurationManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ConfigurationManagementService.java @@ -191,31 +191,4 @@ public interface ConfigurationManagementService { value = "The properties required to update the platform configurations.", required = true) PlatformConfiguration configuration); - - @GET - @Path("/ui-config") - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - produces = MediaType.APPLICATION_JSON, - httpMethod = "GET", - value = "get application management UI configuration", - notes = "This will get all UI configuration of application management" - ) - @ApiResponses( - value = { - @ApiResponse( - code = 200, - message = "OK. \n Successfully got UI config."), - @ApiResponse( - code = 404, - message = "Not Found. There doesn't have an defined UI config." + - "query."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n Error occurred while getting the UI config.", - response = ErrorResponse.class) - }) - Response getUiConfig(); - } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ConfigurationServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ConfigurationServiceImpl.java index d13946498b..3953c53514 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ConfigurationServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ConfigurationServiceImpl.java @@ -93,24 +93,4 @@ public class ConfigurationServiceImpl implements ConfigurationManagementService new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); } } - - @GET - @Override - @Consumes("application/json") - @Path("/ui-config") - public Response getUiConfig() { - UIConfigurationManager uiConfigurationManager = UIConfigurationManager.getInstance(); - if (uiConfigurationManager == null) { - String msg = "IoTS UI configuration manager is not initialized."; - log.error(msg); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); - } - UIConfiguration uiConfiguration = uiConfigurationManager.getUIConfig(); - if (uiConfiguration == null) { - String msg = "IoTS UI configuration is not defined."; - log.error(msg); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); - } - return Response.status(Response.Status.OK).entity(uiConfiguration).build(); - } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/web.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/web.xml index 4c08378ea6..fffbfbdb24 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/web.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/web.xml @@ -48,8 +48,7 @@ nonSecuredEndPoints - /api/device-mgt/v1.0/users/validate, - /api/device-mgt/v1.0/configuration/ui-config + /api/device-mgt/v1.0/users/validate diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerConstants.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerConstants.java index 7cb242ff76..e4ff7fb5bf 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerConstants.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/util/HandlerConstants.java @@ -21,7 +21,7 @@ package io.entgra.ui.request.interceptor.util; public class HandlerConstants { public static final String PUBLISHER_APPLICATION_NAME = "application-mgt-publisher"; public static final String APP_REG_ENDPOINT = "/api-application-registration/register"; - public static final String UI_CONFIG_ENDPOINT = "/api/device-mgt/v1.0/configuration/ui-config"; + public static final String UI_CONFIG_ENDPOINT = "/api/device-mgt-config/v1.0/configurations/ui-config"; public static final String TOKEN_ENDPOINT = "/token"; public static final String INTROSPECT_ENDPOINT = "/oauth2/introspect"; public static final String LOGIN_PAGE = "/login";