From dd353e1bfb9554274a066c1bf32949714e458f54 Mon Sep 17 00:00:00 2001 From: Milan Perera Date: Thu, 8 Dec 2016 20:30:49 +0530 Subject: [PATCH 01/47] Commiting permission-scope mapping improvements --- .../pom.xml | 2 +- .../apimgt/annotations/api/Permission.java | 42 ----- .../carbon/apimgt/annotations/api/Scope.java | 38 +---- .../carbon/apimgt/annotations/api/Scopes.java | 35 +++++ .../lifecycle/util/AnnotationProcessor.java | 79 +++++++++- .../mgt/jaxrs/api/CertificateMgtService.java | 37 +++-- .../CertificateManagementAdminService.java | 73 +++++---- .../api/ActivityInfoProviderService.java | 47 +++--- .../api/ConfigurationManagementService.java | 36 +++-- .../mgt/jaxrs/service/api/Dashboard.java | 143 ++++++++---------- .../ApplicationManagementAdminService.java | 1 - ...DeviceAccessAuthorizationAdminService.java | 1 - .../SecurityDefinitionConfigurator.java | 4 + .../device/mgt/jaxrs/util/Constants.java | 1 + .../permission/AnnotationProcessor.java | 105 +++++++++---- pom.xml | 4 +- 16 files changed, 365 insertions(+), 283 deletions(-) delete mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/src/main/java/org/wso2/carbon/apimgt/annotations/api/Permission.java create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/src/main/java/org/wso2/carbon/apimgt/annotations/api/Scopes.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml index 339110eac7..fd9e89ee02 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml @@ -79,7 +79,7 @@ javax.servlet, javax.xml.*, javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, - org.apache.commons.lang, + org.apache.commons.lang scribe;scope=compile|runtime;inline=false; diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/src/main/java/org/wso2/carbon/apimgt/annotations/api/Permission.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/src/main/java/org/wso2/carbon/apimgt/annotations/api/Permission.java deleted file mode 100644 index 14d447ac2c..0000000000 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/src/main/java/org/wso2/carbon/apimgt/annotations/api/Permission.java +++ /dev/null @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. -* -* Licensed 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 org.wso2.carbon.apimgt.annotations.api; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * This class is the representation of custom developed Permission annotation. - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface Permission { - - /** - * Represents the permission name. - * @return Returns permission name. - */ - String name(); - - /** - * Represents the permission string. - * @return Returns permission string. - */ - String permission(); - -} \ No newline at end of file diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/src/main/java/org/wso2/carbon/apimgt/annotations/api/Scope.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/src/main/java/org/wso2/carbon/apimgt/annotations/api/Scope.java index 9e0068635b..701a6f183c 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/src/main/java/org/wso2/carbon/apimgt/annotations/api/Scope.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/src/main/java/org/wso2/carbon/apimgt/annotations/api/Scope.java @@ -1,21 +1,3 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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 org.wso2.carbon.apimgt.annotations.api; import java.lang.annotation.ElementType; @@ -24,28 +6,18 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * This class is the representation of custom developed Permission annotation. + * This class is the representation of custom developed Scopes annotation. */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface Scope { - /** - * Represents the scope key which should be unique. - * @return Returns scope key. - */ - String key(); - - /** - * Represents the scope name. - * @return Returns scope name. - */ String name(); - /** - * Represents the scope description. - * @return Returns scope description. - */ String description(); + String key(); + + String[] permissions(); + } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/src/main/java/org/wso2/carbon/apimgt/annotations/api/Scopes.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/src/main/java/org/wso2/carbon/apimgt/annotations/api/Scopes.java new file mode 100644 index 0000000000..ebbda6f9d4 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/src/main/java/org/wso2/carbon/apimgt/annotations/api/Scopes.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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 org.wso2.carbon.apimgt.annotations.api; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * This class is the representation of custom developed Scopes annotation. + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface Scopes { + + Scope[] scopes(); + +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java index d36e1442f4..86fe381693 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java @@ -16,10 +16,12 @@ package org.wso2.carbon.apimgt.webapp.publisher.lifecycle.util; +import io.swagger.annotations.ApiOperation; import io.swagger.annotations.SwaggerDefinition; import org.apache.catalina.core.StandardContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.apimgt.api.model.Scope; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherUtil; import org.wso2.carbon.apimgt.webapp.publisher.config.APIResource; import org.wso2.carbon.apimgt.webapp.publisher.config.APIResourceConfiguration; @@ -37,9 +39,7 @@ import java.net.URI; import java.net.URL; import java.security.AccessController; import java.security.PrivilegedAction; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; +import java.util.*; public class AnnotationProcessor { @@ -58,9 +58,13 @@ public class AnnotationProcessor { private static final String SWAGGER_ANNOTATIONS_EXTENSIONS = "extensions"; private static final String SWAGGER_ANNOTATIONS_PROPERTIES = "properties"; private static final String SWAGGER_ANNOTATIONS_PROPERTIES_NAME = "name"; + private static final String SWAGGER_ANNOTATIONS_PROPERTIES_DESCRIPTION = "description"; + private static final String SWAGGER_ANNOTATIONS_PROPERTIES_KEY = "key"; + private static final String SWAGGER_ANNOTATIONS_PROPERTIES_PERMISSIONS = "permissions"; private static final String SWAGGER_ANNOTATIONS_PROPERTIES_VERSION = "version"; private static final String SWAGGER_ANNOTATIONS_PROPERTIES_CONTEXT = "context"; private static final String SWAGGER_ANNOTATIONS_PROPERTIES_VALUE = "value"; + private static final String ANNOTATIONS_SCOPES = "scopes"; private StandardContext context; @@ -75,6 +79,10 @@ public class AnnotationProcessor { private Class tagClass; private Class extensionClass; private Class extensionPropertyClass; + private Class apiOperation; + private Class scopeClass; + private Class scopesClass; + private Map apiScopes; public AnnotationProcessor(final StandardContext context) { servletContext = context.getServletContext(); @@ -91,7 +99,13 @@ public class AnnotationProcessor { extensionClass = (Class)classLoader .loadClass((io.swagger.annotations.Extension.class.getName())); extensionPropertyClass = (Class)classLoader - .loadClass((io.swagger.annotations.ExtensionProperty.class.getName())); + .loadClass(io.swagger.annotations.ExtensionProperty.class.getName()); + scopeClass = (Class) classLoader + .loadClass(org.wso2.carbon.apimgt.annotations.api.Scope.class.getName()); + scopesClass = (Class) classLoader + .loadClass(org.wso2.carbon.apimgt.annotations.api.Scopes.class.getName()); + apiOperation = (Class)classLoader + .loadClass((io.swagger.annotations.ApiOperation.class.getName())); } catch (ClassNotFoundException e) { log.error("An error has occurred while loading classes ", e); } @@ -127,6 +141,7 @@ public class AnnotationProcessor { } try { apiResourceConfig = processAPIAnnotation(swaggerDefinition); + apiScopes = processAPIScopes(swaggerDefinition); if(apiResourceConfig != null){ String rootContext = servletContext.getContextPath(); pathClazzMethods = pathClazz.getMethods(); @@ -158,7 +173,7 @@ public class AnnotationProcessor { } catch (ClassNotFoundException e1) { String msg = "Failed to load service class " + className + " for publishing APIs." + " This API will not be published."; - log.error(msg); + log.error(msg, e1); } catch (RuntimeException e) { log.error("Unexpected error has been occurred while publishing "+ className +"hence, this API will not be published."); @@ -174,6 +189,37 @@ public class AnnotationProcessor { return apiResourceConfigs; } + private Map processAPIScopes(Annotation annotation) throws Throwable { + Map scopes = new HashMap<>(); + + InvocationHandler methodHandler = Proxy.getInvocationHandler(annotation); + Annotation[] annotatedScopes = (Annotation[]) methodHandler.invoke(annotation, scopesClass + .getMethod(ANNOTATIONS_SCOPES, null), null); + + Scope scope; + String permissions[]; + StringBuilder aggregatedPermissions = new StringBuilder(); + for(int i=0; i apiOperation; private Class authorizationClass; private Class authorizationScopeClass; + private Class extensionClass; + private Class extensionPropertyClass; + private Class scopeClass; + private Class scopesClass; + private Map apiScopes; public AnnotationProcessor(final StandardContext context) { @@ -90,6 +96,15 @@ public class AnnotationProcessor { .loadClass((io.swagger.annotations.Authorization.class.getName())); authorizationScopeClass = (Class)classLoader .loadClass((io.swagger.annotations.AuthorizationScope.class.getName())); + extensionClass = (Class)classLoader + .loadClass((io.swagger.annotations.Extension.class.getName())); + extensionPropertyClass = (Class)classLoader + .loadClass(io.swagger.annotations.ExtensionProperty.class.getName()); + scopeClass = (Class) classLoader + .loadClass(org.wso2.carbon.apimgt.annotations.api.Scope.class.getName()); + scopesClass = (Class) classLoader + .loadClass(org.wso2.carbon.apimgt.annotations.api.Scopes.class.getName()); + } catch (ClassNotFoundException e) { log.error("An error has occurred while loading classes ", e); } @@ -135,6 +150,7 @@ public class AnnotationProcessor { try { clazz = classLoader.loadClass(className); Annotation apiAnno = clazz.getAnnotation(apiClazz); + apiScopes = processAPIScopes(apiAnno); List resourceList; if (apiAnno != null) { if (log.isDebugEnabled()) { @@ -165,7 +181,9 @@ public class AnnotationProcessor { } } } catch (ClassNotFoundException e) { - log.error("Error when passing the api annotation for device type apis."); + log.error("Error when passing the api annotation for device type apis.", e); + } catch (Throwable e) { + log.error("Error when passing the scopes annotation for device type apis.", e); } return apiPermissions; } @@ -342,28 +360,53 @@ public class AnnotationProcessor { private void setPermission(Annotation currentMethod, Permission permission) throws Throwable { InvocationHandler methodHandler = Proxy.getInvocationHandler(currentMethod); - Annotation[] authorizations = (Annotation[]) methodHandler.invoke(currentMethod - , apiOperation.getMethod(SWAGGER_ANNOTATIONS_AUTHORIZATIONS,null),null); - for(int i=0; i processAPIScopes(Annotation annotation) throws Throwable { + Map scopes = new HashMap<>(); + + InvocationHandler methodHandler = Proxy.getInvocationHandler(annotation); + Annotation[] annotatedScopes = (Annotation[]) methodHandler.invoke(annotation, scopesClass + .getMethod(ANNOTATIONS_SCOPES, null), null); + + Scope scope; + String permissions[]; + StringBuilder aggregatedPermissions = new StringBuilder(); + for(int i=0; i 5.2.2 - 5.1.3 + 5.2.7 5.1.1 @@ -1837,7 +1837,7 @@ [2.6.0,3.0.0) - 6.0.5 + 6.1.2-SNAPSHOT (5.0.0,7.0.0] From 36ee55f493d9ea22d21d558ad28aa096beae3656 Mon Sep 17 00:00:00 2001 From: Milan Perera Date: Wed, 14 Dec 2016 08:45:42 +0530 Subject: [PATCH 02/47] Implemented permission-scope mapping for IoTs --- .../lifecycle/util/AnnotationProcessor.java | 7 ++-- .../ApplicationManagementAdminService.java | 33 ++++++++++++------- .../admin/DeviceManagementAdminService.java | 23 +++++++++---- .../admin/GroupManagementAdminService.java | 23 +++++++++---- .../permission/AnnotationProcessor.java | 5 ++- pom.xml | 4 +-- 6 files changed, 66 insertions(+), 29 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java index 86fe381693..54f1c416d3 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java @@ -134,6 +134,7 @@ public class AnnotationProcessor { try { clazz = classLoader.loadClass(className); Annotation swaggerDefinition = clazz.getAnnotation(apiClazz); + Annotation Scopes = clazz.getAnnotation(scopesClass); List resourceList; if (swaggerDefinition != null) { if (log.isDebugEnabled()) { @@ -141,7 +142,9 @@ public class AnnotationProcessor { } try { apiResourceConfig = processAPIAnnotation(swaggerDefinition); - apiScopes = processAPIScopes(swaggerDefinition); + if (Scopes != null) { + apiScopes = processAPIScopes(Scopes); + } if(apiResourceConfig != null){ String rootContext = servletContext.getContextPath(); pathClazzMethods = pathClazz.getMethods(); @@ -214,7 +217,7 @@ public class AnnotationProcessor { aggregatedPermissions.append(permission); aggregatedPermissions.append(" "); } - scope.setRoles(aggregatedPermissions.toString()); + scope.setRoles(aggregatedPermissions.toString().trim()); scopes.put(scope.getKey(), scope); } return scopes; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java index 6f462837c2..8f49261202 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java @@ -19,9 +19,12 @@ package org.wso2.carbon.device.mgt.jaxrs.service.api.admin; import io.swagger.annotations.*; +import org.wso2.carbon.apimgt.annotations.api.*; +import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.jaxrs.beans.ApplicationWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.ws.rs.Consumes; import javax.ws.rs.POST; @@ -49,6 +52,16 @@ import javax.ws.rs.core.Response; @Api(value = "Application Management Administrative Service", description = "This an API intended to be used by " + "'internal' components to log in as an admin user and do a selected number of operations. " + "Further, this is strictly restricted to admin users only ") +@Scopes( + scopes = { + @Scope( + name = "Manage application", + description = "", + key = "cdmf:manage-application", + permissions = {"/device-mgt/applications/manage"} + ) + } +) @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public interface ApplicationManagementAdminService { @@ -63,12 +76,10 @@ public interface ApplicationManagementAdminService { notes = "This is an internal API that can be used to install an application on a device.", response = Activity.class, tags = "Application Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/applications/manage", description - = "Install/Uninstall applications") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:manage-application") + }) } ) @ApiResponses(value = { @@ -109,12 +120,10 @@ public interface ApplicationManagementAdminService { notes = "This is an internal API that can be used to uninstall an application.", response = Activity.class, tags = "Application Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/applications/manage", description - = "Install/Uninstall applications") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:manage-application") + }) } ) @ApiResponses(value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java index 6266a9b737..a2e80bcbf9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java @@ -31,8 +31,11 @@ import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.validation.constraints.Size; import javax.ws.rs.*; @@ -60,6 +63,16 @@ import javax.ws.rs.core.Response; "Further, this is strictly restricted to admin users only ") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) +@Scopes( + scopes = { + @Scope( + name = "Manage device", + description = "", + key = "cdmf:manage-own-device", + permissions = {"/device-mgt/devices/owning-device/view"} + ) + } +) public interface DeviceManagementAdminService { @GET @@ -71,12 +84,10 @@ public interface DeviceManagementAdminService { response = Device.class, responseContainer = "List", tags = "Device Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", description - = "View Devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:manage-own-device") + }) } ) @ApiResponses(value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java index daffe2a6c5..b5716e9db3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java @@ -33,8 +33,11 @@ import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; import org.apache.axis2.transport.http.HTTPConstants; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceGroupList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; @@ -61,6 +64,16 @@ import javax.ws.rs.core.Response; @Api(value = "Group Management Administrative Service", description = "This an API intended to be used by " + "'internal' components to log in as an admin user and do a selected number of operations. " + "Further, this is strictly restricted to admin users only ") +@Scopes( + scopes = { + @Scope( + name = "View groups", + description = "", + key = "cdmf:view-groups", + permissions = {"/device-mgt/admin/groups/view"} + ) + } +) public interface GroupManagementAdminService { @GET @@ -70,12 +83,10 @@ public interface GroupManagementAdminService { value = "Get the list of groups.", notes = "Returns all groups enrolled with the system.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/admin/groups/view", description - = "View Groups") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:view-groups") + }) } ) @ApiResponses(value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/AnnotationProcessor.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/AnnotationProcessor.java index c28604fc4c..ee2ebb4c2e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/AnnotationProcessor.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/AnnotationProcessor.java @@ -150,7 +150,10 @@ public class AnnotationProcessor { try { clazz = classLoader.loadClass(className); Annotation apiAnno = clazz.getAnnotation(apiClazz); - apiScopes = processAPIScopes(apiAnno); + Annotation scopesAnno = clazz.getAnnotation(scopesClass); + if (scopesAnno != null) { + apiScopes = processAPIScopes(scopesAnno); + } List resourceList; if (apiAnno != null) { if (log.isDebugEnabled()) { diff --git a/pom.xml b/pom.xml index d3c359fff7..5f59f54b6a 100644 --- a/pom.xml +++ b/pom.xml @@ -1812,7 +1812,7 @@ 5.2.2 - 5.2.7 + 5.1.1 5.1.1 @@ -1837,7 +1837,7 @@ [2.6.0,3.0.0) - 6.1.2-SNAPSHOT + 6.0.6-SNAPSHOT (5.0.0,7.0.0] From fe2b6b5993bdb08909e60aa0646e336bbc54789b Mon Sep 17 00:00:00 2001 From: amalhub Date: Wed, 7 Dec 2016 14:30:23 +0530 Subject: [PATCH 03/47] IOTS-292: Adding verification services needed for gataway handler --- .../CertificateManagementAdminService.java | 75 +++++++++++++++++++ ...CertificateManagementAdminServiceImpl.java | 71 ++++++++++++++++++ .../api/util/CertificateMgtAPIUtils.java | 17 +++++ 3 files changed, 163 insertions(+) diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java index b867998c18..a273a52fd2 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java @@ -316,4 +316,79 @@ public interface CertificateManagementAdminService { defaultValue = "12438035315552875930") @PathParam("serialNumber") String serialNumber); + /** + * Verify IOS Certificate for the API security filter + * + * @param certificate to be verified as a String + * @return Status of the certificate verification. + */ + @POST + @Path("/verify/ios") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + produces = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Verify IOS SSL certificate", + notes = "Verify IOS Certificate for the API security filter.\n", + tags = "Certificate Management") + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "Return the status of the IOS certificate verification.", + responseHeaders = { + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error.", + response = ErrorResponse.class) + }) + @Permission(name = "Manage certificates", permission = "/device-mgt/certificates/manage") + Response verifyIOSCertificate( + @ApiParam( + name = "certificate", + value = "The properties to verify certificate. It includes the following: \n" + + "serial: The unique ID of the certificate. (optional) \n" + + "pem: mdm-signature of the certificate", + required = true) EnrollmentCertificate certificate); + + /** + * Verify Android Certificate for the API security filter + * + * @param certificate to be verified as a String + * @return Status of the certificate verification. + */ + @POST + @Path("/verify/android") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + produces = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Verify Android SSL certificate", + notes = "Verify Android Certificate for the API security filter.\n", + tags = "Certificate Management") + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "Return the status of the Android certificate verification.", + responseHeaders = { + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error.", + response = ErrorResponse.class) + }) + @Permission(name = "Manage certificates", permission = "/device-mgt/certificates/manage") + Response verifyAndroidCertificate( + @ApiParam( + name = "certificate", + value = "The properties to verify certificate. It includes the following: \n" + + "serial: The unique ID of the certificate. (optional) \n" + + "pem: pem String of the certificate", + required = true) EnrollmentCertificate certificate); } diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/impl/CertificateManagementAdminServiceImpl.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/impl/CertificateManagementAdminServiceImpl.java index e0f0852787..0b7b7210e8 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/impl/CertificateManagementAdminServiceImpl.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/impl/CertificateManagementAdminServiceImpl.java @@ -1,5 +1,6 @@ package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.impl; +import io.swagger.annotations.ApiParam; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.CertificateManagementAdminService; @@ -11,9 +12,14 @@ import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.util.RequestValidationUtil import org.wso2.carbon.certificate.mgt.core.dto.CertificateResponse; import org.wso2.carbon.certificate.mgt.core.exception.CertificateManagementException; import org.wso2.carbon.certificate.mgt.core.exception.KeystoreException; +import org.wso2.carbon.certificate.mgt.core.scep.SCEPException; +import org.wso2.carbon.certificate.mgt.core.scep.SCEPManager; +import org.wso2.carbon.certificate.mgt.core.scep.TenantedDeviceWrapper; import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService; import org.wso2.carbon.certificate.mgt.core.service.PaginationResult; import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; import javax.ws.rs.*; import javax.ws.rs.core.Response; @@ -25,6 +31,7 @@ import java.util.List; public class CertificateManagementAdminServiceImpl implements CertificateManagementAdminService { private static Log log = LogFactory.getLog(CertificateManagementAdminServiceImpl.class); + private static final String PROXY_AUTH_MUTUAL_HEADER = "proxy-mutual-auth-header"; /** * Save a list of certificates and relevant information in the database. @@ -138,4 +145,68 @@ public class CertificateManagementAdminServiceImpl implements CertificateManagem } } + @POST + @Path("/verify/ios") + public Response verifyIOSCertificate(@ApiParam(name = "certificate", value = "Mdm-Signature of the " + + "certificate that needs to be verified", required = true) EnrollmentCertificate certificate) { + try { + CertificateManagementService certMgtService = CertificateMgtAPIUtils.getCertificateManagementService(); + X509Certificate cert = certMgtService.extractCertificateFromSignature(certificate.getPem()); + String challengeToken = certMgtService.extractChallengeToken(cert); + + if (challengeToken != null) { + challengeToken = challengeToken.substring(challengeToken.indexOf("(") + 1).trim(); + + SCEPManager scepManager = CertificateMgtAPIUtils.getSCEPManagerService(); + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId(challengeToken); + deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS); + TenantedDeviceWrapper tenantedDeviceWrapper = scepManager.getValidatedDevice(deviceIdentifier); + + if (tenantedDeviceWrapper != null) { + return Response.status(Response.Status.OK).entity("valid").build(); + } + } + } catch (SCEPException e) { + String msg = "Error occurred while extracting information from certificate."; + log.error(msg, e); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()).build(); + } catch (KeystoreException e) { + String msg = "Error occurred while converting PEM file to X509Certificate."; + log.error(msg, e); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()).build(); + } + return Response.status(Response.Status.OK).entity("invalid").build(); + } + + @POST + @Path("/verify/android") + public Response verifyAndroidCertificate(@ApiParam(name = "certificate", value = "Base64 encoded .pem file of the " + + "certificate that needs to be verified", required = true) EnrollmentCertificate certificate) { + CertificateResponse certificateResponse = null; + try { + CertificateManagementService certMgtService = CertificateMgtAPIUtils.getCertificateManagementService(); + if (certificate.getSerial().toLowerCase().contains(PROXY_AUTH_MUTUAL_HEADER)) { + certificateResponse = certMgtService.verifySubjectDN(certificate.getPem()); + } else { + X509Certificate clientCertificate = certMgtService.pemToX509Certificate(certificate.getPem()); + if (clientCertificate != null) { + certificateResponse = certMgtService.verifyPEMSignature(clientCertificate); + } + } + + if (certificateResponse != null && certificateResponse.getCommonName() != null && !certificateResponse + .getCommonName().isEmpty()) { + return Response.status(Response.Status.OK).entity("valid").build(); + } + } catch (KeystoreException e) { + String msg = "Error occurred while converting PEM file to X509Certificate."; + log.error(msg, e); + return Response.serverError().entity( + new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()).build(); + } + return Response.status(Response.Status.OK).entity("invalid").build(); + } } \ No newline at end of file diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/CertificateMgtAPIUtils.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/CertificateMgtAPIUtils.java index a96b013b7b..06bc3169fe 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/CertificateMgtAPIUtils.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/CertificateMgtAPIUtils.java @@ -20,6 +20,7 @@ package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.certificate.mgt.core.scep.SCEPManager; import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.core.search.mgt.SearchManagerService; @@ -50,6 +51,22 @@ public class CertificateMgtAPIUtils { } + public static SCEPManager getSCEPManagerService() { + + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + SCEPManager scepManagerService = (SCEPManager) + ctx.getOSGiService(SCEPManager.class, null); + + if (scepManagerService == null) { + String msg = "SCEPManagerImpl Management service not initialized."; + log.error(msg); + throw new IllegalStateException(msg); + } + + return scepManagerService; + } + + public static MediaType getResponseMediaType(String acceptHeader) { MediaType responseMediaType; if (acceptHeader == null || MediaType.WILDCARD.equals(acceptHeader)) { From d00817268e9385a9bc1d69d18dd60aa87b986250 Mon Sep 17 00:00:00 2001 From: amalhub Date: Wed, 7 Dec 2016 17:30:38 +0530 Subject: [PATCH 04/47] IOTS-292: Adding the api-mgt handler for gateway change --- .../org.wso2.carbon.apimgt.handlers/pom.xml | 42 +++ .../AuthenticationHandler.java | 227 ++++++++++++ .../invoker/RESTConstants.java | 26 ++ .../invoker/RESTInvoker.java | 343 ++++++++++++++++++ .../invoker/RESTResponse.java | 81 +++++ .../utils/AuthConstants.java | 35 ++ .../utils/CoreUtils.java | 140 +++++++ .../src/main/resources/api-filter-config.xml | 22 ++ components/apimgt-extensions/pom.xml | 1 + pom.xml | 4 + 10 files changed, 921 insertions(+) create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTConstants.java create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTInvoker.java create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTResponse.java create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/api-filter-config.xml diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml new file mode 100644 index 0000000000..b8133bc6d8 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml @@ -0,0 +1,42 @@ + + + + apimgt-extensions + org.wso2.carbon.devicemgt + 1.2.8-SNAPSHOT + + 4.0.0 + + org.wso2.carbon.apimgt.handlers + WSO2 Carbon - API Security Handler Component + + + + org.wso2.carbon + org.wso2.carbon.logging + ${carbon.kernel.version} + + + org.apache.synapse + synapse-core + ${org.apache.synapse.version} + + + org.apache.ws.security.wso2 + wss4j + ${org.apache.ws.security.wso2.version} + + + org.wso2.carbon.devicemgt + org.wso2.carbon.certificate.mgt.core + + + org.json.wso2 + json + ${commons-json.version} + + + + \ No newline at end of file diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java new file mode 100644 index 0000000000..f5c5c80056 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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 org.wso2.carbon.apimgt.handlers; + +import org.apache.axiom.soap.SOAP11Constants; +import org.apache.axiom.soap.SOAP12Constants; +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.description.HandlerDescription; +import org.apache.axis2.description.Parameter; +import org.apache.axis2.engine.Handler; +import org.apache.axis2.namespace.Constants; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.ws.security.WSConstants; +import org.apache.ws.security.WSSecurityException; +import org.apache.ws.security.util.Base64; +import org.json.JSONObject; +import org.wso2.carbon.apimgt.handlers.invoker.RESTInvoker; +import org.wso2.carbon.apimgt.handlers.invoker.RESTResponse; +import org.wso2.carbon.apimgt.handlers.utils.AuthConstants; +import org.wso2.carbon.apimgt.handlers.utils.CoreUtils; + +import javax.xml.namespace.QName; +import java.net.URI; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AuthenticationHandler implements Handler { + private static final Log log = LogFactory.getLog(AuthenticationHandler.class); + private static HandlerDescription EMPTY_HANDLER_METADATA = new HandlerDescription("API Security Handler"); + private HandlerDescription handlerDesc; + private ArrayList apiList; + private RESTInvoker restInvoker; + + /** + * Setting up configurations at the constructor + */ + public AuthenticationHandler() { + log.info("Engaging API Security Handler"); + apiList = CoreUtils.readApiFilterList(); + restInvoker = new RESTInvoker(); + this.handlerDesc = EMPTY_HANDLER_METADATA; + } + + /** + * Handles incoming http/s requests + * + * @param messageContext + * @return response + * @throws AxisFault + */ + public InvocationResponse invoke(MessageContext messageContext) throws AxisFault { + boolean validateRequest = messageContext.getTo() != null; + + if (validateRequest && isSecuredAPI(messageContext)) { + String ctxPath = messageContext.getTo().getAddress().trim(); + CoreUtils.debugLog(log, "Authentication handler invoked by: ", ctxPath); + Map headers = (Map) messageContext.getProperty(MessageContext.TRANSPORT_HEADERS); + + if (headers.containsKey(AuthConstants.MDM_SIGNATURE)) { + String mdmSignature = headers.get(AuthConstants.MDM_SIGNATURE).toString(); + + try { + CoreUtils.debugLog(log, "Verify Cert:\n", mdmSignature); + + URI dcrUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils + .getHttpsPort() + "/dynamic-client-web/register"); + String dcrContent = "{\n" + + "\"owner\":\"" + CoreUtils.getUsername() + "\",\n" + + "\"clientName\":\"emm\",\n" + + "\"grantType\":\"refresh_token password client_credentials\",\n" + + "\"tokenScope\":\"default\"\n" + + "}"; + Map drcHeaders = new HashMap(); + drcHeaders.put("Content-Type", "application/json"); + + RESTResponse response = restInvoker.invokePOST(dcrUrl, drcHeaders, null, + null, dcrContent); + CoreUtils.debugLog(log, "DCR response:", response.getContent()); + JSONObject jsonResponse = new JSONObject(response.getContent()); + String clientId = jsonResponse.getString("client_id"); + String clientSecret = jsonResponse.getString("client_secret"); + + URI tokenUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils + .getHttpsPort() + "/oauth2/token"); + String tokenContent = "grant_type=password&username=" + CoreUtils.getUsername() + "&password=" + + CoreUtils.getPassword() + "&scope=activity-view"; + String tokenBasicAuth = "Basic " + Base64.encode((clientId + ":" + clientSecret).getBytes()); + Map tokenHeaders = new HashMap(); + tokenHeaders.put("Authorization", tokenBasicAuth); + tokenHeaders.put("Content-Type", "application/x-www-form-urlencoded"); + + response = restInvoker.invokePOST(tokenUrl, tokenHeaders, null, + null, tokenContent); + CoreUtils.debugLog(log, "Token response:", response.getContent()); + jsonResponse = new JSONObject(response.getContent()); + String accessToken = jsonResponse.getString("access_token"); + + URI certVerifyUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils + .getHttpsPort() + "/api/certificate-mgt/v1.0/admin/certificates/verify/ios"); + Map certVerifyHeaders = new HashMap(); + certVerifyHeaders.put("Authorization", "Bearer " + accessToken); + certVerifyHeaders.put("Content-Type", "application/json"); + String certVerifyContent = "{\n" + + "\"pem\":\"" + mdmSignature + "\",\n" + + "\"tenantId\": \"-1234\",\n" + + "\"serial\":\"\"\n" + + "}"; + + response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, + null, certVerifyContent); + CoreUtils.debugLog(log, "Verify response:", response.getContent()); + + if (!response.getContent().contains("invalid")) { + return InvocationResponse.CONTINUE; + } + log.warn("Unauthorized request for api: " + ctxPath); + setFaultCodeAndThrowAxisFault(messageContext, new Exception("Unauthorized!")); + return InvocationResponse.SUSPEND; + + } catch (Exception e) { + log.error("Error while processing certificate.", e); + setFaultCodeAndThrowAxisFault(messageContext, e); + return InvocationResponse.SUSPEND; + } + } else { + log.warn("Unauthorized request for api: " + ctxPath); + setFaultCodeAndThrowAxisFault(messageContext, new Exception("SSL required")); + return InvocationResponse.SUSPEND; + } + } else { + return InvocationResponse.CONTINUE; + } + + } + + /** + * API filter + * + * @param messageContext + * @return boolean + */ + private boolean isSecuredAPI(MessageContext messageContext) { + if (messageContext.getTransportIn() != null && + messageContext.getTransportIn().getName().toLowerCase().equals(AuthConstants.HTTPS)) { + for (String path : apiList) { + if (messageContext.getTo().getAddress().trim().contains(path)) { + return true; + } + } + } + return false; + } + + private void setFaultCodeAndThrowAxisFault(MessageContext msgContext, Exception e) throws AxisFault { + + msgContext.setProperty(AuthConstants.SEC_FAULT, Boolean.TRUE); + String soapVersionURI = msgContext.getEnvelope().getNamespace().getNamespaceURI(); + QName faultCode = null; + /* + * Get the faultCode from the thrown WSSecurity exception, if there is one + */ + if (e instanceof WSSecurityException) { + faultCode = ((WSSecurityException) e).getFaultCode(); + } + /* + * Otherwise default to InvalidSecurity + */ + if (faultCode == null) { + faultCode = new QName(WSConstants.INVALID_SECURITY.getNamespaceURI(), + WSConstants.INVALID_SECURITY.getLocalPart(), AuthConstants.WSSE); + } + + if (soapVersionURI.equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) { + + throw new AxisFault(faultCode, e.getMessage(), e); + + } else if (soapVersionURI.equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) { + + List subfaultCodes = new ArrayList(); + subfaultCodes.add(faultCode); + throw new AxisFault(Constants.FAULT_SOAP12_SENDER, subfaultCodes, e.getMessage(), e); + + } + + } + + public void cleanup() { + } + + public void init(HandlerDescription handlerDescription) { + this.handlerDesc = handlerDescription; + } + + public void flowComplete(MessageContext messageContext) { + } + + public HandlerDescription getHandlerDesc() { + return this.handlerDesc; + } + + public String getName() { + return "API security inflow handler"; + } + + public Parameter getParameter(String name) { + return this.handlerDesc.getParameter(name); + } +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTConstants.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTConstants.java new file mode 100644 index 0000000000..c1d0413a70 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTConstants.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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 org.wso2.carbon.apimgt.handlers.invoker; + +public class RESTConstants { + static String REST_CLIENT_CONFIG_ELEMENT = "restClientConfiguration"; + static String REST_CLIENT_MAX_TOTAL_CONNECTIONS = "maxTotalConnections"; + static String REST_CLIENT_MAX_CONNECTIONS_PER_ROUTE = "maxConnectionsPerRoute"; + static String REST_CLEINT_CONNECTION_TIMEOUT = "connectionTimeout"; + static String REST_CLEINT_SOCKET_TIMEOUT = "socketTimeout"; +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTInvoker.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTInvoker.java new file mode 100644 index 0000000000..7873a7fc54 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTInvoker.java @@ -0,0 +1,343 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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 org.wso2.carbon.apimgt.handlers.invoker; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.util.AXIOMUtil; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.http.Header; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.*; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.util.EntityUtils; +import org.wso2.carbon.apimgt.handlers.utils.AuthConstants; +import org.wso2.carbon.apimgt.handlers.utils.CoreUtils; +import org.wso2.carbon.utils.CarbonUtils; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.util.Iterator; +import java.util.Map; + +public class RESTInvoker { + + private static final Log log = LogFactory.getLog(RESTInvoker.class); + + private int maxTotalConnections = 100; + private int maxTotalConnectionsPerRoute = 100; + private int connectionTimeout = 120000; + private int socketTimeout = 120000; + + private CloseableHttpClient client = null; + private PoolingHttpClientConnectionManager connectionManager = null; + + public RESTInvoker() { + configureHttpClient(); + } + + private void parseConfiguration() { + String carbonConfigDirPath = CarbonUtils.getCarbonConfigDirPath(); + String apiFilterConfigPath = carbonConfigDirPath + File.separator + + AuthConstants.AUTH_CONFIGURATION_FILE_NAME; + File configFile = new File(apiFilterConfigPath); + + try { + String configContent = FileUtils.readFileToString(configFile); + OMElement configElement = AXIOMUtil.stringToOM(configContent); + Iterator beans = configElement.getChildrenWithName( + new QName("http://www.springframework.org/schema/beans", "bean")); + + while (beans.hasNext()) { + OMElement bean = (OMElement) beans.next(); + String beanId = bean.getAttributeValue(new QName(null, "id")); + if (beanId.equals(RESTConstants.REST_CLIENT_CONFIG_ELEMENT)) { + Iterator beanProps = bean.getChildrenWithName( + new QName("http://www.springframework.org/schema/beans", "property")); + + while (beanProps.hasNext()) { + OMElement beanProp = (OMElement) beanProps.next(); + String beanName = beanProp.getAttributeValue(new QName(null, "name")); + if (RESTConstants.REST_CLIENT_MAX_TOTAL_CONNECTIONS.equals(beanName)) { + String value = beanProp.getAttributeValue(new QName(null, "value")); + if (value != null && !value.trim().equals("")) { + maxTotalConnections = Integer.parseInt(value); + } + CoreUtils.debugLog(log, "Max total http connections ", maxTotalConnections); + } else if (RESTConstants.REST_CLIENT_MAX_CONNECTIONS_PER_ROUTE.equals(beanName)) { + String value = beanProp.getAttributeValue(new QName(null, "value")); + if (value != null && !value.trim().equals("")) { + maxTotalConnectionsPerRoute = Integer.parseInt(value); + } + CoreUtils.debugLog(log, "Max total client connections per route ", maxTotalConnectionsPerRoute); + } else if (RESTConstants.REST_CLEINT_CONNECTION_TIMEOUT.equals(beanName)) { + String value = beanProp.getAttributeValue(new QName(null, "value")); + if (value != null && !value.trim().equals("")) { + connectionTimeout = Integer.parseInt(value); + } + } else if (RESTConstants.REST_CLEINT_SOCKET_TIMEOUT.equals(beanName)) { + String value = beanProp.getAttributeValue(new QName(null, "value")); + if (value != null && !value.trim().equals("")) { + socketTimeout = Integer.parseInt(value); + } + } + } + } + } + } catch (XMLStreamException e) { + log.error("Error in processing http connection settings, using default settings", e); + } catch (IOException e) { + log.error("Error in processing http connection settings, using default settings", e); + } + } + + private void configureHttpClient() { + + parseConfiguration(); + + RequestConfig defaultRequestConfig = RequestConfig.custom() + .setExpectContinueEnabled(true) + .setConnectTimeout(connectionTimeout) + .setSocketTimeout(socketTimeout) + .build(); + + connectionManager = new PoolingHttpClientConnectionManager(); + connectionManager.setDefaultMaxPerRoute(maxTotalConnectionsPerRoute); + connectionManager.setMaxTotal(maxTotalConnections); + client = HttpClients.custom() + .setConnectionManager(connectionManager) + .setDefaultRequestConfig(defaultRequestConfig) + .build(); + + CoreUtils.debugLog(log, "REST client initialized with ", + "maxTotalConnection = ", maxTotalConnections, + "maxConnectionsPerRoute = ", maxTotalConnectionsPerRoute, + "connectionTimeout = ", connectionTimeout); + } + + public void closeHttpClient() { + IOUtils.closeQuietly(client); + IOUtils.closeQuietly(connectionManager); + } + + /** + * Invokes the http GET method + * + * @param uri endpoint/service url + * @param requestHeaders header list + * @param username username for authentication + * @param password password for authentication + * @return RESTResponse of the GET request (can be the response body or the response status code) + * @throws Exception + */ + public RESTResponse invokeGET(URI uri, Map requestHeaders, String username, String password) throws IOException { + + HttpGet httpGet = null; + CloseableHttpResponse response = null; + Header[] headers; + int httpStatus; + String contentType; + String output; + try { + httpGet = new HttpGet(uri); + if (requestHeaders != null && !requestHeaders.isEmpty()) { + Object keys[] = requestHeaders.keySet().toArray(); + for (Object header : keys) { + httpGet.setHeader(header.toString(), requestHeaders.get(header).toString()); + } + } + response = sendReceiveRequest(httpGet, username, password); + output = IOUtils.toString(response.getEntity().getContent()); + headers = response.getAllHeaders(); + httpStatus = response.getStatusLine().getStatusCode(); + contentType = response.getEntity().getContentType().getValue(); + if (log.isTraceEnabled()) { + log.trace("Invoked GET " + uri.toString() + " - Response message: " + output); + } + EntityUtils.consume(response.getEntity()); + } finally { + if (response != null) { + IOUtils.closeQuietly(response); + } + if (httpGet != null) { + httpGet.releaseConnection(); + } + } + return new RESTResponse(contentType, output, headers, httpStatus); + } + + + public RESTResponse invokePOST(URI uri, Map requestHeaders, String username, + String password, String payload) throws IOException { + + HttpPost httpPost = null; + CloseableHttpResponse response = null; + Header[] headers; + int httpStatus; + String contentType; + String output; + try { + httpPost = new HttpPost(uri); + httpPost.setEntity(new StringEntity(payload)); + if (requestHeaders != null && !requestHeaders.isEmpty()) { + Object keys[] = requestHeaders.keySet().toArray(); + for (Object header : keys) { + httpPost.setHeader(header.toString(), requestHeaders.get(header).toString()); + } + } + response = sendReceiveRequest(httpPost, username, password); + output = IOUtils.toString(response.getEntity().getContent()); + headers = response.getAllHeaders(); + httpStatus = response.getStatusLine().getStatusCode(); + contentType = response.getEntity().getContentType().getValue(); + if (log.isTraceEnabled()) { + log.trace("Invoked POST " + uri.toString() + + " - Input payload: " + payload + " - Response message: " + output); + } + EntityUtils.consume(response.getEntity()); + } finally { + if (response != null) { + IOUtils.closeQuietly(response); + } + if (httpPost != null) { + httpPost.releaseConnection(); + } + } + return new RESTResponse(contentType, output, headers, httpStatus); + } + + /** + * Invokes the http PUT method + * + * @param uri endpoint/service url + * @param requestHeaders header list + * @param username username for authentication + * @param password password for authentication + * @param payload payload body passed + * @return RESTResponse of the PUT request (can be the response body or the response status code) + * @throws Exception + */ + public RESTResponse invokePUT(URI uri, Map requestHeaders, String username, String password, + String payload) throws IOException { + + HttpPut httpPut = null; + CloseableHttpResponse response = null; + Header[] headers; + int httpStatus; + String contentType; + String output; + try { + httpPut = new HttpPut(uri); + httpPut.setEntity(new StringEntity(payload)); + if (requestHeaders != null && !requestHeaders.isEmpty()) { + Object keys[] = requestHeaders.keySet().toArray(); + for (Object header : keys) { + httpPut.setHeader(header.toString(), requestHeaders.get(header).toString()); + } + } + response = sendReceiveRequest(httpPut, username, password); + output = IOUtils.toString(response.getEntity().getContent()); + headers = response.getAllHeaders(); + httpStatus = response.getStatusLine().getStatusCode(); + contentType = response.getEntity().getContentType().getValue(); + if (log.isTraceEnabled()) { + log.trace("Invoked PUT " + uri.toString() + " - Response message: " + output); + } + EntityUtils.consume(response.getEntity()); + } finally { + if (response != null) { + IOUtils.closeQuietly(response); + } + if (httpPut != null) { + httpPut.releaseConnection(); + } + } + return new RESTResponse(contentType, output, headers, httpStatus); + } + + /** + * Invokes the http DELETE method + * + * @param uri endpoint/service url + * @param requestHeaders header list + * @param username username for authentication + * @param password password for authentication + * @return RESTResponse of the DELETE (can be the response status code or the response body) + * @throws Exception + */ + public RESTResponse invokeDELETE(URI uri, Map requestHeaders, String username, String password) throws IOException { + + HttpDelete httpDelete = null; + CloseableHttpResponse response = null; + Header[] headers; + int httpStatus; + String contentType; + String output; + try { + httpDelete = new HttpDelete(uri); + if (requestHeaders != null && !requestHeaders.isEmpty()) { + Object keys[] = requestHeaders.keySet().toArray(); + for (Object header : keys) { + httpDelete.setHeader(header.toString(), requestHeaders.get(header).toString()); + } + } + response = sendReceiveRequest(httpDelete, username, password); + output = IOUtils.toString(response.getEntity().getContent()); + headers = response.getAllHeaders(); + httpStatus = response.getStatusLine().getStatusCode(); + contentType = response.getEntity().getContentType().getValue(); + if (log.isTraceEnabled()) { + log.trace("Invoked DELETE " + uri.toString() + " - Response message: " + output); + } + EntityUtils.consume(response.getEntity()); + } finally { + if (response != null) { + IOUtils.closeQuietly(response); + } + if (httpDelete != null) { + httpDelete.releaseConnection(); + } + } + return new RESTResponse(contentType, output, headers, httpStatus); + } + + private CloseableHttpResponse sendReceiveRequest(HttpRequestBase requestBase, String username, String password) + throws IOException { + CloseableHttpResponse response; + if (username != null && !username.equals("") && password != null) { + String combinedCredentials = username + ":" + password; + byte[] encodedCredentials = Base64.encodeBase64(combinedCredentials.getBytes(StandardCharsets.UTF_8)); + requestBase.addHeader("Authorization", "Basic " + new String(encodedCredentials)); + + response = client.execute(requestBase); + } else { + response = client.execute(requestBase); + } + return response; + } +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTResponse.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTResponse.java new file mode 100644 index 0000000000..7ce0389baa --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTResponse.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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 org.wso2.carbon.apimgt.handlers.invoker; + +import org.apache.http.Header; + +/** + * RESTResponse class holds the data retrieved from the HTTP invoke response. + */ +public class RESTResponse { + private String contentType; + private String content; + private Header[] headers; + private int httpStatus; + + /** + * Constructor + * + * @param contentType from the REST invoke response + * @param content from the REST invoke response + * @param headers from the REST invoke response + * @param httpStatus from the REST invoke response + */ + public RESTResponse(String contentType, String content, Header[] headers, int httpStatus) { + this.contentType = contentType; + this.content = content; + this.headers = headers; + this.httpStatus = httpStatus; + } + + /** + * Get the content type of the EST invoke response + * + * @return String content type of the response + */ + public String getContentType() { + return contentType; + } + + /** + * Get contents of the REST invoke response + * + * @return contents of the REST invoke response + */ + public String getContent() { + return content; + } + + /** + * Get headers of the REST invoke response + * + * @return headers of the REST invoke response + */ + public Header[] getHeaders() { + return headers; + } + + /** + * Get the HTTP Status code from REST invoke response + * + * @return int HTTP status code + */ + public int getHttpStatus() { + return httpStatus; + } +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java new file mode 100644 index 0000000000..b7c9a00dfa --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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 org.wso2.carbon.apimgt.handlers.utils; + +public class AuthConstants { + public static final String SEC_FAULT = "SECURITY_VALIDATION_FAILURE"; + public static final String HTTPS = "https"; + public static final String WSSE = "wsse"; + public static final String SSL_CERT_X509 = "ssl.client.auth.cert.X509"; + public static final String AUTH_CONFIGURATION_FILE_NAME = "api-filter-config.xml"; + public static final String API_FILTER_CONFIG_ELEMENT = "apiFilterConfig"; + public static final String API_LIST_PROPERTY = "apiList"; + public static final String HOST = "host"; + public static final String HTTPS_PORT = "httpsPort"; + public static final String USERNAME = "username"; + public static final String PASSWORD = "password"; + public static final String MDM_SIGNATURE = "mdm-signature"; + public static final String IOS = "ios"; + public static final String ANDROID = "android"; +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java new file mode 100644 index 0000000000..42a7fe9ea7 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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 org.wso2.carbon.apimgt.handlers.utils; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.util.AXIOMUtil; +import org.apache.commons.io.FileUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.utils.CarbonUtils; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; + +public class CoreUtils { + private static final Log log = LogFactory.getLog(CoreUtils.class); + private static String host = "localhost"; + private static int httpsPort = 9443; + private static String username = "admin"; + private static String password = "admin"; + + /** + * Reading configurations from api-filter-config.xml file + * + * @return ArrayList of api contexts + */ + public static ArrayList readApiFilterList() { + ArrayList apiList = new ArrayList(); + String carbonConfigDirPath = CarbonUtils.getCarbonConfigDirPath(); + String apiFilterConfigPath = carbonConfigDirPath + File.separator + + AuthConstants.AUTH_CONFIGURATION_FILE_NAME; + File configFile = new File(apiFilterConfigPath); + + try { + String configContent = FileUtils.readFileToString(configFile); + OMElement configElement = AXIOMUtil.stringToOM(configContent); + Iterator beans = configElement.getChildrenWithName( + new QName("http://www.springframework.org/schema/beans", "bean")); + + while (beans.hasNext()) { + OMElement bean = (OMElement) beans.next(); + String beanId = bean.getAttributeValue(new QName(null, "id")); + if (beanId.equals(AuthConstants.API_FILTER_CONFIG_ELEMENT)) { + Iterator beanProps = bean.getChildrenWithName( + new QName("http://www.springframework.org/schema/beans", "property")); + + while (beanProps.hasNext()) { + OMElement beanProp = (OMElement) beanProps.next(); + String beanName = beanProp.getAttributeValue(new QName(null, "name")); + if (AuthConstants.API_LIST_PROPERTY.equals(beanName)) { + Iterator apiListSet = ((OMElement) beanProp.getChildrenWithLocalName("set").next()) + .getChildrenWithLocalName("value"); + while (apiListSet.hasNext()) { + String apiContext = ((OMElement) apiListSet.next()).getText(); + apiList.add(apiContext); + CoreUtils.debugLog(log, "Adding security to api: ", apiContext); + } + } else if (AuthConstants.HOST.equals(beanName)) { + String value = beanProp.getAttributeValue(new QName(null, "value")); + host = value; + } else if (AuthConstants.HTTPS_PORT.equals(beanName)) { + String value = beanProp.getAttributeValue(new QName(null, "value")); + if (value != null && !value.trim().equals("")) { + httpsPort = Integer.parseInt(value); + } + } else if (AuthConstants.USERNAME.equals(beanName)) { + String value = beanProp.getAttributeValue(new QName(null, "value")); + username = value; + } else if (AuthConstants.PASSWORD.equals(beanName)) { + String value = beanProp.getAttributeValue(new QName(null, "value")); + password = value; + } + } + } + } + } catch (IOException e) { + log.error("Error in reading api filter settings", e); + } catch (XMLStreamException e) { + log.error("Error in reading api filter settings", e); + } + return apiList; + } + + /** + * Universal debug log function + * + * @param logger Log object specific to the class + * @param message initial debug log message + * @param vars optional strings to be appended for the log + */ + public static void debugLog(Log logger, String message, Object ... vars) { + if(logger.isDebugEnabled()) { + if (vars.length < 1) { + logger.debug(message); + return; + } + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(message); + for (Object var : vars) { + stringBuilder.append(var.toString()); + } + logger.debug(stringBuilder.toString()); + } + } + + public static String getHost() { + return host; + } + + public static int getHttpsPort() { + return httpsPort; + } + + public static String getUsername() { + return username; + } + + public static String getPassword() { + return password; + } +} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/api-filter-config.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/api-filter-config.xml new file mode 100644 index 0000000000..8811ccb8e7 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/api-filter-config.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + /services/echo + /abc + + + + + + + + \ No newline at end of file diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index 4086cf5a18..8d486740ee 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -38,6 +38,7 @@ org.wso2.carbon.apimgt.application.extension org.wso2.carbon.apimgt.application.extension.api org.wso2.carbon.apimgt.annotations + org.wso2.carbon.apimgt.handlers diff --git a/pom.xml b/pom.xml index ccb5bf93d3..eeabd51d55 100644 --- a/pom.xml +++ b/pom.xml @@ -1930,6 +1930,10 @@ 1.6.1 + + + 2.1.7-wso2v7 + 1.5.11.wso2v15 From 610163d705e1e4ef575537a856f8d1c54ea31adf Mon Sep 17 00:00:00 2001 From: amalhub Date: Wed, 7 Dec 2016 18:48:20 +0530 Subject: [PATCH 05/47] IOTS-292: Adding IOS synapse config for gatway change --- .../src/main/resources/ios-synapse-config.xml | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/ios-synapse-config.xml diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/ios-synapse-config.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/ios-synapse-config.xml new file mode 100644 index 0000000000..cba71164e1 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/ios-synapse-config.xml @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 871970002aca8d89915d44c32a3658de725e3025 Mon Sep 17 00:00:00 2001 From: amalhub Date: Fri, 9 Dec 2016 11:47:58 +0530 Subject: [PATCH 06/47] IOTS-292: Adding android cert verification for gateway handler --- .../AuthenticationHandler.java | 164 +++++++++++++----- .../utils/AuthConstants.java | 5 +- 2 files changed, 118 insertions(+), 51 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java index f5c5c80056..770ffd1128 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java @@ -30,6 +30,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.ws.security.WSConstants; import org.apache.ws.security.WSSecurityException; import org.apache.ws.security.util.Base64; +import org.json.JSONException; import org.json.JSONObject; import org.wso2.carbon.apimgt.handlers.invoker.RESTInvoker; import org.wso2.carbon.apimgt.handlers.invoker.RESTResponse; @@ -37,7 +38,9 @@ import org.wso2.carbon.apimgt.handlers.utils.AuthConstants; import org.wso2.carbon.apimgt.handlers.utils.CoreUtils; import javax.xml.namespace.QName; +import java.io.IOException; import java.net.URI; +import java.net.URISyntaxException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -68,52 +71,17 @@ public class AuthenticationHandler implements Handler { * @throws AxisFault */ public InvocationResponse invoke(MessageContext messageContext) throws AxisFault { - boolean validateRequest = messageContext.getTo() != null; - - if (validateRequest && isSecuredAPI(messageContext)) { + if (isSecuredAPI(messageContext)) { String ctxPath = messageContext.getTo().getAddress().trim(); CoreUtils.debugLog(log, "Authentication handler invoked by: ", ctxPath); Map headers = (Map) messageContext.getProperty(MessageContext.TRANSPORT_HEADERS); + try { + if (headers.containsKey(AuthConstants.MDM_SIGNATURE)) { - if (headers.containsKey(AuthConstants.MDM_SIGNATURE)) { - String mdmSignature = headers.get(AuthConstants.MDM_SIGNATURE).toString(); - - try { + String mdmSignature = headers.get(AuthConstants.MDM_SIGNATURE).toString(); CoreUtils.debugLog(log, "Verify Cert:\n", mdmSignature); - URI dcrUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils - .getHttpsPort() + "/dynamic-client-web/register"); - String dcrContent = "{\n" + - "\"owner\":\"" + CoreUtils.getUsername() + "\",\n" + - "\"clientName\":\"emm\",\n" + - "\"grantType\":\"refresh_token password client_credentials\",\n" + - "\"tokenScope\":\"default\"\n" + - "}"; - Map drcHeaders = new HashMap(); - drcHeaders.put("Content-Type", "application/json"); - - RESTResponse response = restInvoker.invokePOST(dcrUrl, drcHeaders, null, - null, dcrContent); - CoreUtils.debugLog(log, "DCR response:", response.getContent()); - JSONObject jsonResponse = new JSONObject(response.getContent()); - String clientId = jsonResponse.getString("client_id"); - String clientSecret = jsonResponse.getString("client_secret"); - - URI tokenUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils - .getHttpsPort() + "/oauth2/token"); - String tokenContent = "grant_type=password&username=" + CoreUtils.getUsername() + "&password=" + - CoreUtils.getPassword() + "&scope=activity-view"; - String tokenBasicAuth = "Basic " + Base64.encode((clientId + ":" + clientSecret).getBytes()); - Map tokenHeaders = new HashMap(); - tokenHeaders.put("Authorization", tokenBasicAuth); - tokenHeaders.put("Content-Type", "application/x-www-form-urlencoded"); - - response = restInvoker.invokePOST(tokenUrl, tokenHeaders, null, - null, tokenContent); - CoreUtils.debugLog(log, "Token response:", response.getContent()); - jsonResponse = new JSONObject(response.getContent()); - String accessToken = jsonResponse.getString("access_token"); - + String accessToken = getAccessToken(); URI certVerifyUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils .getHttpsPort() + "/api/certificate-mgt/v1.0/admin/certificates/verify/ios"); Map certVerifyHeaders = new HashMap(); @@ -125,7 +93,7 @@ public class AuthenticationHandler implements Handler { "\"serial\":\"\"\n" + "}"; - response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, + RESTResponse response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, null, certVerifyContent); CoreUtils.debugLog(log, "Verify response:", response.getContent()); @@ -136,14 +104,65 @@ public class AuthenticationHandler implements Handler { setFaultCodeAndThrowAxisFault(messageContext, new Exception("Unauthorized!")); return InvocationResponse.SUSPEND; - } catch (Exception e) { - log.error("Error while processing certificate.", e); - setFaultCodeAndThrowAxisFault(messageContext, e); + } else if (headers.containsKey(AuthConstants.PROXY_MUTUAL_AUTH_HEADER)) { + String subjectDN = headers.get(AuthConstants.PROXY_MUTUAL_AUTH_HEADER).toString(); + CoreUtils.debugLog(log, "Verify subject DN: ", subjectDN); + String accessToken = getAccessToken(); + URI certVerifyUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils + .getHttpsPort() + "/api/certificate-mgt/v1.0/admin/certificates/verify/android"); + Map certVerifyHeaders = new HashMap(); + certVerifyHeaders.put("Authorization", "Bearer " + accessToken); + certVerifyHeaders.put("Content-Type", "application/json"); + String certVerifyContent = "{\n" + + "\"pem\":\"" + subjectDN + "\",\n" + + "\"tenantId\": \"-1234\",\n" + + "\"serial\":\"" + AuthConstants.PROXY_MUTUAL_AUTH_HEADER + "\"\n" + + "}"; + + RESTResponse response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, + null, certVerifyContent); + CoreUtils.debugLog(log, "Verify response:", response.getContent()); + if (!response.getContent().contains("invalid")) { + return InvocationResponse.CONTINUE; + } + log.warn("Unauthorized request for api: " + ctxPath); + setFaultCodeAndThrowAxisFault(messageContext, new Exception("Unauthorized!")); + return InvocationResponse.SUSPEND; + + } else if (headers.containsKey(AuthConstants.ENCODED_PEM)) { + String encodedPem = headers.get(AuthConstants.ENCODED_PEM).toString(); + CoreUtils.debugLog(log, "Verify Cert:\n", encodedPem); + + String accessToken = getAccessToken(); + URI certVerifyUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils + .getHttpsPort() + "/api/certificate-mgt/v1.0/admin/certificates/verify/ios"); + Map certVerifyHeaders = new HashMap(); + certVerifyHeaders.put("Authorization", "Bearer " + accessToken); + certVerifyHeaders.put("Content-Type", "application/json"); + String certVerifyContent = "{\n" + + "\"pem\":\"" + encodedPem + "\",\n" + + "\"tenantId\": \"-1234\",\n" + + "\"serial\":\"\"\n" + + "}"; + + RESTResponse response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, + null, certVerifyContent); + CoreUtils.debugLog(log, "Verify response:", response.getContent()); + + if (!response.getContent().contains("invalid")) { + return InvocationResponse.CONTINUE; + } + log.warn("Unauthorized request for api: " + ctxPath); + setFaultCodeAndThrowAxisFault(messageContext, new Exception("Unauthorized!")); + return InvocationResponse.SUSPEND; + } else { + log.warn("Unauthorized request for api: " + ctxPath); + setFaultCodeAndThrowAxisFault(messageContext, new Exception("SSL required")); return InvocationResponse.SUSPEND; } - } else { - log.warn("Unauthorized request for api: " + ctxPath); - setFaultCodeAndThrowAxisFault(messageContext, new Exception("SSL required")); + } catch (Exception e) { + log.error("Error while processing certificate.", e); + setFaultCodeAndThrowAxisFault(messageContext, e); return InvocationResponse.SUSPEND; } } else { @@ -159,7 +178,7 @@ public class AuthenticationHandler implements Handler { * @return boolean */ private boolean isSecuredAPI(MessageContext messageContext) { - if (messageContext.getTransportIn() != null && + if (messageContext.getTo() != null && messageContext.getTransportIn() != null && messageContext.getTransportIn().getName().toLowerCase().equals(AuthConstants.HTTPS)) { for (String path : apiList) { if (messageContext.getTo().getAddress().trim().contains(path)) { @@ -170,6 +189,55 @@ public class AuthenticationHandler implements Handler { return false; } + /** + * Get access token to call admin certificate management service for cert validation. + * + * @return accessToken String + * @throws URISyntaxException + * @throws IOException + */ + private String getAccessToken() throws URISyntaxException, IOException, JSONException { + URI dcrUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils + .getHttpsPort() + "/dynamic-client-web/register"); + String dcrContent = "{\n" + + "\"owner\":\"" + CoreUtils.getUsername() + "\",\n" + + "\"clientName\":\"emm\",\n" + + "\"grantType\":\"refresh_token password client_credentials\",\n" + + "\"tokenScope\":\"default\"\n" + + "}"; + Map drcHeaders = new HashMap(); + drcHeaders.put("Content-Type", "application/json"); + + RESTResponse response = restInvoker.invokePOST(dcrUrl, drcHeaders, null, + null, dcrContent); + CoreUtils.debugLog(log, "DCR response:", response.getContent()); + JSONObject jsonResponse = new JSONObject(response.getContent()); + String clientId = jsonResponse.getString("client_id"); + String clientSecret = jsonResponse.getString("client_secret"); + + URI tokenUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils + .getHttpsPort() + "/oauth2/token"); + String tokenContent = "grant_type=password&username=" + CoreUtils.getUsername() + "&password=" + + CoreUtils.getPassword() + "&scope=activity-view"; + String tokenBasicAuth = "Basic " + Base64.encode((clientId + ":" + clientSecret).getBytes()); + Map tokenHeaders = new HashMap(); + tokenHeaders.put("Authorization", tokenBasicAuth); + tokenHeaders.put("Content-Type", "application/x-www-form-urlencoded"); + + response = restInvoker.invokePOST(tokenUrl, tokenHeaders, null, + null, tokenContent); + CoreUtils.debugLog(log, "Token response:", response.getContent()); + jsonResponse = new JSONObject(response.getContent()); + String accessToken = jsonResponse.getString("access_token"); + return accessToken; + } + + /** + * Thow error message to client + * @param msgContext + * @param e Exception + * @throws AxisFault + */ private void setFaultCodeAndThrowAxisFault(MessageContext msgContext, Exception e) throws AxisFault { msgContext.setProperty(AuthConstants.SEC_FAULT, Boolean.TRUE); diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java index b7c9a00dfa..12bcda249a 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java @@ -21,7 +21,6 @@ public class AuthConstants { public static final String SEC_FAULT = "SECURITY_VALIDATION_FAILURE"; public static final String HTTPS = "https"; public static final String WSSE = "wsse"; - public static final String SSL_CERT_X509 = "ssl.client.auth.cert.X509"; public static final String AUTH_CONFIGURATION_FILE_NAME = "api-filter-config.xml"; public static final String API_FILTER_CONFIG_ELEMENT = "apiFilterConfig"; public static final String API_LIST_PROPERTY = "apiList"; @@ -30,6 +29,6 @@ public class AuthConstants { public static final String USERNAME = "username"; public static final String PASSWORD = "password"; public static final String MDM_SIGNATURE = "mdm-signature"; - public static final String IOS = "ios"; - public static final String ANDROID = "android"; + public static final String PROXY_MUTUAL_AUTH_HEADER = "proxy-mutual-auth-header"; + public static final String ENCODED_PEM = "encoded-pem"; } From 0bd298e6d70f1521c64666adc269877f487b1ea2 Mon Sep 17 00:00:00 2001 From: amalhub Date: Fri, 9 Dec 2016 11:56:51 +0530 Subject: [PATCH 07/47] IOTS-292: Code refactoring --- .../AuthenticationHandler.java | 39 +++++++------------ 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java index 770ffd1128..d8e779d658 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java @@ -76,6 +76,7 @@ public class AuthenticationHandler implements Handler { CoreUtils.debugLog(log, "Authentication handler invoked by: ", ctxPath); Map headers = (Map) messageContext.getProperty(MessageContext.TRANSPORT_HEADERS); try { + RESTResponse response = null; if (headers.containsKey(AuthConstants.MDM_SIGNATURE)) { String mdmSignature = headers.get(AuthConstants.MDM_SIGNATURE).toString(); @@ -84,7 +85,7 @@ public class AuthenticationHandler implements Handler { String accessToken = getAccessToken(); URI certVerifyUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils .getHttpsPort() + "/api/certificate-mgt/v1.0/admin/certificates/verify/ios"); - Map certVerifyHeaders = new HashMap(); + Map certVerifyHeaders = new HashMap<>(); certVerifyHeaders.put("Authorization", "Bearer " + accessToken); certVerifyHeaders.put("Content-Type", "application/json"); String certVerifyContent = "{\n" + @@ -93,24 +94,17 @@ public class AuthenticationHandler implements Handler { "\"serial\":\"\"\n" + "}"; - RESTResponse response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, + response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, null, certVerifyContent); CoreUtils.debugLog(log, "Verify response:", response.getContent()); - if (!response.getContent().contains("invalid")) { - return InvocationResponse.CONTINUE; - } - log.warn("Unauthorized request for api: " + ctxPath); - setFaultCodeAndThrowAxisFault(messageContext, new Exception("Unauthorized!")); - return InvocationResponse.SUSPEND; - } else if (headers.containsKey(AuthConstants.PROXY_MUTUAL_AUTH_HEADER)) { String subjectDN = headers.get(AuthConstants.PROXY_MUTUAL_AUTH_HEADER).toString(); CoreUtils.debugLog(log, "Verify subject DN: ", subjectDN); String accessToken = getAccessToken(); URI certVerifyUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils .getHttpsPort() + "/api/certificate-mgt/v1.0/admin/certificates/verify/android"); - Map certVerifyHeaders = new HashMap(); + Map certVerifyHeaders = new HashMap<>(); certVerifyHeaders.put("Authorization", "Bearer " + accessToken); certVerifyHeaders.put("Content-Type", "application/json"); String certVerifyContent = "{\n" + @@ -119,15 +113,9 @@ public class AuthenticationHandler implements Handler { "\"serial\":\"" + AuthConstants.PROXY_MUTUAL_AUTH_HEADER + "\"\n" + "}"; - RESTResponse response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, + response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, null, certVerifyContent); CoreUtils.debugLog(log, "Verify response:", response.getContent()); - if (!response.getContent().contains("invalid")) { - return InvocationResponse.CONTINUE; - } - log.warn("Unauthorized request for api: " + ctxPath); - setFaultCodeAndThrowAxisFault(messageContext, new Exception("Unauthorized!")); - return InvocationResponse.SUSPEND; } else if (headers.containsKey(AuthConstants.ENCODED_PEM)) { String encodedPem = headers.get(AuthConstants.ENCODED_PEM).toString(); @@ -136,7 +124,7 @@ public class AuthenticationHandler implements Handler { String accessToken = getAccessToken(); URI certVerifyUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils .getHttpsPort() + "/api/certificate-mgt/v1.0/admin/certificates/verify/ios"); - Map certVerifyHeaders = new HashMap(); + Map certVerifyHeaders = new HashMap<>(); certVerifyHeaders.put("Authorization", "Bearer " + accessToken); certVerifyHeaders.put("Content-Type", "application/json"); String certVerifyContent = "{\n" + @@ -145,21 +133,22 @@ public class AuthenticationHandler implements Handler { "\"serial\":\"\"\n" + "}"; - RESTResponse response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, + response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, null, certVerifyContent); CoreUtils.debugLog(log, "Verify response:", response.getContent()); - if (!response.getContent().contains("invalid")) { - return InvocationResponse.CONTINUE; - } - log.warn("Unauthorized request for api: " + ctxPath); - setFaultCodeAndThrowAxisFault(messageContext, new Exception("Unauthorized!")); - return InvocationResponse.SUSPEND; } else { log.warn("Unauthorized request for api: " + ctxPath); setFaultCodeAndThrowAxisFault(messageContext, new Exception("SSL required")); return InvocationResponse.SUSPEND; } + + if (response != null && !response.getContent().contains("invalid")) { + return InvocationResponse.CONTINUE; + } + log.warn("Unauthorized request for api: " + ctxPath); + setFaultCodeAndThrowAxisFault(messageContext, new Exception("Unauthorized!")); + return InvocationResponse.SUSPEND; } catch (Exception e) { log.error("Error while processing certificate.", e); setFaultCodeAndThrowAxisFault(messageContext, e); From 7e90fde46113a24f33236ed011204fae318c10cd Mon Sep 17 00:00:00 2001 From: amalhub Date: Fri, 9 Dec 2016 12:28:40 +0530 Subject: [PATCH 08/47] IOTS-292: Adding new filter configs --- .../AuthenticationHandler.java | 6 +++--- .../utils/AuthConstants.java | 2 ++ .../utils/CoreUtils.java | 16 ++++++++++++++++ .../src/main/resources/api-filter-config.xml | 2 ++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java index d8e779d658..1c320410b6 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java @@ -84,7 +84,7 @@ public class AuthenticationHandler implements Handler { String accessToken = getAccessToken(); URI certVerifyUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils - .getHttpsPort() + "/api/certificate-mgt/v1.0/admin/certificates/verify/ios"); + .getHttpsPort() + CoreUtils.getIosVerifyEndpoint()); Map certVerifyHeaders = new HashMap<>(); certVerifyHeaders.put("Authorization", "Bearer " + accessToken); certVerifyHeaders.put("Content-Type", "application/json"); @@ -103,7 +103,7 @@ public class AuthenticationHandler implements Handler { CoreUtils.debugLog(log, "Verify subject DN: ", subjectDN); String accessToken = getAccessToken(); URI certVerifyUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils - .getHttpsPort() + "/api/certificate-mgt/v1.0/admin/certificates/verify/android"); + .getHttpsPort() + CoreUtils.getAndroidVerifyEndpoint()); Map certVerifyHeaders = new HashMap<>(); certVerifyHeaders.put("Authorization", "Bearer " + accessToken); certVerifyHeaders.put("Content-Type", "application/json"); @@ -123,7 +123,7 @@ public class AuthenticationHandler implements Handler { String accessToken = getAccessToken(); URI certVerifyUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils - .getHttpsPort() + "/api/certificate-mgt/v1.0/admin/certificates/verify/ios"); + .getHttpsPort() + CoreUtils.getAndroidVerifyEndpoint()); Map certVerifyHeaders = new HashMap<>(); certVerifyHeaders.put("Authorization", "Bearer " + accessToken); certVerifyHeaders.put("Content-Type", "application/json"); diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java index 12bcda249a..03a8780efc 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java @@ -28,6 +28,8 @@ public class AuthConstants { public static final String HTTPS_PORT = "httpsPort"; public static final String USERNAME = "username"; public static final String PASSWORD = "password"; + public static final String IOS_VERIFY_ENDPOINT = "ios-verify-endpoint"; + public static final String ANDROID_VERIFY_ENDPOINT = "android-verify-endpoint"; public static final String MDM_SIGNATURE = "mdm-signature"; public static final String PROXY_MUTUAL_AUTH_HEADER = "proxy-mutual-auth-header"; public static final String ENCODED_PEM = "encoded-pem"; diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java index 42a7fe9ea7..852e2529b7 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java @@ -37,6 +37,8 @@ public class CoreUtils { private static int httpsPort = 9443; private static String username = "admin"; private static String password = "admin"; + private static String iosVerifyEndpoint = "/api/certificate-mgt/v1.0/admin/certificates/verify/ios"; + private static String androidVerifyEndpoint = "/api/certificate-mgt/v1.0/admin/certificates/verify/android"; /** * Reading configurations from api-filter-config.xml file @@ -88,6 +90,12 @@ public class CoreUtils { } else if (AuthConstants.PASSWORD.equals(beanName)) { String value = beanProp.getAttributeValue(new QName(null, "value")); password = value; + } else if (AuthConstants.IOS_VERIFY_ENDPOINT.equals(beanName)) { + String value = beanProp.getAttributeValue(new QName(null, "value")); + iosVerifyEndpoint = value; + } else if (AuthConstants.ANDROID_VERIFY_ENDPOINT.equals(beanName)) { + String value = beanProp.getAttributeValue(new QName(null, "value")); + androidVerifyEndpoint = value; } } } @@ -137,4 +145,12 @@ public class CoreUtils { public static String getPassword() { return password; } + + public static String getIosVerifyEndpoint() { + return iosVerifyEndpoint; + } + + public static String getAndroidVerifyEndpoint() { + return androidVerifyEndpoint; + } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/api-filter-config.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/api-filter-config.xml index 8811ccb8e7..fc6c241759 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/api-filter-config.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/api-filter-config.xml @@ -18,5 +18,7 @@ + + \ No newline at end of file From a6649c1d52558e12cbc814e9cbbece822db54ea2 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Mon, 19 Dec 2016 09:54:33 +0530 Subject: [PATCH 09/47] Partial commit for the git update --- pom.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pom.xml b/pom.xml index eeabd51d55..bcd15ec495 100644 --- a/pom.xml +++ b/pom.xml @@ -1544,6 +1544,17 @@ jersey-core ${jersey.version} + + + org.apache.synapse + synapse-core + ${org.apache.synapse.version} + + + org.apache.ws.security.wso2 + wss4j + ${org.apache.ws.security.wso2.version} + From 200740eca60c6c50f893acea708744e8faa9f888 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Mon, 19 Dec 2016 09:58:19 +0530 Subject: [PATCH 10/47] Partial commit for the git update --- .../APIMCertificateMGTExcepton.java | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTExcepton.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTExcepton.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTExcepton.java new file mode 100644 index 0000000000..9b11ab7faf --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTExcepton.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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 org.wso2.carbon.apimgt.handlers; + +public class APIMCertificateMGTExcepton extends Exception{ + + private static final long serialVersionUID = -37676242646464497L; + + private String errorMessage; + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public APIMCertificateMGTExcepton(String msg, Exception nestedEx) { + super(msg, nestedEx); + setErrorMessage(msg); + } + + public APIMCertificateMGTExcepton(String message, Throwable cause) { + super(message, cause); + setErrorMessage(message); + } + + public APIMCertificateMGTExcepton(String msg) { + super(msg); + setErrorMessage(msg); + } + + public APIMCertificateMGTExcepton() { + super(); + } + + public APIMCertificateMGTExcepton(Throwable cause) { + super(cause); + } +} + From 01cbf8ecd934a8a88b3ef13afebb42339455cf6d Mon Sep 17 00:00:00 2001 From: geethkokila Date: Mon, 19 Dec 2016 13:41:02 +0530 Subject: [PATCH 11/47] Partial commit --- pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pom.xml b/pom.xml index 25bb565618..c9ff92bc55 100644 --- a/pom.xml +++ b/pom.xml @@ -314,6 +314,12 @@ org.wso2.carbon.apimgt.application.extension.api ${carbon.device.mgt.version} + + + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.handlers + ${carbon.device.mgt.version} + From 23dc0e62ab21a3867139612a4152fb434f3f8688 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Mon, 19 Dec 2016 13:41:21 +0530 Subject: [PATCH 12/47] Partial commit --- features/apimgt-extensions/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index 0804d11989..0c3ace1393 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -37,6 +37,7 @@ org.wso2.carbon.apimgt.webapp.publisher.feature org.wso2.carbon.apimgt.application.extension.feature + org.wso2.carbon.apimgt.handler.server.feature From 1b4857b7fd9a483b5966c7b4c9554420249dce19 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Tue, 20 Dec 2016 11:19:58 +0530 Subject: [PATCH 13/47] Fixing conflicts --- .../org.wso2.carbon.certificate.mgt.core/pom.xml | 10 ++++++---- .../main/resources/jaggeryapps/devicemgt/jaggery.conf | 2 +- .../jaggeryapps/uuf-template-app/jaggery.conf | 2 +- .../uuf-template-app/lib/modules/auth/auth.js | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml index 3d6927cb7d..cf23d12014 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml @@ -21,13 +21,13 @@ org.wso2.carbon.devicemgt certificate-mgt - 2.0.4-SNAPSHOT + 2.0.3-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.core - 2.0.4-SNAPSHOT + 2.0.3-SNAPSHOT bundle WSO2 Carbon - Certificate Management Core WSO2 Carbon - Certificate Management Core @@ -51,7 +51,8 @@ ${carbon.device.mgt.version} Device Management Core Bundle - org.wso2.carbon.certificate.mgt.core.internal + org.wso2.carbon.certificate.mgt.core.internal, + org.wso2.carbon.certificate.mgt.core.util org.osgi.framework, @@ -59,7 +60,7 @@ org.apache.commons.logging, javax.security.auth.x500, javax.xml.*, - javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, + javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, org.apache.commons.codec.binary, org.bouncycastle.asn1, org.bouncycastle.asn1.x500, @@ -97,6 +98,7 @@ !org.wso2.carbon.certificate.mgt.core.internal.*, + !org.wso2.carbon.certificate.mgt.core.util, org.wso2.carbon.certificate.mgt.core.* diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/jaggery.conf b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/jaggery.conf index fb71f60e96..832c1ab252 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/jaggery.conf +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/jaggery.conf @@ -108,7 +108,7 @@ "contextParams" : [ { "name" : "Owasp.CsrfGuard.Config", - "value" : "/repository/conf/security/Owasp.CsrfGuard.Carbon.properties" + "value" : "/repository/conf/security/Owasp.CsrfGuard.dashboard.properties" } ] } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/jaggery.conf b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/jaggery.conf index 7c5a2d41c9..f97bae72cf 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/jaggery.conf +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/jaggery.conf @@ -71,7 +71,7 @@ "contextParams" : [ { "name" : "Owasp.CsrfGuard.Config", - "value" : "/repository/conf/security/Owasp.CsrfGuard.Carbon.properties" + "value" : "/repository/conf/security/Owasp.CsrfGuard.dashboard.properties" } ] } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js index 2cf9771bea..a18d2efc50 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/lib/modules/auth/auth.js @@ -520,7 +520,7 @@ var module = {}; response.sendError(500, msg); return; } - + /** * @type {{sessionId: string, loggedInUser: string, sessionIndex: string, samlToken: * string}} @@ -533,7 +533,7 @@ var module = {}; if (ssoSession.sessionIndex) { module.loadTenant(ssoSession.loggedInUser); var carbonUser = (require("carbon")).server.tenantUser(ssoSession.loggedInUser); - module.loadTenant(ssoSession.loggedInUser); + module.loadTenant(ssoSession.loggedInUser); utils.setCurrentUser(carbonUser.username, carbonUser.domain, carbonUser.tenantId); var scriptArgument = {input: {samlToken: ssoSession.samlToken}, user: module.getCurrentUser()}; handleEvent(OPERATION_LOGIN, EVENT_SUCCESS, scriptArgument); From 649879f998dc7e2210cc615fab1442cf903e2328 Mon Sep 17 00:00:00 2001 From: GPrathap Date: Sun, 1 Jan 2017 21:13:53 +0530 Subject: [PATCH 14/47] removed setting APIs secured as default. Because if secured is enabled, it is to be needed to provided parameters which are related to basic oauth, when this is false, jwt token is being used. --- .../webapp/publisher/APIPublisherUtil.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java index 6d1bc7695b..630aa32d13 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java @@ -50,7 +50,7 @@ public class APIPublisherUtil { private static final String PARAM_PROVIDER_TENANT_DOMAIN = "providerTenantDomain"; - public static API getAPI(APIConfig config) throws APIManagementException { + public static API PARAM_MANAGED_API_IS_SECURED(APIConfig config) throws APIManagementException { APIProvider provider = config.getProvider(); String apiVersion = config.getVersion(); @@ -75,7 +75,7 @@ public class APIPublisherUtil { api.setUrl(config.getEndpoint()); api.addAvailableTiers(provider.getTiers()); - api.setEndpointSecured(true); + api.setEndpointSecured(false); api.setStatus(APIStatus.CREATED); api.setTransports(config.getTransports()); api.setApiLevelPolicy(config.getPolicy()); @@ -261,18 +261,7 @@ public class APIPublisherUtil { } apiConfig.setOwner(owner); - String isSecuredParam = servletContext.getInitParameter(PARAM_MANAGED_API_IS_SECURED); - boolean isSecured; - if (isSecuredParam == null || isSecuredParam.isEmpty()) { - if (log.isDebugEnabled()) { - log.debug("'managed-api-isSecured' attribute is not configured. Therefore, using the default, " + - "which is 'true'"); - } - isSecured = false; - } else { - isSecured = Boolean.parseBoolean(isSecuredParam); - } - apiConfig.setSecured(isSecured); + apiConfig.setSecured(false); String transports = servletContext.getInitParameter(PARAM_MANAGED_API_TRANSPORTS); if (transports == null || transports.isEmpty()) { From 4c9578ebe24b5930c2b8c1cbdb4ba4fa031deecb Mon Sep 17 00:00:00 2001 From: GPrathap Date: Sun, 1 Jan 2017 21:53:53 +0530 Subject: [PATCH 15/47] resized buffer size to 0 for each scope --- .../device/mgt/core/config/permission/AnnotationProcessor.java | 1 + 1 file changed, 1 insertion(+) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/AnnotationProcessor.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/AnnotationProcessor.java index ee2ebb4c2e..b20936c8f3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/AnnotationProcessor.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/AnnotationProcessor.java @@ -403,6 +403,7 @@ public class AnnotationProcessor { .getMethod(SWAGGER_ANNOTATIONS_PROPERTIES_KEY), annotatedScopes[i], STRING)); permissions = (String[])methodHandler.invoke(annotatedScopes[i], scopeClass .getMethod(SWAGGER_ANNOTATIONS_PROPERTIES_PERMISSIONS, null),null); + aggregatedPermissions.setLength(0); for (String permission : permissions) { aggregatedPermissions.append(permission); aggregatedPermissions.append(" "); From f508bcfd0e7e11d3b401f899b9eb2270d8f25827 Mon Sep 17 00:00:00 2001 From: GPrathap Date: Sun, 1 Jan 2017 22:03:50 +0530 Subject: [PATCH 16/47] corrected method name --- .../wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java index 630aa32d13..ce194ebb3c 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java @@ -50,7 +50,7 @@ public class APIPublisherUtil { private static final String PARAM_PROVIDER_TENANT_DOMAIN = "providerTenantDomain"; - public static API PARAM_MANAGED_API_IS_SECURED(APIConfig config) throws APIManagementException { + public static API getAPI(APIConfig config) throws APIManagementException { APIProvider provider = config.getProvider(); String apiVersion = config.getVersion(); From 3c3c56a63c6aa19e86efe47feb53f0d0197a5665 Mon Sep 17 00:00:00 2001 From: Ace Date: Mon, 2 Jan 2017 15:27:53 +0530 Subject: [PATCH 17/47] Bumping IS versions to latest ones --- pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index e49aee71a4..773950ed59 100644 --- a/pom.xml +++ b/pom.xml @@ -1865,7 +1865,7 @@ 2.2.1 6.1.1 - 4.4.10 + 4.4.11 4.4.9 [4.4.0, 5.0.0) 1.5.4 @@ -1909,12 +1909,12 @@ 4.7.2 - 5.6.89 - 5.2.33 - 5.2.14 + 5.7.0 + 5.3.1 + 5.3.0 - [5.6.0, 6.0.0) + [5.7.0, 6.0.0) [5.2.0, 6.0.0) [5.1.0, 6.0.0) @@ -1940,7 +1940,7 @@ [2.6.0,3.0.0) - 6.1.2 + 6.1.20-SNAPSHOT (6.0.0,7.0.0] From 2619c626b29e51784f9b6242b906f54772807721 Mon Sep 17 00:00:00 2001 From: GPrathap Date: Mon, 19 Dec 2016 18:23:06 +0530 Subject: [PATCH 18/47] added scope annotation --- .../CertificateManagementAdminService.java | 48 +++-- .../api/ActivityInfoProviderService.java | 22 +- .../api/ConfigurationManagementService.java | 10 +- .../mgt/jaxrs/service/api/Dashboard.java | 160 +++++++++++++- .../service/api/DeviceManagementService.java | 166 ++++++++------ .../api/DeviceTypeManagementService.java | 42 ++-- .../service/api/GroupManagementService.java | 202 +++++++++++------- .../api/NotificationManagementService.java | 41 ++-- .../service/api/PolicyManagementService.java | 155 +++++++++----- .../service/api/RoleManagementService.java | 135 +++++++----- .../service/api/UserManagementService.java | 180 ++++++++++------ .../ApplicationManagementAdminService.java | 31 ++- .../admin/DeviceManagementAdminService.java | 12 +- .../admin/GroupManagementAdminService.java | 22 +- .../api/admin/UserManagementAdminService.java | 25 ++- 15 files changed, 851 insertions(+), 400 deletions(-) diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java index 3f849cba9c..df92a10eb3 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java @@ -1,6 +1,16 @@ package org.wso2.carbon.certificate.mgt.cert.jaxrs.api; -import io.swagger.annotations.*; +import io.swagger.annotations.SwaggerDefinition; +import io.swagger.annotations.Info; +import io.swagger.annotations.ExtensionProperty; +import io.swagger.annotations.Extension; +import io.swagger.annotations.Tag; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ResponseHeader; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.CertificateList; @@ -31,16 +41,28 @@ import javax.ws.rs.core.Response; @Path("/admin/certificates") @Scopes(scopes = { @Scope( - name = "Manage certificates", - description = "", - key = "cdmf:manage-certificate", - permissions = {"/device-mgt/certificates/manage"} + name = "Adding a new SSL certificate", + description = "Adding a new SSL certificate", + key = "cdmf:admin:certificates:add", + permissions = {"/device-mgt/admin/certificates/add"} ), @Scope( - name = "View certificate", - description = "", - key = "cdmf:view-certificate", - permissions = {"/device-mgt/certificates/view"} + name = "Getting Details of an SSL Certificate", + description = "Getting Details of an SSL Certificate", + key = "cdmf:admin:certificates:details", + permissions = {"/device-mgt/admin/certificates/details"} + ), + @Scope( + name = "Getting Details of Certificates", + description = "Getting Details of Certificates", + key = "cdmf:admin:certificates:view", + permissions = {"/device-mgt/admin/certificates/view"} + ), + @Scope( + name = "Deleting an SSL Certificate", + description = "Deleting an SSL Certificate", + key = "cdmf:admin:certificates:delete", + permissions = {"/device-mgt/admin/certificates/delete"} ) } ) @@ -67,7 +89,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:manage-certificate") + @ExtensionProperty(name = SCOPE, value = "cdmf:admin:certificates:add") }) } ) @@ -136,7 +158,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:view-certificate") + @ExtensionProperty(name = SCOPE, value = "cdmf:admin:certificates:details") }) } ) @@ -207,7 +229,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:view-certificate") + @ExtensionProperty(name = SCOPE, value = "cdmf:admin:certificates:view") }) } ) @@ -286,7 +308,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:manage-certificate") + @ExtensionProperty(name = SCOPE, value = "cdmf:admin:certificates:delete") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java index 9c3e2c4f5b..3a040fa216 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java @@ -18,7 +18,17 @@ */ package org.wso2.carbon.device.mgt.jaxrs.service.api; -import io.swagger.annotations.*; +import io.swagger.annotations.SwaggerDefinition; +import io.swagger.annotations.Info; +import io.swagger.annotations.ExtensionProperty; +import io.swagger.annotations.Extension; +import io.swagger.annotations.Tag; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ResponseHeader; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; @@ -55,9 +65,9 @@ import javax.ws.rs.core.Response; @Scopes( scopes = { @Scope( - name = "Get activities", - description = "Get activities", - key = "cdmf:get-activity", + name = "Getting Details of an Activity", + description = "Getting Details of an Activity", + key = "cdmf:activities:details", permissions = {"/device-mgt/devices/owning-device/view"} ) } @@ -77,7 +87,7 @@ public interface ActivityInfoProviderService { tags = "Activity Info Provider", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:get-activity") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:activities:details") }) } ) @@ -150,7 +160,7 @@ public interface ActivityInfoProviderService { tags = "Activity Info Provider", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:get-activity") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:activities:details") }) } ) 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 504bd75f1d..87fa47c5d3 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 @@ -24,8 +24,6 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; @@ -68,13 +66,13 @@ import javax.ws.rs.core.Response; @Scope( name = "View configurations", description = "", - key = "cdmf:view-configuration", + key = "cdmf:configuration:view", permissions = {"/device-mgt/platform-configurations/view"} ), @Scope( name = "Manage configurations", description = "", - key = "cdmf:manage-configuration", + key = "cdmf:configuration:manage", permissions = {"/device-mgt/platform-configurations/manage"} ) } @@ -92,7 +90,7 @@ public interface ConfigurationManagementService { tags = "Configuration Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:view-configuration") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:configuration:view") }) } ) @@ -151,7 +149,7 @@ public interface ConfigurationManagementService { tags = "Configuration Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:manage-configuration") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:configuration:manage") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java index 903c92e5cd..8251ff40ae 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java @@ -1,15 +1,23 @@ package org.wso2.carbon.device.mgt.jaxrs.service.api; +import io.swagger.annotations.SwaggerDefinition; +import io.swagger.annotations.Info; +import io.swagger.annotations.ExtensionProperty; +import io.swagger.annotations.Extension; +import io.swagger.annotations.Tag; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup; import org.wso2.carbon.device.mgt.jaxrs.beans.DashboardGadgetDataWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.DashboardPaginationGadgetDataWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; @@ -18,9 +26,89 @@ import javax.ws.rs.core.Response; /** * Device Analytics Dashboard related REST-APIs. This can be used to obtain device related analytics. */ +@SwaggerDefinition( + info = @Info( + version = "1.0.0", + title = "", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = "name", value = "DeviceAnalyticsDashboard"), + @ExtensionProperty(name = "context", value = "/api/device-mgt/v1.0/dashboard"), + }) + } + ), + tags = { + @Tag(name = "device_management", description = "Device Analytics Dashboard related information APIs" + + " are described here.") + } +) @Path("/dashboard") @Api(value = "Device Analytics Dashboard", description = "Device Analytics Dashboard related information APIs are described here.") +@Scopes( + scopes = { + @Scope( + name = "Device Count Overview", + description = "Device Count Overview", + key = "cdmf:dashboard:count-overview", + permissions = {"/device-mgt/dashboard/device-count"} + ), + @Scope( + name = "Device Counts by Potential Vulnerabilities", + description = "Device Counts by Potential Vulnerabilities", + key = "cdmf:dashboard:vulnerabilities", + permissions = {"/device-mgt/dashboard/vulnerabilities"} + ), + @Scope( + name = "Get the number of devices that have not complied to a policy", + description = "Get the number of devices that have not complied to a policy", + key = "cdmf:dashboard:non-compliant", + permissions = {"/device-mgt/dashboard/features"} + ), + @Scope( + name = "Get the number of devices for a given device type, such as connectivity status, " + + "potential vulnerability, platform, and ownership", + description = "Get the number of devices for a given device type, such as connectivity status, " + + "potential vulnerability, platform, and ownership", + key = "cdmf:dashboard:by-groups", + permissions = {"/device-mgt/dashboard/groups"} + ), + @Scope( + name = "Get the number of devices that have not complied to a given policy based on a particular", + description = "Get the number of devices that have not complied to a given policy based on a particular", + key = "cdmf:dashboard:device-counts", + permissions = {"/device-mgt/dashboard/groups"} + ), + @Scope( + name = "Get the number of devices that have not complied to a given policy based on a particular" + + " device type.", + description = "Get the number of devices that have not complied to a given policy based on a " + + "particular device type.", + key = "cdmf:dashboard:filtered-count", + permissions = {"/device-mgt/dashboard/total"} + ), + @Scope( + name = "Get the number of devices that have not complied to a given policy over the total" + + " number of devices registered with WSO2 EMM.\n", + description = "Get the number of devices that have not complied to a given policy over the total" + + " number of devices registered with WSO2 EMM.\n", + key = "cdmf:dashboard:non-compliant-count", + permissions = {"/device-mgt/dashboard/total"} + ), + @Scope( + name = "Get device details of devices based on a particular device type.", + description = "Get device details of devices based on a particular device type.", + key = "cdmf:dashboard:details", + permissions = {"/device-mgt/dashboard/details"} + ), + @Scope( + name = "Get device details of non-compliant devices which do not comply to a given policy.", + description = "Get device details of non-compliant devices which do not comply to a given policy.", + key = "cdmf:dashboard:feature-non-compliant", + permissions = {"/device-mgt/dashboard/details"} + ) + } +) @Produces(MediaType.APPLICATION_JSON) @SuppressWarnings("NonJaxWsWebServices") public interface Dashboard { @@ -43,7 +131,13 @@ public interface Dashboard { value = "Get the details of registered devices in WSO2 EMM.", notes = "Get the details of active, inactive, removed and total number of registered devices in" + " WSO2 EMM.", - tags = "Dashboard") + tags = "Dashboard", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:count-overview") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -93,7 +187,13 @@ public interface Dashboard { produces = MediaType.APPLICATION_JSON, httpMethod = "GET", value = "Get the number of unmonitored and non-compliant devices in WSO2 EMM.", - tags = "Dashboard") + tags = "Dashboard", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:vulnerabilities") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -144,7 +244,13 @@ public interface Dashboard { httpMethod = "GET", value = "Get the number of devices that have not complied to a policy that was enforced on a " + "device.", - tags = "Dashboard") + tags = "Dashboard", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:non-compliant") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -208,7 +314,13 @@ public interface Dashboard { httpMethod = "GET", value = "Get the number of devices for a given device type, such as connectivity status, " + "potential vulnerability, platform, and ownership.\n", - tags = "Dashboard") + tags = "Dashboard", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:by-groups") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -291,7 +403,13 @@ public interface Dashboard { httpMethod = "GET", value = "Get the number of devices that have not complied to a given policy based on a particular" + " device type.", - tags = "Dashboard") + tags = "Dashboard", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:device-counts") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -364,7 +482,13 @@ public interface Dashboard { + "Connectivity status of the device, such as active, inactive or removed.\n" + "The device ownership type, such as BYOD or COPE.\n" + "The device platform.\n" + "The potential vulnerabilities faced by the devices.", - tags = "Dashboard") + tags = "Dashboard", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:filtered-count") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -450,7 +574,13 @@ public interface Dashboard { httpMethod = "GET", value = "Get the number of devices that have not complied to a given policy over the total" + " number of devices registered with WSO2 EMM.\n", - tags = "Dashboard") + tags = "Dashboard", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:non-compliant-count") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -519,7 +649,13 @@ public interface Dashboard { produces = MediaType.APPLICATION_JSON, httpMethod = "GET", value = "Get device details of devices based on a particular device type.", - tags = "Dashboard") + tags = "Dashboard", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:details") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -615,7 +751,13 @@ public interface Dashboard { produces = MediaType.APPLICATION_JSON, httpMethod = "GET", value = "Get device details of non-compliant devices which do not comply to a given policy.", - tags = "Dashboard") + tags = "Dashboard", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:feature-non-compliant") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java index 650ae34f7b..ed9290df4c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java @@ -24,13 +24,13 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Feature; import org.wso2.carbon.device.mgt.common.app.mgt.Application; @@ -38,6 +38,7 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.search.SearchContext; import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import org.wso2.carbon.policy.mgt.common.Policy; import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData; @@ -64,6 +65,64 @@ import javax.ws.rs.core.Response; @Tag(name = "device_management", description = "") } ) +@Scopes( + scopes = { + @Scope( + name = "Getting Details of Registered Devices", + description = "Getting Details of Registered Devices", + key = "cdmf:devices:view", + permissions = {"/device-mgt/devices/owning-device/view"} + ), + @Scope( + name = "Getting Details of a Device", + description = "Getting Details of a Device", + key = "cdmf:devices:details", + permissions = {"/device-mgt/devices/owning-device/details"} + ), + @Scope( + name = "Delete the device specified by device id", + description = "Delete the device specified by device id", + key = "cdmf:devices:delete", + permissions = {"/device-mgt/devices/owning-device/delete"} + ), + @Scope( + name = "Getting Feature Details of a Device", + description = "Getting Feature Details of a Device", + key = "cdmf:devices:features", + permissions = {"/device-mgt/devices/owning-device/features"} + ), + @Scope( + name = "Advanced Search for Devices", + description = "Advanced Search for Devices", + key = "cdmf:devices:search", + permissions = {"/device-mgt/devices/owning-device/view"} + ), + @Scope( + name = "Getting Installed Application Details of a Device", + description = "Getting Installed Application Details of a Device", + key = "cdmf:devices:applications", + permissions = {"/device-mgt/devices/owning-device/applications"} + ), + @Scope( + name = "Getting Device Operation Details", + description = "Getting Device Operation Details", + key = "cdmf:devices:operations", + permissions = {"/device-mgt/devices/owning-device/operations"} + ), + @Scope( + name = "Get the details of the policy that is enforced on a device.", + description = "Get the details of the policy that is enforced on a device.", + key = "cdmf:devices:effective-policy", + permissions = {"/device-mgt/devices/owning-device/effective-policy"} + ), + @Scope( + name = "Getting Policy Compliance Details of a Device", + description = "Getting Policy Compliance Details of a Device", + key = "cdmf:devices:compliance-data", + permissions = {"/device-mgt/devices/owning-device/compliance-data"} + ) + } +) @Path("/devices") @Api(value = "Device Management", description = "This API carries all device management related operations " + "such as get all the available devices, etc.") @@ -78,13 +137,11 @@ public interface DeviceManagementService { value = "Getting Details of Registered Devices", notes = "Provides details of all the devices enrolled with WSO2 EMM.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view" - , description = "View Devices") } - ) - } + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:view") + }) + } ) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK. \n Successfully fetched the list of devices.", @@ -205,12 +262,10 @@ public interface DeviceManagementService { value = "Getting Details of a Device", notes = "Get the details of a device by specifying the device type and device identifier.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:details") + }) } ) @ApiResponses( @@ -282,15 +337,13 @@ public interface DeviceManagementService { @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = "DELETE", - value = "Delete the device speccified by device id", + value = "Delete the device specified by device id", notes = "Returns the status of the deleted device operation.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:delete") + }) } ) @ApiResponses( @@ -359,13 +412,11 @@ public interface DeviceManagementService { "Using this REST API you can get the features that can be carried out on a preferred device type," + " such as iOS, Android or Windows.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Devices") } - ) - } + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:features") + }) + } ) @ApiResponses( value = { @@ -450,12 +501,10 @@ public interface DeviceManagementService { value = "Advanced Search for Devices", notes = "Search for devices by filtering the search result through the specified search terms.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:search") + }) } ) @ApiResponses( @@ -529,13 +578,12 @@ public interface DeviceManagementService { value = "Getting Installed Application Details of a Device", notes = "Get the list of applications subscribed to by a device.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Devices") } - ) - } + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:applications") + }) + + } ) @ApiResponses( value = { @@ -633,13 +681,11 @@ public interface DeviceManagementService { value = "Getting Device Operation Details", notes = "Get the details of operations carried out on a selected device.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Devices") } - ) - } + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:operations") + }) + } ) @ApiResponses( value = { @@ -746,13 +792,11 @@ public interface DeviceManagementService { "WSO2 EMM filters the policies based on the device platform (device type)," + "the device ownership type, the user role or name and finally, the policy that matches these filters will be enforced on the device.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Devices") } - ) - } + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:effective-policy") + }) + } ) @ApiResponses( value = { @@ -837,12 +881,10 @@ public interface DeviceManagementService { notes = "A policy is enforced on the devices that register with WSO2 EMM. " + "The server checks if the settings in the device comply with the policy that is enforced on the device using this REST API.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:compliance-data") + }) } ) @ApiResponses( diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java index 94b06ea751..963edc84f7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java @@ -24,15 +24,16 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceTypeList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.validation.constraints.Size; import javax.ws.rs.*; @@ -54,6 +55,22 @@ import javax.ws.rs.core.Response; @Tag(name = "device_management", description = "") } ) +@Scopes( + scopes = { + @Scope( + name = "Getting the Supported Device Platforms", + description = "Getting the Supported Device Platforms", + key = "cdmf:device-types:types", + permissions = {"/device-mgt/device-types/types"} + ), + @Scope( + name = "Get Feature Details of a Device Type", + description = "Get Feature Details of a Device Type", + key = "cdmf:device-types:features", + permissions = {"/device-mgt/device-types/features"} + ) + } +) @Path("/device-types") @Api(value = "Device Type Management", description = "This API corresponds to all tasks related to device " + "type management") @@ -68,12 +85,10 @@ public interface DeviceTypeManagementService { value = "Getting the Supported Device Platforms", notes = "Get the list of device platforms supported by WSO2 EMM.", tags = "Device Type Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Device Types") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:device-types:types") + }) } ) @ApiResponses( @@ -123,6 +138,7 @@ public interface DeviceTypeManagementService { String ifModifiedSince); @GET + @Path("/{type}/features") @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = "GET", @@ -131,12 +147,10 @@ public interface DeviceTypeManagementService { "Using this REST API you can get the features that can be carried out on a preferred device type," + " such as iOS, Android or Windows.", tags = "Device Type Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Device Types") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:device-types:features") + }) } ) @ApiResponses( diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java index a982a3c3d5..aff13f2437 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java @@ -24,8 +24,6 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.AuthorizationScope; import io.swagger.annotations.Extension; import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Info; @@ -33,12 +31,15 @@ import io.swagger.annotations.ResponseHeader; import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.Tag; import org.apache.axis2.transport.http.HTTPConstants; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup; import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceGroupList; import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.RoleList; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.validation.Valid; import javax.ws.rs.Consumes; @@ -74,6 +75,82 @@ import java.util.List; "details.") } ) +@Scopes( + scopes = { + @Scope( + name = "Get the list of groups belongs to current user.", + description = "Get the list of groups belongs to current user.", + key = "cdmf:groups:groups", + permissions = {"/device-mgt/groups/groups"} + ), + @Scope( + name = "Get the count of groups belongs to current user.", + description = "Get the count of groups belongs to current user.", + key = "cdmf:groups:count", + permissions = {"/device-mgt/groups/count"} + ), + @Scope( + name = "Add new device group to the system.", + description = "Add new device group to the system.", + key = "cdmf:groups:add", + permissions = {"/device-mgt/groups/add"} + ), + @Scope( + name = "View group specified", + description = "View group specified", + key = "cdmf:groups:groups-view", + permissions = {"/device-mgt/groups/groups-view"} + ), + @Scope( + name = "Update a group", + description = "Update a group", + key = "cdmf:groups:update", + permissions = {"/device-mgt/groups/update"} + ), + @Scope( + name = "Delete a group", + description = "Delete a group", + key = "cdmf:groups:remove", + permissions = {"/device-mgt/groups/remove"} + ), + @Scope( + name = "Manage group sharing with a user", + description = "Manage group sharing with a user", + key = "cdmf:groups:share", + permissions = {"/device-mgt/groups/share"} + ), + @Scope( + name = "View list of roles of a device group", + description = "View list of roles of a device group", + key = "cdmf:groups:roles", + permissions = {"/device-mgt/groups/roles"} + ), + @Scope( + name = "View list of devices in the device group", + description = "View list of devices in the device group", + key = "cdmf:groups:devices", + permissions = {"/device-mgt/groups/devices"} + ), + @Scope( + name = "View list of device count in the device group", + description = "View list of device count in the device group", + key = "cdmf:groups:devices-count", + permissions = {"/device-mgt/groups/devices/devices-count"} + ), + @Scope( + name = "Add devices to group", + description = "Add devices to group", + key = "cdmf:groups:devices-add", + permissions = {"/device-mgt/groups/devices/devices-add"} + ), + @Scope( + name = "Remove devices from group", + description = "Remove devices from group", + key = "cdmf:groups:devices-remove", + permissions = {"/device-mgt/groups/devices/devices-remove"} + ) + } +) @Path("/groups") @Api(value = "Device Group Management", description = "This API carries all device group management related " + "operations such as get all the available groups, etc.") @@ -88,12 +165,10 @@ public interface GroupManagementService { value = "Get the list of groups belongs to current user.", notes = "Returns all permitted groups enrolled with the system.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/view", - description = "View Groups") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:groups") + }) } ) @ApiResponses(value = { @@ -153,13 +228,12 @@ public interface GroupManagementService { value = "Get the count of groups belongs to current user.", notes = "Returns count of all permitted groups enrolled with the system.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/view", - description = "View Groups") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:count") + }) } + ) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK. \n Successfully fetched the device group count.", @@ -202,12 +276,10 @@ public interface GroupManagementService { value = "Add new device group to the system.", notes = "Add device group with current user as the owner.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/add", - description = "Add Group") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:add") + }) } ) @ApiResponses( @@ -270,12 +342,10 @@ public interface GroupManagementService { value = "View group specified.", notes = "Returns details of group enrolled with the system.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/view", - description = "View Groups") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:groups-view") + }) } ) @ApiResponses(value = { @@ -325,12 +395,10 @@ public interface GroupManagementService { notes = "If you wish to make changes to an existing group, that can be done by updating the group using " + "this resource.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/update", - description = "Update Group") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:update") + }) } ) @ApiResponses(value = { @@ -384,12 +452,10 @@ public interface GroupManagementService { notes = "If you wish to remove an existing group, that can be done by updating the group using " + "this resource.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/remove", - description = "Remove Group") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:remove") + }) } ) @ApiResponses(value = { @@ -438,12 +504,10 @@ public interface GroupManagementService { notes = "If you wish to share /un share an existing group with a user under defined sharing roles, " + "that can be done using this resource.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/share", - description = "Share Group") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:share") + }) } ) @ApiResponses(value = { @@ -496,12 +560,10 @@ public interface GroupManagementService { value = "View list of roles of a device group.", notes = "Returns details of roles which particular group has been shared with.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/roles/view", - description = "View roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:roles") + }) } ) @ApiResponses(value = { @@ -550,12 +612,10 @@ public interface GroupManagementService { value = "View list of devices in the device group.", notes = "Returns list of devices in the device group.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/devices/view", - description = "View devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:devices") + }) } ) @ApiResponses(value = { @@ -612,12 +672,10 @@ public interface GroupManagementService { value = "View list of device count in the device group.", notes = "Returns device count in the device group.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/devices/view", - description = "View devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:devices-count") + }) } ) @ApiResponses(value = { @@ -666,12 +724,10 @@ public interface GroupManagementService { value = "Add devices to group.", notes = "Add existing devices to the device group.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/devices/add", - description = "Add devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:devices-add") + }) } ) @ApiResponses(value = { @@ -724,12 +780,10 @@ public interface GroupManagementService { value = "Remove devices from group.", notes = "Remove existing devices from the device group.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/devices/remove", - description = "Remove devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:devices-remove") + }) } ) @ApiResponses(value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java index 0a2998251c..a3d0d556f3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java @@ -24,16 +24,17 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.notification.mgt.Notification; import org.wso2.carbon.device.mgt.jaxrs.NotificationList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.validation.constraints.Max; import javax.validation.constraints.Size; @@ -60,6 +61,22 @@ import javax.ws.rs.core.Response; @Tag(name = "device_management", description = "") } ) +@Scopes( + scopes = { + @Scope( + name = "Getting All Device Notification Details", + description = "Getting All Device Notification Details", + key = "cdmf:notifications:view", + permissions = {"/device-mgt/notifications/view"} + ), + @Scope( + name = "Updating the Device Notification Status", + description = "Updating the Device Notification Status", + key = "cdmf:notifications:mark-checked", + permissions = {"/device-mgt/notifications/mark-checked"} + ) + } +) @Api(value = "Device Notification Management", description = "Device notification related operations can be found here.") @Path("/notifications") @Produces(MediaType.APPLICATION_JSON) @@ -73,12 +90,10 @@ public interface NotificationManagementService { value = "Getting All Device Notification Details", notes = "Get the details of all the notifications that were pushed to the devices registered with WSO2 EMM using this REST API.", tags = "Device Notification Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/notifications/view", - description = "View notifications") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:notifications:view") + }) } ) @ApiResponses( @@ -164,12 +179,10 @@ public interface NotificationManagementService { notes = "When a user has read the the device notification the device notification status must " + "change from NEW to CHECKED. This API is used to update device notification status.", tags = "Device Notification Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/notifications/view", - description = "View notifications") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:notifications:mark-checked") + }) } ) @ApiResponses( diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java index 6a77938b0f..2994994ac0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java @@ -24,16 +24,17 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.PolicyWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.PriorityUpdatedPolicyWrapper; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import org.wso2.carbon.policy.mgt.common.Policy; import javax.validation.Valid; @@ -62,6 +63,64 @@ import java.util.List; @Tag(name = "device_management", description = "") } ) +@Scopes( + scopes = { + @Scope( + name = "Adding a Policy", + description = "Adding a Policy", + key = "cdmf:policies:manage", + permissions = {"/device-mgt/policies/manage"} + ), + @Scope( + name = "Getting Details of Policies", + description = "Getting Details of Policies", + key = "cdmf:policies:get-details", + permissions = {"/device-mgt/policies/get-details"} + ), + @Scope( + name = "Getting Details of a Policy", + description = "Getting Details of a Policy", + key = "cdmf:policies:get-policy-details", + permissions = {"/device-mgt/policies/get-policy-details"} + ), + @Scope( + name = "Updating a Policy", + description = "Updating a Policy", + key = "cdmf:policies:update", + permissions = {"/device-mgt/policies/update"} + ), + @Scope( + name = "Removing Multiple Policies", + description = "Removing Multiple Policies", + key = "cdmf:policies:remove", + permissions = {"/device-mgt/policies/remove"} + ), + @Scope( + name = "Activating Policies", + description = "Activating Policies", + key = "cdmf:policies:activate", + permissions = {"/device-mgt/policies/activate"} + ), + @Scope( + name = "Deactivating Policies", + description = "Deactivating Policies", + key = "cdmf:policies:deactivate", + permissions = {"/device-mgt/policies/deactivate"} + ), + @Scope( + name = "Applying Changes on Policies", + description = "Applying Changes on Policies", + key = "cdmf:policies:changes", + permissions = {"/device-mgt/policies/changes"} + ), + @Scope( + name = "Updating the Policy Priorities", + description = "Updating the Policy Priorities", + key = "cdmf:policies:priorities", + permissions = {"/device-mgt/policies/priorities"} + ) + } +) @Api(value = "Device Policy Management", description = "This API includes the functionality around device policy management") @Path("/policies") @Produces(MediaType.APPLICATION_JSON) @@ -77,12 +136,10 @@ public interface PolicyManagementService { notes = "Add a policy using this REST API command. When adding a policy you will have the option of saving the policy or saving and publishing the policy." + "Using this REST API you are able to save a created Policy and this policy will be in the inactive state.", tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", - description = "Manage policies") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:manage") + }) } ) @ApiResponses( @@ -147,12 +204,10 @@ public interface PolicyManagementService { notes = "Retrieve the details of all the policies in WSO2 EMM.", response = Policy.class, tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/view", - description = "View policies") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:get-details") + }) } ) @ApiResponses( @@ -224,12 +279,10 @@ public interface PolicyManagementService { notes = "Retrieve the details of a policy that is in WSO2 EMM.", response = Policy.class, tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/view", - description = "View policies") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:get-policy-details") + }) } ) @ApiResponses( @@ -294,12 +347,10 @@ public interface PolicyManagementService { value = "Updating a Policy", notes = "Make changes to an existing policy by updating the policy using this resource.", tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", - description = "Manage policies") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:update") + }) } ) @ApiResponses( @@ -364,12 +415,10 @@ public interface PolicyManagementService { value = "Removing Multiple Policies", notes = "Delete one or more than one policy using this API.", tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", - description = "Manage policies") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:remove") + }) } ) @ApiResponses( @@ -412,12 +461,10 @@ public interface PolicyManagementService { value = "Activating Policies", notes = "Publish a policy using this API to bring a policy that is in the inactive state to the active state.", tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", - description = "Manage policies") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:activate") + }) } ) @ApiResponses( @@ -455,12 +502,10 @@ public interface PolicyManagementService { value = "Deactivating Policies", notes = "Unpublish a policy using this API to bring a policy that is in the active state to the inactive state.", tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", - description = "Manage policies") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:deactivate") + }) } ) @ApiResponses( @@ -503,12 +548,10 @@ public interface PolicyManagementService { " devices will not receive these changes immediately. Once all the required changes are made" + " you need to apply the changes to push the policy changes to the existing devices.", tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", - description = "Manage policies") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:changes") + }) } ) @ApiResponses( @@ -533,13 +576,11 @@ public interface PolicyManagementService { value = "Updating the Policy Priorities", notes = "Make changes to the existing policy priority order by updating the priority order using this API.", tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", - description = "Manage policies") } - ) - } + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:priorities") + }) + } ) @ApiResponses( value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java index cc894b9c0b..b308ddc970 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java @@ -24,16 +24,17 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.RoleInfo; import org.wso2.carbon.device.mgt.jaxrs.beans.RoleList; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import org.wso2.carbon.user.mgt.common.UIPermissionNode; import javax.ws.rs.*; @@ -56,6 +57,58 @@ import java.util.List; @Tag(name = "device_management", description = "") } ) +@Scopes( + scopes = { + @Scope( + name = "Getting the List of Roles", + description = "Getting the List of Roles", + key = "cdmf:roles:view", + permissions = {"/device-mgt/roles/view"} + ), + @Scope( + name = "Getting Permission Details of a Role", + description = "Getting Permission Details of a Role", + key = "cdmf:roles:permissions", + permissions = {"/device-mgt/roles/permissions"} + ), + @Scope( + name = "Getting the List of Roles", + description = "Getting the List of Roles", + key = "cdmf:roles:details", + permissions = {"/device-mgt/roles/details"} + ), + @Scope( + name = "Adding a Role", + description = "Adding a Role", + key = "cdmf:roles:add", + permissions = {"/device-mgt/roles/add"} + ), + @Scope( + name = "Adding a combined Role", + description = "Adding a combined Role", + key = "cdmf:roles:create-combined-role", + permissions = {"/device-mgt/roles/create-combined-role"} + ), + @Scope( + name = "Updating Role Details", + description = "Updating Role Details", + key = "cdmf:roles:update", + permissions = {"/device-mgt/roles/update"} + ), + @Scope( + name = "Deleting a Role", + description = "Deleting a Role", + key = "cdmf:roles:delete", + permissions = {"/device-mgt/roles/delete"} + ), + @Scope( + name = "Adding Users to a Role", + description = "Adding Users to a Role", + key = "cdmf:roles:add-users", + permissions = {"/device-mgt/roles/add-users"} + ) + } +) @Path("/roles") @Api(value = "Role Management", description = "Role management related operations can be found here.") @Produces(MediaType.APPLICATION_JSON) @@ -70,11 +123,10 @@ public interface RoleManagementService { notes = "WSO2 EMM supports role-based access control (RBAC) and role management. Using this API you can the list of roles that are in WSO2 EMM.\n" + "Note: Internal roles, roles created for service-providers, and application related roles will not be given in the output.", tags = "Role Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/roles/view", description = "View Roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:view") + }) } ) @ApiResponses( @@ -151,11 +203,10 @@ public interface RoleManagementService { response = UIPermissionNode.class, responseContainer = "List", tags = "Role Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/roles/view", description = "View Roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:permissions") + }) } ) @ApiResponses( @@ -227,12 +278,10 @@ public interface RoleManagementService { notes = "Get the permissions associated with a role and role specific details using this REST API.", response = RoleInfo.class, tags = "Role Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/roles/view", - description = "View Roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:details") + }) } ) @ApiResponses( @@ -303,12 +352,10 @@ public interface RoleManagementService { value = "Adding a Role", notes = "WSO2 EMM supports role-based access control (RBAC) and role management. Add a new role to WSO2 EMM using this REST API.", tags = "Role Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/roles/manage", - description = "Manage Roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:add") + }) } ) @ApiResponses(value = { @@ -365,12 +412,10 @@ public interface RoleManagementService { value = "Adding a combined Role", notes = "WSO2 EMM supports role-based access control (RBAC) and role management. Add a new combined role to WSO2 EMM using this REST API.", tags = "Role Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/roles/manage", - description = "Manage Roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:create-combined-role") + }) } ) @ApiResponses(value = { @@ -430,12 +475,10 @@ public interface RoleManagementService { notes = "There will be situations where you need to update the role details, such as the permissions" + " or the role name. Update the role details using this REST API.", tags = "Role Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/roles/manage", - description = "Manage Roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:update") + }) } ) @ApiResponses(value = { @@ -498,12 +541,10 @@ public interface RoleManagementService { notes = "Roles become obsolete over time due to various reasons. In a situation where your Organization identifies that a specific role is no longer required, you " + "can delete a role using this REST API.", tags = "Role Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/roles/manage", - description = "Manage Roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:delete") + }) } ) @ApiResponses(value = { @@ -550,12 +591,10 @@ public interface RoleManagementService { "be cumbersome. Therefore, you can define all the new employees that belong to the engineering " + "role using this API.", tags = "Role Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/roles/manage", - description = "Manage Roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:add-users") + }) } ) @ApiResponses( diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java index b211a3a101..e7154089c6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java @@ -24,14 +24,14 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.jaxrs.beans.*; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; @@ -53,6 +53,76 @@ import java.util.List; @Tag(name = "device_management", description = "") } ) +@Scopes( + scopes = { + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Adding a User", + description = "Adding a User", + key = "cdmf:users:add", + permissions = {"/device-mgt/users/add"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Getting Details of a User", + description = "Getting Details of a User", + key = "cdmf:users:details", + permissions = {"/device-mgt/users/details"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Updating Details of a User", + description = "Updating Details of a User", + key = "cdmf:users:update", + permissions = {"/device-mgt/policies/update"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Deleting a User", + description = "Deleting a User", + key = "cdmf:users:delete", + permissions = {"/device-mgt/policies/delete"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Getting the Role Details of a User", + description = "Getting the Role Details of a User", + key = "cdmf:users:roles", + permissions = {"/device-mgt/policies/roles"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Getting Details of Users", + description = "Getting Details of Users", + key = "cdmf:users:user-details", + permissions = {"/device-mgt/policies/user-details"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Getting the User Count", + description = "Getting the User Count", + key = "cdmf:users:count", + permissions = {"/device-mgt/policies/count"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Getting the User existence status", + description = "Getting the User existence status", + key = "cdmf:users:is-exist", + permissions = {"/device-mgt/policies/is-exist"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Searching for a User Name", + description = "Searching for a User Name", + key = "cdmf:users:search", + permissions = {"/device-mgt/policies/search"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Changing the User Password", + description = "Adding a User", + key = "cdmf:users:credentials", + permissions = {"/device-mgt/policies/credentials"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Sending Enrollment Invitations to Users", + description = "Sending Enrollment Invitations to Users", + key = "cdmf:users:send-invitation", + permissions = {"/device-mgt/policies/send-invitation"} + ) + } +) @Path("/users") @Api(value = "User Management", description = "User management related operations can be found here.") @Produces(MediaType.APPLICATION_JSON) @@ -67,12 +137,10 @@ public interface UserManagementService { value = "Adding a User", notes = "WSO2 EMM supports user management. Add a new user to the WSO2 EMM user management system via this REST API", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/manage", - description = "Manage Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:add") + }) } ) @ApiResponses( @@ -129,12 +197,10 @@ public interface UserManagementService { notes = "Get the details of a user registered with WSO2 EMM using the REST API.", response = BasicUserInfo.class, tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", - description = "View Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:details") + }) } ) @ApiResponses(value = { @@ -202,12 +268,10 @@ public interface UserManagementService { notes = "There will be situations where you will want to update the user details. In such " + "situation you can update the user details using this REST API.", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/manage", - description = "Manage Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:update") + }) } ) @ApiResponses(value = { @@ -269,12 +333,10 @@ public interface UserManagementService { value = "Deleting a User", notes = "When an employee leaves the organization, you can remove the user details from WSO2 EMM using this REST API.", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/manage", - description = "Manage Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:delete") + }) } ) @ApiResponses(value = { @@ -314,12 +376,10 @@ public interface UserManagementService { value = "Getting the Role Details of a User", notes = "A user can be assigned to one or more role in EMM. Using this REST API you can get the role/roles a user is assigned to.", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", - description = "View Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:roles") + }) } ) @ApiResponses(value = { @@ -378,12 +438,10 @@ public interface UserManagementService { notes = "You are able to manage users in WSO2 EMM by adding, updating and removing users. If you wish to get the list of users registered with WSO2 EMM, you can do so " + "using this REST API", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", - description = "View Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:user-details") + }) } ) @ApiResponses(value = { @@ -451,11 +509,10 @@ public interface UserManagementService { value = "Getting the User Count", notes = "Get the number of users in WSO2 EMM via this REST API.", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", description = "View Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:count") + }) } ) @ApiResponses(value = { @@ -487,12 +544,10 @@ public interface UserManagementService { value = "Getting the User existence status", notes = "Check if the user exists in the user store.", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", - description = "View Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:is-exist") + }) } ) @ApiResponses(value = { @@ -532,11 +587,10 @@ public interface UserManagementService { + "You will be given a list of users having the user name in the exact order of the " + "characters you provided.", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", description = "View Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:search") + }) } ) @ApiResponses(value = { @@ -610,11 +664,10 @@ public interface UserManagementService { value = "Changing the User Password", notes = "A user is able to change the password to secure their WSO2 EMM profile via this REST API.", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/login", description = "Reset user password") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:credentials") + }) } ) @ApiResponses(value = { @@ -656,11 +709,10 @@ public interface UserManagementService { notes = "Send the users a mail inviting them to download the EMM mobile application on their devices using the REST API given below.\n" + "Before running the REST API command to send the enrollment invitations to users make sure to configure WSO2 EMM as explained in step 4, under the WSO2 EMM general server configurations documentation.", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/manage", description = "Manage Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:send-invitation") + }) } ) @ApiResponses(value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java index 8f49261202..450b3a3778 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java @@ -18,9 +18,18 @@ */ package org.wso2.carbon.device.mgt.jaxrs.service.api.admin; -import io.swagger.annotations.*; -import org.wso2.carbon.apimgt.annotations.api.*; +import io.swagger.annotations.SwaggerDefinition; +import io.swagger.annotations.Info; +import io.swagger.annotations.ExtensionProperty; +import io.swagger.annotations.Extension; +import io.swagger.annotations.Tag; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.jaxrs.beans.ApplicationWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; @@ -55,10 +64,16 @@ import javax.ws.rs.core.Response; @Scopes( scopes = { @Scope( - name = "Manage application", - description = "", - key = "cdmf:manage-application", - permissions = {"/device-mgt/applications/manage"} + name = "Installing an Application (Internal API)", + description = "Installing an Application (Internal API)", + key = "cdmf:applications:install", + permissions = {"/device-mgt/applications/install"} + ), + @Scope( + name = "Uninstalling an Application (Internal API)", + description = "Uninstalling an Application (Internal API)", + key = "cdmf:applications:uninstall", + permissions = {"/device-mgt/applications/uninstall"} ) } ) @@ -78,7 +93,7 @@ public interface ApplicationManagementAdminService { tags = "Application Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:manage-application") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:applications:install") }) } ) @@ -122,7 +137,7 @@ public interface ApplicationManagementAdminService { tags = "Application Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:manage-application") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:applications:uninstall") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java index a2e80bcbf9..72ba18d506 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java @@ -24,8 +24,6 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; @@ -66,10 +64,10 @@ import javax.ws.rs.core.Response; @Scopes( scopes = { @Scope( - name = "Manage device", - description = "", - key = "cdmf:manage-own-device", - permissions = {"/device-mgt/devices/owning-device/view"} + name = "Getting Details of a Device", + description = "Getting Details of a Device", + key = "cdmf:admin:devices:view", + permissions = {"/device-mgt/devices/admin/devices/view"} ) } ) @@ -86,7 +84,7 @@ public interface DeviceManagementAdminService { tags = "Device Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:manage-own-device") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:admin:devices:view") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java index b5716e9db3..06d0842985 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java @@ -25,8 +25,6 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; @@ -69,8 +67,14 @@ import javax.ws.rs.core.Response; @Scope( name = "View groups", description = "", - key = "cdmf:view-groups", + key = "cdmf:admin-groups:view", permissions = {"/device-mgt/admin/groups/view"} + ), + @Scope( + name = "Count groups", + description = "", + key = "cdmf:admin-groups:count", + permissions = {"/device-mgt/admin/groups/count"} ) } ) @@ -85,7 +89,7 @@ public interface GroupManagementAdminService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:view-groups") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:admin-groups:view") }) } ) @@ -146,12 +150,10 @@ public interface GroupManagementAdminService { value = "Get the count of groups belongs to current user.", notes = "Returns count of all permitted groups enrolled with the system.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/admin/groups/view", description - = "View Groups") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:admin-groups:count") + }) } ) @ApiResponses(value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java index 99914a94ab..fbb3603e56 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java @@ -24,14 +24,15 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.PasswordResetWrapper; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.validation.constraints.Size; import javax.ws.rs.*; @@ -53,6 +54,16 @@ import javax.ws.rs.core.Response; @Tag(name = "device_management", description = "") } ) +@Scopes( + scopes = { + @Scope( + name = "View Users", + description = "View Users", + key = "cdmf:admin-users:view", + permissions = {"/device-mgt/admin/users/view"} + ) + } +) @Path("/admin/users") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @@ -71,12 +82,10 @@ public interface UserManagementAdminService { notes = "The EMM administrator is able to change the password of the users in " + "the system and block them from logging into their EMM profile using this REST API.", tags = "User Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/manage", description - = "View Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:admin-users:view") + }) } ) @ApiResponses(value = { From a829c384d3c32ce7cf0f8db60209cb70d41171f4 Mon Sep 17 00:00:00 2001 From: Milan Perera Date: Thu, 5 Jan 2017 11:21:28 +0530 Subject: [PATCH 19/47] Updated to APIM latest snapshot version --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 1127a873b2..d6026cf72f 100644 --- a/pom.xml +++ b/pom.xml @@ -1910,7 +1910,7 @@ 5.7.0 - 5.3.2-SNAPSHOT + 5.3.1 5.3.0 @@ -1940,7 +1940,7 @@ [2.6.0,3.0.0) - 6.1.20-SNAPSHOT + 6.1.30-SNAPSHOT (6.0.0,7.0.0] From 6860c6688283c04e2fef5ae82784e7c93be52bed Mon Sep 17 00:00:00 2001 From: GPrathap Date: Thu, 5 Jan 2017 12:05:40 +0530 Subject: [PATCH 20/47] Revert "added scope annotation" This reverts commit 2619c626b29e51784f9b6242b906f54772807721. --- .../CertificateManagementAdminService.java | 48 ++--- .../api/ActivityInfoProviderService.java | 22 +- .../api/ConfigurationManagementService.java | 10 +- .../mgt/jaxrs/service/api/Dashboard.java | 160 +------------- .../service/api/DeviceManagementService.java | 166 ++++++-------- .../api/DeviceTypeManagementService.java | 42 ++-- .../service/api/GroupManagementService.java | 202 +++++++----------- .../api/NotificationManagementService.java | 41 ++-- .../service/api/PolicyManagementService.java | 155 +++++--------- .../service/api/RoleManagementService.java | 135 +++++------- .../service/api/UserManagementService.java | 180 ++++++---------- .../ApplicationManagementAdminService.java | 31 +-- .../admin/DeviceManagementAdminService.java | 12 +- .../admin/GroupManagementAdminService.java | 22 +- .../api/admin/UserManagementAdminService.java | 25 +-- 15 files changed, 400 insertions(+), 851 deletions(-) diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java index df92a10eb3..3f849cba9c 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java @@ -1,16 +1,6 @@ package org.wso2.carbon.certificate.mgt.cert.jaxrs.api; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.ResponseHeader; +import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.CertificateList; @@ -41,28 +31,16 @@ import javax.ws.rs.core.Response; @Path("/admin/certificates") @Scopes(scopes = { @Scope( - name = "Adding a new SSL certificate", - description = "Adding a new SSL certificate", - key = "cdmf:admin:certificates:add", - permissions = {"/device-mgt/admin/certificates/add"} + name = "Manage certificates", + description = "", + key = "cdmf:manage-certificate", + permissions = {"/device-mgt/certificates/manage"} ), @Scope( - name = "Getting Details of an SSL Certificate", - description = "Getting Details of an SSL Certificate", - key = "cdmf:admin:certificates:details", - permissions = {"/device-mgt/admin/certificates/details"} - ), - @Scope( - name = "Getting Details of Certificates", - description = "Getting Details of Certificates", - key = "cdmf:admin:certificates:view", - permissions = {"/device-mgt/admin/certificates/view"} - ), - @Scope( - name = "Deleting an SSL Certificate", - description = "Deleting an SSL Certificate", - key = "cdmf:admin:certificates:delete", - permissions = {"/device-mgt/admin/certificates/delete"} + name = "View certificate", + description = "", + key = "cdmf:view-certificate", + permissions = {"/device-mgt/certificates/view"} ) } ) @@ -89,7 +67,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:admin:certificates:add") + @ExtensionProperty(name = SCOPE, value = "cdmf:manage-certificate") }) } ) @@ -158,7 +136,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:admin:certificates:details") + @ExtensionProperty(name = SCOPE, value = "cdmf:view-certificate") }) } ) @@ -229,7 +207,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:admin:certificates:view") + @ExtensionProperty(name = SCOPE, value = "cdmf:view-certificate") }) } ) @@ -308,7 +286,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:admin:certificates:delete") + @ExtensionProperty(name = SCOPE, value = "cdmf:manage-certificate") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java index 3a040fa216..9c3e2c4f5b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java @@ -18,17 +18,7 @@ */ package org.wso2.carbon.device.mgt.jaxrs.service.api; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.ResponseHeader; +import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; @@ -65,9 +55,9 @@ import javax.ws.rs.core.Response; @Scopes( scopes = { @Scope( - name = "Getting Details of an Activity", - description = "Getting Details of an Activity", - key = "cdmf:activities:details", + name = "Get activities", + description = "Get activities", + key = "cdmf:get-activity", permissions = {"/device-mgt/devices/owning-device/view"} ) } @@ -87,7 +77,7 @@ public interface ActivityInfoProviderService { tags = "Activity Info Provider", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:activities:details") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:get-activity") }) } ) @@ -160,7 +150,7 @@ public interface ActivityInfoProviderService { tags = "Activity Info Provider", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:activities:details") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:get-activity") }) } ) 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 87fa47c5d3..504bd75f1d 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 @@ -24,6 +24,8 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; +import io.swagger.annotations.AuthorizationScope; +import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; @@ -66,13 +68,13 @@ import javax.ws.rs.core.Response; @Scope( name = "View configurations", description = "", - key = "cdmf:configuration:view", + key = "cdmf:view-configuration", permissions = {"/device-mgt/platform-configurations/view"} ), @Scope( name = "Manage configurations", description = "", - key = "cdmf:configuration:manage", + key = "cdmf:manage-configuration", permissions = {"/device-mgt/platform-configurations/manage"} ) } @@ -90,7 +92,7 @@ public interface ConfigurationManagementService { tags = "Configuration Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:configuration:view") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:view-configuration") }) } ) @@ -149,7 +151,7 @@ public interface ConfigurationManagementService { tags = "Configuration Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:configuration:manage") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:manage-configuration") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java index 8251ff40ae..903c92e5cd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java @@ -1,23 +1,15 @@ package org.wso2.carbon.device.mgt.jaxrs.service.api; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; -import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup; import org.wso2.carbon.device.mgt.jaxrs.beans.DashboardGadgetDataWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.DashboardPaginationGadgetDataWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; -import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; @@ -26,89 +18,9 @@ import javax.ws.rs.core.Response; /** * Device Analytics Dashboard related REST-APIs. This can be used to obtain device related analytics. */ -@SwaggerDefinition( - info = @Info( - version = "1.0.0", - title = "", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = "name", value = "DeviceAnalyticsDashboard"), - @ExtensionProperty(name = "context", value = "/api/device-mgt/v1.0/dashboard"), - }) - } - ), - tags = { - @Tag(name = "device_management", description = "Device Analytics Dashboard related information APIs" + - " are described here.") - } -) @Path("/dashboard") @Api(value = "Device Analytics Dashboard", description = "Device Analytics Dashboard related information APIs are described here.") -@Scopes( - scopes = { - @Scope( - name = "Device Count Overview", - description = "Device Count Overview", - key = "cdmf:dashboard:count-overview", - permissions = {"/device-mgt/dashboard/device-count"} - ), - @Scope( - name = "Device Counts by Potential Vulnerabilities", - description = "Device Counts by Potential Vulnerabilities", - key = "cdmf:dashboard:vulnerabilities", - permissions = {"/device-mgt/dashboard/vulnerabilities"} - ), - @Scope( - name = "Get the number of devices that have not complied to a policy", - description = "Get the number of devices that have not complied to a policy", - key = "cdmf:dashboard:non-compliant", - permissions = {"/device-mgt/dashboard/features"} - ), - @Scope( - name = "Get the number of devices for a given device type, such as connectivity status, " - + "potential vulnerability, platform, and ownership", - description = "Get the number of devices for a given device type, such as connectivity status, " - + "potential vulnerability, platform, and ownership", - key = "cdmf:dashboard:by-groups", - permissions = {"/device-mgt/dashboard/groups"} - ), - @Scope( - name = "Get the number of devices that have not complied to a given policy based on a particular", - description = "Get the number of devices that have not complied to a given policy based on a particular", - key = "cdmf:dashboard:device-counts", - permissions = {"/device-mgt/dashboard/groups"} - ), - @Scope( - name = "Get the number of devices that have not complied to a given policy based on a particular" - + " device type.", - description = "Get the number of devices that have not complied to a given policy based on a " + - "particular device type.", - key = "cdmf:dashboard:filtered-count", - permissions = {"/device-mgt/dashboard/total"} - ), - @Scope( - name = "Get the number of devices that have not complied to a given policy over the total" - + " number of devices registered with WSO2 EMM.\n", - description = "Get the number of devices that have not complied to a given policy over the total" - + " number of devices registered with WSO2 EMM.\n", - key = "cdmf:dashboard:non-compliant-count", - permissions = {"/device-mgt/dashboard/total"} - ), - @Scope( - name = "Get device details of devices based on a particular device type.", - description = "Get device details of devices based on a particular device type.", - key = "cdmf:dashboard:details", - permissions = {"/device-mgt/dashboard/details"} - ), - @Scope( - name = "Get device details of non-compliant devices which do not comply to a given policy.", - description = "Get device details of non-compliant devices which do not comply to a given policy.", - key = "cdmf:dashboard:feature-non-compliant", - permissions = {"/device-mgt/dashboard/details"} - ) - } -) @Produces(MediaType.APPLICATION_JSON) @SuppressWarnings("NonJaxWsWebServices") public interface Dashboard { @@ -131,13 +43,7 @@ public interface Dashboard { value = "Get the details of registered devices in WSO2 EMM.", notes = "Get the details of active, inactive, removed and total number of registered devices in" + " WSO2 EMM.", - tags = "Dashboard", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:count-overview") - }) - } - ) + tags = "Dashboard") @ApiResponses(value = { @ApiResponse( code = 200, @@ -187,13 +93,7 @@ public interface Dashboard { produces = MediaType.APPLICATION_JSON, httpMethod = "GET", value = "Get the number of unmonitored and non-compliant devices in WSO2 EMM.", - tags = "Dashboard", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:vulnerabilities") - }) - } - ) + tags = "Dashboard") @ApiResponses(value = { @ApiResponse( code = 200, @@ -244,13 +144,7 @@ public interface Dashboard { httpMethod = "GET", value = "Get the number of devices that have not complied to a policy that was enforced on a " + "device.", - tags = "Dashboard", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:non-compliant") - }) - } - ) + tags = "Dashboard") @ApiResponses(value = { @ApiResponse( code = 200, @@ -314,13 +208,7 @@ public interface Dashboard { httpMethod = "GET", value = "Get the number of devices for a given device type, such as connectivity status, " + "potential vulnerability, platform, and ownership.\n", - tags = "Dashboard", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:by-groups") - }) - } - ) + tags = "Dashboard") @ApiResponses(value = { @ApiResponse( code = 200, @@ -403,13 +291,7 @@ public interface Dashboard { httpMethod = "GET", value = "Get the number of devices that have not complied to a given policy based on a particular" + " device type.", - tags = "Dashboard", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:device-counts") - }) - } - ) + tags = "Dashboard") @ApiResponses(value = { @ApiResponse( code = 200, @@ -482,13 +364,7 @@ public interface Dashboard { + "Connectivity status of the device, such as active, inactive or removed.\n" + "The device ownership type, such as BYOD or COPE.\n" + "The device platform.\n" + "The potential vulnerabilities faced by the devices.", - tags = "Dashboard", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:filtered-count") - }) - } - ) + tags = "Dashboard") @ApiResponses(value = { @ApiResponse( code = 200, @@ -574,13 +450,7 @@ public interface Dashboard { httpMethod = "GET", value = "Get the number of devices that have not complied to a given policy over the total" + " number of devices registered with WSO2 EMM.\n", - tags = "Dashboard", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:non-compliant-count") - }) - } - ) + tags = "Dashboard") @ApiResponses(value = { @ApiResponse( code = 200, @@ -649,13 +519,7 @@ public interface Dashboard { produces = MediaType.APPLICATION_JSON, httpMethod = "GET", value = "Get device details of devices based on a particular device type.", - tags = "Dashboard", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:details") - }) - } - ) + tags = "Dashboard") @ApiResponses(value = { @ApiResponse( code = 200, @@ -751,13 +615,7 @@ public interface Dashboard { produces = MediaType.APPLICATION_JSON, httpMethod = "GET", value = "Get device details of non-compliant devices which do not comply to a given policy.", - tags = "Dashboard", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:feature-non-compliant") - }) - } - ) + tags = "Dashboard") @ApiResponses(value = { @ApiResponse( code = 200, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java index ed9290df4c..650ae34f7b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java @@ -24,13 +24,13 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; +import io.swagger.annotations.AuthorizationScope; +import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; -import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Feature; import org.wso2.carbon.device.mgt.common.app.mgt.Application; @@ -38,7 +38,6 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.search.SearchContext; import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; -import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import org.wso2.carbon.policy.mgt.common.Policy; import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData; @@ -65,64 +64,6 @@ import javax.ws.rs.core.Response; @Tag(name = "device_management", description = "") } ) -@Scopes( - scopes = { - @Scope( - name = "Getting Details of Registered Devices", - description = "Getting Details of Registered Devices", - key = "cdmf:devices:view", - permissions = {"/device-mgt/devices/owning-device/view"} - ), - @Scope( - name = "Getting Details of a Device", - description = "Getting Details of a Device", - key = "cdmf:devices:details", - permissions = {"/device-mgt/devices/owning-device/details"} - ), - @Scope( - name = "Delete the device specified by device id", - description = "Delete the device specified by device id", - key = "cdmf:devices:delete", - permissions = {"/device-mgt/devices/owning-device/delete"} - ), - @Scope( - name = "Getting Feature Details of a Device", - description = "Getting Feature Details of a Device", - key = "cdmf:devices:features", - permissions = {"/device-mgt/devices/owning-device/features"} - ), - @Scope( - name = "Advanced Search for Devices", - description = "Advanced Search for Devices", - key = "cdmf:devices:search", - permissions = {"/device-mgt/devices/owning-device/view"} - ), - @Scope( - name = "Getting Installed Application Details of a Device", - description = "Getting Installed Application Details of a Device", - key = "cdmf:devices:applications", - permissions = {"/device-mgt/devices/owning-device/applications"} - ), - @Scope( - name = "Getting Device Operation Details", - description = "Getting Device Operation Details", - key = "cdmf:devices:operations", - permissions = {"/device-mgt/devices/owning-device/operations"} - ), - @Scope( - name = "Get the details of the policy that is enforced on a device.", - description = "Get the details of the policy that is enforced on a device.", - key = "cdmf:devices:effective-policy", - permissions = {"/device-mgt/devices/owning-device/effective-policy"} - ), - @Scope( - name = "Getting Policy Compliance Details of a Device", - description = "Getting Policy Compliance Details of a Device", - key = "cdmf:devices:compliance-data", - permissions = {"/device-mgt/devices/owning-device/compliance-data"} - ) - } -) @Path("/devices") @Api(value = "Device Management", description = "This API carries all device management related operations " + "such as get all the available devices, etc.") @@ -137,11 +78,13 @@ public interface DeviceManagementService { value = "Getting Details of Registered Devices", notes = "Provides details of all the devices enrolled with WSO2 EMM.", tags = "Device Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:view") - }) - } + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view" + , description = "View Devices") } + ) + } ) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK. \n Successfully fetched the list of devices.", @@ -262,10 +205,12 @@ public interface DeviceManagementService { value = "Getting Details of a Device", notes = "Get the details of a device by specifying the device type and device identifier.", tags = "Device Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:details") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", + description = "View Devices") } + ) } ) @ApiResponses( @@ -337,13 +282,15 @@ public interface DeviceManagementService { @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = "DELETE", - value = "Delete the device specified by device id", + value = "Delete the device speccified by device id", notes = "Returns the status of the deleted device operation.", tags = "Device Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:delete") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", + description = "View Devices") } + ) } ) @ApiResponses( @@ -412,11 +359,13 @@ public interface DeviceManagementService { "Using this REST API you can get the features that can be carried out on a preferred device type," + " such as iOS, Android or Windows.", tags = "Device Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:features") - }) - } + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", + description = "View Devices") } + ) + } ) @ApiResponses( value = { @@ -501,10 +450,12 @@ public interface DeviceManagementService { value = "Advanced Search for Devices", notes = "Search for devices by filtering the search result through the specified search terms.", tags = "Device Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:search") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", + description = "View Devices") } + ) } ) @ApiResponses( @@ -578,12 +529,13 @@ public interface DeviceManagementService { value = "Getting Installed Application Details of a Device", notes = "Get the list of applications subscribed to by a device.", tags = "Device Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:applications") - }) - - } + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", + description = "View Devices") } + ) + } ) @ApiResponses( value = { @@ -681,11 +633,13 @@ public interface DeviceManagementService { value = "Getting Device Operation Details", notes = "Get the details of operations carried out on a selected device.", tags = "Device Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:operations") - }) - } + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", + description = "View Devices") } + ) + } ) @ApiResponses( value = { @@ -792,11 +746,13 @@ public interface DeviceManagementService { "WSO2 EMM filters the policies based on the device platform (device type)," + "the device ownership type, the user role or name and finally, the policy that matches these filters will be enforced on the device.", tags = "Device Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:effective-policy") - }) - } + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", + description = "View Devices") } + ) + } ) @ApiResponses( value = { @@ -881,10 +837,12 @@ public interface DeviceManagementService { notes = "A policy is enforced on the devices that register with WSO2 EMM. " + "The server checks if the settings in the device comply with the policy that is enforced on the device using this REST API.", tags = "Device Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:compliance-data") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", + description = "View Devices") } + ) } ) @ApiResponses( diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java index 963edc84f7..94b06ea751 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java @@ -24,16 +24,15 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; +import io.swagger.annotations.AuthorizationScope; +import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; -import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceTypeList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; -import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.validation.constraints.Size; import javax.ws.rs.*; @@ -55,22 +54,6 @@ import javax.ws.rs.core.Response; @Tag(name = "device_management", description = "") } ) -@Scopes( - scopes = { - @Scope( - name = "Getting the Supported Device Platforms", - description = "Getting the Supported Device Platforms", - key = "cdmf:device-types:types", - permissions = {"/device-mgt/device-types/types"} - ), - @Scope( - name = "Get Feature Details of a Device Type", - description = "Get Feature Details of a Device Type", - key = "cdmf:device-types:features", - permissions = {"/device-mgt/device-types/features"} - ) - } -) @Path("/device-types") @Api(value = "Device Type Management", description = "This API corresponds to all tasks related to device " + "type management") @@ -85,10 +68,12 @@ public interface DeviceTypeManagementService { value = "Getting the Supported Device Platforms", notes = "Get the list of device platforms supported by WSO2 EMM.", tags = "Device Type Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:device-types:types") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", + description = "View Device Types") } + ) } ) @ApiResponses( @@ -138,7 +123,6 @@ public interface DeviceTypeManagementService { String ifModifiedSince); @GET - @Path("/{type}/features") @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = "GET", @@ -147,10 +131,12 @@ public interface DeviceTypeManagementService { "Using this REST API you can get the features that can be carried out on a preferred device type," + " such as iOS, Android or Windows.", tags = "Device Type Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:device-types:features") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", + description = "View Device Types") } + ) } ) @ApiResponses( diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java index aff13f2437..a982a3c3d5 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java @@ -24,6 +24,8 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.Authorization; +import io.swagger.annotations.AuthorizationScope; import io.swagger.annotations.Extension; import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Info; @@ -31,15 +33,12 @@ import io.swagger.annotations.ResponseHeader; import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.Tag; import org.apache.axis2.transport.http.HTTPConstants; -import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup; import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceGroupList; import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.RoleList; -import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.validation.Valid; import javax.ws.rs.Consumes; @@ -75,82 +74,6 @@ import java.util.List; "details.") } ) -@Scopes( - scopes = { - @Scope( - name = "Get the list of groups belongs to current user.", - description = "Get the list of groups belongs to current user.", - key = "cdmf:groups:groups", - permissions = {"/device-mgt/groups/groups"} - ), - @Scope( - name = "Get the count of groups belongs to current user.", - description = "Get the count of groups belongs to current user.", - key = "cdmf:groups:count", - permissions = {"/device-mgt/groups/count"} - ), - @Scope( - name = "Add new device group to the system.", - description = "Add new device group to the system.", - key = "cdmf:groups:add", - permissions = {"/device-mgt/groups/add"} - ), - @Scope( - name = "View group specified", - description = "View group specified", - key = "cdmf:groups:groups-view", - permissions = {"/device-mgt/groups/groups-view"} - ), - @Scope( - name = "Update a group", - description = "Update a group", - key = "cdmf:groups:update", - permissions = {"/device-mgt/groups/update"} - ), - @Scope( - name = "Delete a group", - description = "Delete a group", - key = "cdmf:groups:remove", - permissions = {"/device-mgt/groups/remove"} - ), - @Scope( - name = "Manage group sharing with a user", - description = "Manage group sharing with a user", - key = "cdmf:groups:share", - permissions = {"/device-mgt/groups/share"} - ), - @Scope( - name = "View list of roles of a device group", - description = "View list of roles of a device group", - key = "cdmf:groups:roles", - permissions = {"/device-mgt/groups/roles"} - ), - @Scope( - name = "View list of devices in the device group", - description = "View list of devices in the device group", - key = "cdmf:groups:devices", - permissions = {"/device-mgt/groups/devices"} - ), - @Scope( - name = "View list of device count in the device group", - description = "View list of device count in the device group", - key = "cdmf:groups:devices-count", - permissions = {"/device-mgt/groups/devices/devices-count"} - ), - @Scope( - name = "Add devices to group", - description = "Add devices to group", - key = "cdmf:groups:devices-add", - permissions = {"/device-mgt/groups/devices/devices-add"} - ), - @Scope( - name = "Remove devices from group", - description = "Remove devices from group", - key = "cdmf:groups:devices-remove", - permissions = {"/device-mgt/groups/devices/devices-remove"} - ) - } -) @Path("/groups") @Api(value = "Device Group Management", description = "This API carries all device group management related " + "operations such as get all the available groups, etc.") @@ -165,10 +88,12 @@ public interface GroupManagementService { value = "Get the list of groups belongs to current user.", notes = "Returns all permitted groups enrolled with the system.", tags = "Device Group Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:groups") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/groups/view", + description = "View Groups") } + ) } ) @ApiResponses(value = { @@ -228,12 +153,13 @@ public interface GroupManagementService { value = "Get the count of groups belongs to current user.", notes = "Returns count of all permitted groups enrolled with the system.", tags = "Device Group Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:count") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/groups/view", + description = "View Groups") } + ) } - ) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK. \n Successfully fetched the device group count.", @@ -276,10 +202,12 @@ public interface GroupManagementService { value = "Add new device group to the system.", notes = "Add device group with current user as the owner.", tags = "Device Group Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:add") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/groups/add", + description = "Add Group") } + ) } ) @ApiResponses( @@ -342,10 +270,12 @@ public interface GroupManagementService { value = "View group specified.", notes = "Returns details of group enrolled with the system.", tags = "Device Group Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:groups-view") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/groups/view", + description = "View Groups") } + ) } ) @ApiResponses(value = { @@ -395,10 +325,12 @@ public interface GroupManagementService { notes = "If you wish to make changes to an existing group, that can be done by updating the group using " + "this resource.", tags = "Device Group Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:update") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/groups/update", + description = "Update Group") } + ) } ) @ApiResponses(value = { @@ -452,10 +384,12 @@ public interface GroupManagementService { notes = "If you wish to remove an existing group, that can be done by updating the group using " + "this resource.", tags = "Device Group Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:remove") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/groups/remove", + description = "Remove Group") } + ) } ) @ApiResponses(value = { @@ -504,10 +438,12 @@ public interface GroupManagementService { notes = "If you wish to share /un share an existing group with a user under defined sharing roles, " + "that can be done using this resource.", tags = "Device Group Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:share") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/groups/share", + description = "Share Group") } + ) } ) @ApiResponses(value = { @@ -560,10 +496,12 @@ public interface GroupManagementService { value = "View list of roles of a device group.", notes = "Returns details of roles which particular group has been shared with.", tags = "Device Group Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:roles") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/groups/roles/view", + description = "View roles") } + ) } ) @ApiResponses(value = { @@ -612,10 +550,12 @@ public interface GroupManagementService { value = "View list of devices in the device group.", notes = "Returns list of devices in the device group.", tags = "Device Group Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:devices") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/groups/devices/view", + description = "View devices") } + ) } ) @ApiResponses(value = { @@ -672,10 +612,12 @@ public interface GroupManagementService { value = "View list of device count in the device group.", notes = "Returns device count in the device group.", tags = "Device Group Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:devices-count") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/groups/devices/view", + description = "View devices") } + ) } ) @ApiResponses(value = { @@ -724,10 +666,12 @@ public interface GroupManagementService { value = "Add devices to group.", notes = "Add existing devices to the device group.", tags = "Device Group Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:devices-add") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/groups/devices/add", + description = "Add devices") } + ) } ) @ApiResponses(value = { @@ -780,10 +724,12 @@ public interface GroupManagementService { value = "Remove devices from group.", notes = "Remove existing devices from the device group.", tags = "Device Group Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:devices-remove") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/groups/devices/remove", + description = "Remove devices") } + ) } ) @ApiResponses(value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java index a3d0d556f3..0a2998251c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java @@ -24,17 +24,16 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; +import io.swagger.annotations.AuthorizationScope; +import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; -import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.notification.mgt.Notification; import org.wso2.carbon.device.mgt.jaxrs.NotificationList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; -import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.validation.constraints.Max; import javax.validation.constraints.Size; @@ -61,22 +60,6 @@ import javax.ws.rs.core.Response; @Tag(name = "device_management", description = "") } ) -@Scopes( - scopes = { - @Scope( - name = "Getting All Device Notification Details", - description = "Getting All Device Notification Details", - key = "cdmf:notifications:view", - permissions = {"/device-mgt/notifications/view"} - ), - @Scope( - name = "Updating the Device Notification Status", - description = "Updating the Device Notification Status", - key = "cdmf:notifications:mark-checked", - permissions = {"/device-mgt/notifications/mark-checked"} - ) - } -) @Api(value = "Device Notification Management", description = "Device notification related operations can be found here.") @Path("/notifications") @Produces(MediaType.APPLICATION_JSON) @@ -90,10 +73,12 @@ public interface NotificationManagementService { value = "Getting All Device Notification Details", notes = "Get the details of all the notifications that were pushed to the devices registered with WSO2 EMM using this REST API.", tags = "Device Notification Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:notifications:view") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/notifications/view", + description = "View notifications") } + ) } ) @ApiResponses( @@ -179,10 +164,12 @@ public interface NotificationManagementService { notes = "When a user has read the the device notification the device notification status must " + "change from NEW to CHECKED. This API is used to update device notification status.", tags = "Device Notification Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:notifications:mark-checked") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/notifications/view", + description = "View notifications") } + ) } ) @ApiResponses( diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java index 2994994ac0..6a77938b0f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java @@ -24,17 +24,16 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; +import io.swagger.annotations.AuthorizationScope; +import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; -import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.PolicyWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.PriorityUpdatedPolicyWrapper; -import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import org.wso2.carbon.policy.mgt.common.Policy; import javax.validation.Valid; @@ -63,64 +62,6 @@ import java.util.List; @Tag(name = "device_management", description = "") } ) -@Scopes( - scopes = { - @Scope( - name = "Adding a Policy", - description = "Adding a Policy", - key = "cdmf:policies:manage", - permissions = {"/device-mgt/policies/manage"} - ), - @Scope( - name = "Getting Details of Policies", - description = "Getting Details of Policies", - key = "cdmf:policies:get-details", - permissions = {"/device-mgt/policies/get-details"} - ), - @Scope( - name = "Getting Details of a Policy", - description = "Getting Details of a Policy", - key = "cdmf:policies:get-policy-details", - permissions = {"/device-mgt/policies/get-policy-details"} - ), - @Scope( - name = "Updating a Policy", - description = "Updating a Policy", - key = "cdmf:policies:update", - permissions = {"/device-mgt/policies/update"} - ), - @Scope( - name = "Removing Multiple Policies", - description = "Removing Multiple Policies", - key = "cdmf:policies:remove", - permissions = {"/device-mgt/policies/remove"} - ), - @Scope( - name = "Activating Policies", - description = "Activating Policies", - key = "cdmf:policies:activate", - permissions = {"/device-mgt/policies/activate"} - ), - @Scope( - name = "Deactivating Policies", - description = "Deactivating Policies", - key = "cdmf:policies:deactivate", - permissions = {"/device-mgt/policies/deactivate"} - ), - @Scope( - name = "Applying Changes on Policies", - description = "Applying Changes on Policies", - key = "cdmf:policies:changes", - permissions = {"/device-mgt/policies/changes"} - ), - @Scope( - name = "Updating the Policy Priorities", - description = "Updating the Policy Priorities", - key = "cdmf:policies:priorities", - permissions = {"/device-mgt/policies/priorities"} - ) - } -) @Api(value = "Device Policy Management", description = "This API includes the functionality around device policy management") @Path("/policies") @Produces(MediaType.APPLICATION_JSON) @@ -136,10 +77,12 @@ public interface PolicyManagementService { notes = "Add a policy using this REST API command. When adding a policy you will have the option of saving the policy or saving and publishing the policy." + "Using this REST API you are able to save a created Policy and this policy will be in the inactive state.", tags = "Device Policy Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:manage") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", + description = "Manage policies") } + ) } ) @ApiResponses( @@ -204,10 +147,12 @@ public interface PolicyManagementService { notes = "Retrieve the details of all the policies in WSO2 EMM.", response = Policy.class, tags = "Device Policy Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:get-details") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/policies/view", + description = "View policies") } + ) } ) @ApiResponses( @@ -279,10 +224,12 @@ public interface PolicyManagementService { notes = "Retrieve the details of a policy that is in WSO2 EMM.", response = Policy.class, tags = "Device Policy Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:get-policy-details") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/policies/view", + description = "View policies") } + ) } ) @ApiResponses( @@ -347,10 +294,12 @@ public interface PolicyManagementService { value = "Updating a Policy", notes = "Make changes to an existing policy by updating the policy using this resource.", tags = "Device Policy Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:update") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", + description = "Manage policies") } + ) } ) @ApiResponses( @@ -415,10 +364,12 @@ public interface PolicyManagementService { value = "Removing Multiple Policies", notes = "Delete one or more than one policy using this API.", tags = "Device Policy Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:remove") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", + description = "Manage policies") } + ) } ) @ApiResponses( @@ -461,10 +412,12 @@ public interface PolicyManagementService { value = "Activating Policies", notes = "Publish a policy using this API to bring a policy that is in the inactive state to the active state.", tags = "Device Policy Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:activate") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", + description = "Manage policies") } + ) } ) @ApiResponses( @@ -502,10 +455,12 @@ public interface PolicyManagementService { value = "Deactivating Policies", notes = "Unpublish a policy using this API to bring a policy that is in the active state to the inactive state.", tags = "Device Policy Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:deactivate") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", + description = "Manage policies") } + ) } ) @ApiResponses( @@ -548,10 +503,12 @@ public interface PolicyManagementService { " devices will not receive these changes immediately. Once all the required changes are made" + " you need to apply the changes to push the policy changes to the existing devices.", tags = "Device Policy Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:changes") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", + description = "Manage policies") } + ) } ) @ApiResponses( @@ -576,11 +533,13 @@ public interface PolicyManagementService { value = "Updating the Policy Priorities", notes = "Make changes to the existing policy priority order by updating the priority order using this API.", tags = "Device Policy Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:priorities") - }) - } + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", + description = "Manage policies") } + ) + } ) @ApiResponses( value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java index b308ddc970..cc894b9c0b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java @@ -24,17 +24,16 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; +import io.swagger.annotations.AuthorizationScope; +import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; -import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.RoleInfo; import org.wso2.carbon.device.mgt.jaxrs.beans.RoleList; -import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import org.wso2.carbon.user.mgt.common.UIPermissionNode; import javax.ws.rs.*; @@ -57,58 +56,6 @@ import java.util.List; @Tag(name = "device_management", description = "") } ) -@Scopes( - scopes = { - @Scope( - name = "Getting the List of Roles", - description = "Getting the List of Roles", - key = "cdmf:roles:view", - permissions = {"/device-mgt/roles/view"} - ), - @Scope( - name = "Getting Permission Details of a Role", - description = "Getting Permission Details of a Role", - key = "cdmf:roles:permissions", - permissions = {"/device-mgt/roles/permissions"} - ), - @Scope( - name = "Getting the List of Roles", - description = "Getting the List of Roles", - key = "cdmf:roles:details", - permissions = {"/device-mgt/roles/details"} - ), - @Scope( - name = "Adding a Role", - description = "Adding a Role", - key = "cdmf:roles:add", - permissions = {"/device-mgt/roles/add"} - ), - @Scope( - name = "Adding a combined Role", - description = "Adding a combined Role", - key = "cdmf:roles:create-combined-role", - permissions = {"/device-mgt/roles/create-combined-role"} - ), - @Scope( - name = "Updating Role Details", - description = "Updating Role Details", - key = "cdmf:roles:update", - permissions = {"/device-mgt/roles/update"} - ), - @Scope( - name = "Deleting a Role", - description = "Deleting a Role", - key = "cdmf:roles:delete", - permissions = {"/device-mgt/roles/delete"} - ), - @Scope( - name = "Adding Users to a Role", - description = "Adding Users to a Role", - key = "cdmf:roles:add-users", - permissions = {"/device-mgt/roles/add-users"} - ) - } -) @Path("/roles") @Api(value = "Role Management", description = "Role management related operations can be found here.") @Produces(MediaType.APPLICATION_JSON) @@ -123,10 +70,11 @@ public interface RoleManagementService { notes = "WSO2 EMM supports role-based access control (RBAC) and role management. Using this API you can the list of roles that are in WSO2 EMM.\n" + "Note: Internal roles, roles created for service-providers, and application related roles will not be given in the output.", tags = "Role Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:view") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/roles/view", description = "View Roles") } + ) } ) @ApiResponses( @@ -203,10 +151,11 @@ public interface RoleManagementService { response = UIPermissionNode.class, responseContainer = "List", tags = "Role Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:permissions") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/roles/view", description = "View Roles") } + ) } ) @ApiResponses( @@ -278,10 +227,12 @@ public interface RoleManagementService { notes = "Get the permissions associated with a role and role specific details using this REST API.", response = RoleInfo.class, tags = "Role Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:details") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/roles/view", + description = "View Roles") } + ) } ) @ApiResponses( @@ -352,10 +303,12 @@ public interface RoleManagementService { value = "Adding a Role", notes = "WSO2 EMM supports role-based access control (RBAC) and role management. Add a new role to WSO2 EMM using this REST API.", tags = "Role Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:add") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/roles/manage", + description = "Manage Roles") } + ) } ) @ApiResponses(value = { @@ -412,10 +365,12 @@ public interface RoleManagementService { value = "Adding a combined Role", notes = "WSO2 EMM supports role-based access control (RBAC) and role management. Add a new combined role to WSO2 EMM using this REST API.", tags = "Role Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:create-combined-role") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/roles/manage", + description = "Manage Roles") } + ) } ) @ApiResponses(value = { @@ -475,10 +430,12 @@ public interface RoleManagementService { notes = "There will be situations where you need to update the role details, such as the permissions" + " or the role name. Update the role details using this REST API.", tags = "Role Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:update") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/roles/manage", + description = "Manage Roles") } + ) } ) @ApiResponses(value = { @@ -541,10 +498,12 @@ public interface RoleManagementService { notes = "Roles become obsolete over time due to various reasons. In a situation where your Organization identifies that a specific role is no longer required, you " + "can delete a role using this REST API.", tags = "Role Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:delete") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/roles/manage", + description = "Manage Roles") } + ) } ) @ApiResponses(value = { @@ -591,10 +550,12 @@ public interface RoleManagementService { "be cumbersome. Therefore, you can define all the new employees that belong to the engineering " + "role using this API.", tags = "Role Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:add-users") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/roles/manage", + description = "Manage Roles") } + ) } ) @ApiResponses( diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java index e7154089c6..b211a3a101 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java @@ -24,14 +24,14 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; +import io.swagger.annotations.AuthorizationScope; +import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; -import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.jaxrs.beans.*; -import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; @@ -53,76 +53,6 @@ import java.util.List; @Tag(name = "device_management", description = "") } ) -@Scopes( - scopes = { - @org.wso2.carbon.apimgt.annotations.api.Scope( - name = "Adding a User", - description = "Adding a User", - key = "cdmf:users:add", - permissions = {"/device-mgt/users/add"} - ), - @org.wso2.carbon.apimgt.annotations.api.Scope( - name = "Getting Details of a User", - description = "Getting Details of a User", - key = "cdmf:users:details", - permissions = {"/device-mgt/users/details"} - ), - @org.wso2.carbon.apimgt.annotations.api.Scope( - name = "Updating Details of a User", - description = "Updating Details of a User", - key = "cdmf:users:update", - permissions = {"/device-mgt/policies/update"} - ), - @org.wso2.carbon.apimgt.annotations.api.Scope( - name = "Deleting a User", - description = "Deleting a User", - key = "cdmf:users:delete", - permissions = {"/device-mgt/policies/delete"} - ), - @org.wso2.carbon.apimgt.annotations.api.Scope( - name = "Getting the Role Details of a User", - description = "Getting the Role Details of a User", - key = "cdmf:users:roles", - permissions = {"/device-mgt/policies/roles"} - ), - @org.wso2.carbon.apimgt.annotations.api.Scope( - name = "Getting Details of Users", - description = "Getting Details of Users", - key = "cdmf:users:user-details", - permissions = {"/device-mgt/policies/user-details"} - ), - @org.wso2.carbon.apimgt.annotations.api.Scope( - name = "Getting the User Count", - description = "Getting the User Count", - key = "cdmf:users:count", - permissions = {"/device-mgt/policies/count"} - ), - @org.wso2.carbon.apimgt.annotations.api.Scope( - name = "Getting the User existence status", - description = "Getting the User existence status", - key = "cdmf:users:is-exist", - permissions = {"/device-mgt/policies/is-exist"} - ), - @org.wso2.carbon.apimgt.annotations.api.Scope( - name = "Searching for a User Name", - description = "Searching for a User Name", - key = "cdmf:users:search", - permissions = {"/device-mgt/policies/search"} - ), - @org.wso2.carbon.apimgt.annotations.api.Scope( - name = "Changing the User Password", - description = "Adding a User", - key = "cdmf:users:credentials", - permissions = {"/device-mgt/policies/credentials"} - ), - @org.wso2.carbon.apimgt.annotations.api.Scope( - name = "Sending Enrollment Invitations to Users", - description = "Sending Enrollment Invitations to Users", - key = "cdmf:users:send-invitation", - permissions = {"/device-mgt/policies/send-invitation"} - ) - } -) @Path("/users") @Api(value = "User Management", description = "User management related operations can be found here.") @Produces(MediaType.APPLICATION_JSON) @@ -137,10 +67,12 @@ public interface UserManagementService { value = "Adding a User", notes = "WSO2 EMM supports user management. Add a new user to the WSO2 EMM user management system via this REST API", tags = "User Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:add") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/users/manage", + description = "Manage Users") } + ) } ) @ApiResponses( @@ -197,10 +129,12 @@ public interface UserManagementService { notes = "Get the details of a user registered with WSO2 EMM using the REST API.", response = BasicUserInfo.class, tags = "User Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:details") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", + description = "View Users") } + ) } ) @ApiResponses(value = { @@ -268,10 +202,12 @@ public interface UserManagementService { notes = "There will be situations where you will want to update the user details. In such " + "situation you can update the user details using this REST API.", tags = "User Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:update") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/users/manage", + description = "Manage Users") } + ) } ) @ApiResponses(value = { @@ -333,10 +269,12 @@ public interface UserManagementService { value = "Deleting a User", notes = "When an employee leaves the organization, you can remove the user details from WSO2 EMM using this REST API.", tags = "User Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:delete") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/users/manage", + description = "Manage Users") } + ) } ) @ApiResponses(value = { @@ -376,10 +314,12 @@ public interface UserManagementService { value = "Getting the Role Details of a User", notes = "A user can be assigned to one or more role in EMM. Using this REST API you can get the role/roles a user is assigned to.", tags = "User Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:roles") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", + description = "View Users") } + ) } ) @ApiResponses(value = { @@ -438,10 +378,12 @@ public interface UserManagementService { notes = "You are able to manage users in WSO2 EMM by adding, updating and removing users. If you wish to get the list of users registered with WSO2 EMM, you can do so " + "using this REST API", tags = "User Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:user-details") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", + description = "View Users") } + ) } ) @ApiResponses(value = { @@ -509,10 +451,11 @@ public interface UserManagementService { value = "Getting the User Count", notes = "Get the number of users in WSO2 EMM via this REST API.", tags = "User Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:count") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", description = "View Users") } + ) } ) @ApiResponses(value = { @@ -544,10 +487,12 @@ public interface UserManagementService { value = "Getting the User existence status", notes = "Check if the user exists in the user store.", tags = "User Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:is-exist") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", + description = "View Users") } + ) } ) @ApiResponses(value = { @@ -587,10 +532,11 @@ public interface UserManagementService { + "You will be given a list of users having the user name in the exact order of the " + "characters you provided.", tags = "User Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:search") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", description = "View Users") } + ) } ) @ApiResponses(value = { @@ -664,10 +610,11 @@ public interface UserManagementService { value = "Changing the User Password", notes = "A user is able to change the password to secure their WSO2 EMM profile via this REST API.", tags = "User Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:credentials") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/login", description = "Reset user password") } + ) } ) @ApiResponses(value = { @@ -709,10 +656,11 @@ public interface UserManagementService { notes = "Send the users a mail inviting them to download the EMM mobile application on their devices using the REST API given below.\n" + "Before running the REST API command to send the enrollment invitations to users make sure to configure WSO2 EMM as explained in step 4, under the WSO2 EMM general server configurations documentation.", tags = "User Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:send-invitation") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/users/manage", description = "Manage Users") } + ) } ) @ApiResponses(value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java index 450b3a3778..8f49261202 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java @@ -18,18 +18,9 @@ */ package org.wso2.carbon.device.mgt.jaxrs.service.api.admin; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.*; +import org.wso2.carbon.apimgt.annotations.api.*; import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.jaxrs.beans.ApplicationWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; @@ -64,16 +55,10 @@ import javax.ws.rs.core.Response; @Scopes( scopes = { @Scope( - name = "Installing an Application (Internal API)", - description = "Installing an Application (Internal API)", - key = "cdmf:applications:install", - permissions = {"/device-mgt/applications/install"} - ), - @Scope( - name = "Uninstalling an Application (Internal API)", - description = "Uninstalling an Application (Internal API)", - key = "cdmf:applications:uninstall", - permissions = {"/device-mgt/applications/uninstall"} + name = "Manage application", + description = "", + key = "cdmf:manage-application", + permissions = {"/device-mgt/applications/manage"} ) } ) @@ -93,7 +78,7 @@ public interface ApplicationManagementAdminService { tags = "Application Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:applications:install") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:manage-application") }) } ) @@ -137,7 +122,7 @@ public interface ApplicationManagementAdminService { tags = "Application Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:applications:uninstall") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:manage-application") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java index 72ba18d506..a2e80bcbf9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java @@ -24,6 +24,8 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; +import io.swagger.annotations.AuthorizationScope; +import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; @@ -64,10 +66,10 @@ import javax.ws.rs.core.Response; @Scopes( scopes = { @Scope( - name = "Getting Details of a Device", - description = "Getting Details of a Device", - key = "cdmf:admin:devices:view", - permissions = {"/device-mgt/devices/admin/devices/view"} + name = "Manage device", + description = "", + key = "cdmf:manage-own-device", + permissions = {"/device-mgt/devices/owning-device/view"} ) } ) @@ -84,7 +86,7 @@ public interface DeviceManagementAdminService { tags = "Device Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:admin:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:manage-own-device") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java index 06d0842985..b5716e9db3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java @@ -25,6 +25,8 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; +import io.swagger.annotations.AuthorizationScope; +import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; @@ -67,14 +69,8 @@ import javax.ws.rs.core.Response; @Scope( name = "View groups", description = "", - key = "cdmf:admin-groups:view", + key = "cdmf:view-groups", permissions = {"/device-mgt/admin/groups/view"} - ), - @Scope( - name = "Count groups", - description = "", - key = "cdmf:admin-groups:count", - permissions = {"/device-mgt/admin/groups/count"} ) } ) @@ -89,7 +85,7 @@ public interface GroupManagementAdminService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:admin-groups:view") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:view-groups") }) } ) @@ -150,10 +146,12 @@ public interface GroupManagementAdminService { value = "Get the count of groups belongs to current user.", notes = "Returns count of all permitted groups enrolled with the system.", tags = "Device Group Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:admin-groups:count") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/admin/groups/view", description + = "View Groups") } + ) } ) @ApiResponses(value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java index fbb3603e56..99914a94ab 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java @@ -24,15 +24,14 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; +import io.swagger.annotations.AuthorizationScope; +import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.PasswordResetWrapper; -import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.validation.constraints.Size; import javax.ws.rs.*; @@ -54,16 +53,6 @@ import javax.ws.rs.core.Response; @Tag(name = "device_management", description = "") } ) -@Scopes( - scopes = { - @Scope( - name = "View Users", - description = "View Users", - key = "cdmf:admin-users:view", - permissions = {"/device-mgt/admin/users/view"} - ) - } -) @Path("/admin/users") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @@ -82,10 +71,12 @@ public interface UserManagementAdminService { notes = "The EMM administrator is able to change the password of the users in " + "the system and block them from logging into their EMM profile using this REST API.", tags = "User Management Administrative Service", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:admin-users:view") - }) + authorizations = { + @Authorization( + value="permission", + scopes = { @AuthorizationScope(scope = "/device-mgt/users/manage", description + = "View Users") } + ) } ) @ApiResponses(value = { From 0bd7b90e9aa9a6a363acea28ed6724c804b79201 Mon Sep 17 00:00:00 2001 From: GPrathap Date: Mon, 19 Dec 2016 18:23:06 +0530 Subject: [PATCH 21/47] added scope annotation --- .../CertificateManagementAdminService.java | 48 +++-- .../api/ActivityInfoProviderService.java | 22 +- .../api/ConfigurationManagementService.java | 10 +- .../service/api/DeviceManagementService.java | 166 ++++++++------ .../api/DeviceTypeManagementService.java | 42 ++-- .../service/api/GroupManagementService.java | 202 +++++++++++------- .../api/NotificationManagementService.java | 41 ++-- .../service/api/PolicyManagementService.java | 155 +++++++++----- .../service/api/RoleManagementService.java | 135 +++++++----- .../service/api/UserManagementService.java | 183 ++++++++++------ .../ApplicationManagementAdminService.java | 31 ++- .../admin/DeviceManagementAdminService.java | 12 +- .../admin/GroupManagementAdminService.java | 22 +- .../api/admin/UserManagementAdminService.java | 25 ++- 14 files changed, 705 insertions(+), 389 deletions(-) diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java index 3f849cba9c..df92a10eb3 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java @@ -1,6 +1,16 @@ package org.wso2.carbon.certificate.mgt.cert.jaxrs.api; -import io.swagger.annotations.*; +import io.swagger.annotations.SwaggerDefinition; +import io.swagger.annotations.Info; +import io.swagger.annotations.ExtensionProperty; +import io.swagger.annotations.Extension; +import io.swagger.annotations.Tag; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ResponseHeader; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.CertificateList; @@ -31,16 +41,28 @@ import javax.ws.rs.core.Response; @Path("/admin/certificates") @Scopes(scopes = { @Scope( - name = "Manage certificates", - description = "", - key = "cdmf:manage-certificate", - permissions = {"/device-mgt/certificates/manage"} + name = "Adding a new SSL certificate", + description = "Adding a new SSL certificate", + key = "cdmf:admin:certificates:add", + permissions = {"/device-mgt/admin/certificates/add"} ), @Scope( - name = "View certificate", - description = "", - key = "cdmf:view-certificate", - permissions = {"/device-mgt/certificates/view"} + name = "Getting Details of an SSL Certificate", + description = "Getting Details of an SSL Certificate", + key = "cdmf:admin:certificates:details", + permissions = {"/device-mgt/admin/certificates/details"} + ), + @Scope( + name = "Getting Details of Certificates", + description = "Getting Details of Certificates", + key = "cdmf:admin:certificates:view", + permissions = {"/device-mgt/admin/certificates/view"} + ), + @Scope( + name = "Deleting an SSL Certificate", + description = "Deleting an SSL Certificate", + key = "cdmf:admin:certificates:delete", + permissions = {"/device-mgt/admin/certificates/delete"} ) } ) @@ -67,7 +89,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:manage-certificate") + @ExtensionProperty(name = SCOPE, value = "cdmf:admin:certificates:add") }) } ) @@ -136,7 +158,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:view-certificate") + @ExtensionProperty(name = SCOPE, value = "cdmf:admin:certificates:details") }) } ) @@ -207,7 +229,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:view-certificate") + @ExtensionProperty(name = SCOPE, value = "cdmf:admin:certificates:view") }) } ) @@ -286,7 +308,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:manage-certificate") + @ExtensionProperty(name = SCOPE, value = "cdmf:admin:certificates:delete") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java index 9c3e2c4f5b..3a040fa216 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java @@ -18,7 +18,17 @@ */ package org.wso2.carbon.device.mgt.jaxrs.service.api; -import io.swagger.annotations.*; +import io.swagger.annotations.SwaggerDefinition; +import io.swagger.annotations.Info; +import io.swagger.annotations.ExtensionProperty; +import io.swagger.annotations.Extension; +import io.swagger.annotations.Tag; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import io.swagger.annotations.ResponseHeader; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; @@ -55,9 +65,9 @@ import javax.ws.rs.core.Response; @Scopes( scopes = { @Scope( - name = "Get activities", - description = "Get activities", - key = "cdmf:get-activity", + name = "Getting Details of an Activity", + description = "Getting Details of an Activity", + key = "cdmf:activities:details", permissions = {"/device-mgt/devices/owning-device/view"} ) } @@ -77,7 +87,7 @@ public interface ActivityInfoProviderService { tags = "Activity Info Provider", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:get-activity") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:activities:details") }) } ) @@ -150,7 +160,7 @@ public interface ActivityInfoProviderService { tags = "Activity Info Provider", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:get-activity") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:activities:details") }) } ) 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 504bd75f1d..87fa47c5d3 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 @@ -24,8 +24,6 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; @@ -68,13 +66,13 @@ import javax.ws.rs.core.Response; @Scope( name = "View configurations", description = "", - key = "cdmf:view-configuration", + key = "cdmf:configuration:view", permissions = {"/device-mgt/platform-configurations/view"} ), @Scope( name = "Manage configurations", description = "", - key = "cdmf:manage-configuration", + key = "cdmf:configuration:manage", permissions = {"/device-mgt/platform-configurations/manage"} ) } @@ -92,7 +90,7 @@ public interface ConfigurationManagementService { tags = "Configuration Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:view-configuration") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:configuration:view") }) } ) @@ -151,7 +149,7 @@ public interface ConfigurationManagementService { tags = "Configuration Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:manage-configuration") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:configuration:manage") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java index 650ae34f7b..ed9290df4c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java @@ -24,13 +24,13 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Feature; import org.wso2.carbon.device.mgt.common.app.mgt.Application; @@ -38,6 +38,7 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.search.SearchContext; import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import org.wso2.carbon.policy.mgt.common.Policy; import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData; @@ -64,6 +65,64 @@ import javax.ws.rs.core.Response; @Tag(name = "device_management", description = "") } ) +@Scopes( + scopes = { + @Scope( + name = "Getting Details of Registered Devices", + description = "Getting Details of Registered Devices", + key = "cdmf:devices:view", + permissions = {"/device-mgt/devices/owning-device/view"} + ), + @Scope( + name = "Getting Details of a Device", + description = "Getting Details of a Device", + key = "cdmf:devices:details", + permissions = {"/device-mgt/devices/owning-device/details"} + ), + @Scope( + name = "Delete the device specified by device id", + description = "Delete the device specified by device id", + key = "cdmf:devices:delete", + permissions = {"/device-mgt/devices/owning-device/delete"} + ), + @Scope( + name = "Getting Feature Details of a Device", + description = "Getting Feature Details of a Device", + key = "cdmf:devices:features", + permissions = {"/device-mgt/devices/owning-device/features"} + ), + @Scope( + name = "Advanced Search for Devices", + description = "Advanced Search for Devices", + key = "cdmf:devices:search", + permissions = {"/device-mgt/devices/owning-device/view"} + ), + @Scope( + name = "Getting Installed Application Details of a Device", + description = "Getting Installed Application Details of a Device", + key = "cdmf:devices:applications", + permissions = {"/device-mgt/devices/owning-device/applications"} + ), + @Scope( + name = "Getting Device Operation Details", + description = "Getting Device Operation Details", + key = "cdmf:devices:operations", + permissions = {"/device-mgt/devices/owning-device/operations"} + ), + @Scope( + name = "Get the details of the policy that is enforced on a device.", + description = "Get the details of the policy that is enforced on a device.", + key = "cdmf:devices:effective-policy", + permissions = {"/device-mgt/devices/owning-device/effective-policy"} + ), + @Scope( + name = "Getting Policy Compliance Details of a Device", + description = "Getting Policy Compliance Details of a Device", + key = "cdmf:devices:compliance-data", + permissions = {"/device-mgt/devices/owning-device/compliance-data"} + ) + } +) @Path("/devices") @Api(value = "Device Management", description = "This API carries all device management related operations " + "such as get all the available devices, etc.") @@ -78,13 +137,11 @@ public interface DeviceManagementService { value = "Getting Details of Registered Devices", notes = "Provides details of all the devices enrolled with WSO2 EMM.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view" - , description = "View Devices") } - ) - } + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:view") + }) + } ) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK. \n Successfully fetched the list of devices.", @@ -205,12 +262,10 @@ public interface DeviceManagementService { value = "Getting Details of a Device", notes = "Get the details of a device by specifying the device type and device identifier.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:details") + }) } ) @ApiResponses( @@ -282,15 +337,13 @@ public interface DeviceManagementService { @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = "DELETE", - value = "Delete the device speccified by device id", + value = "Delete the device specified by device id", notes = "Returns the status of the deleted device operation.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:delete") + }) } ) @ApiResponses( @@ -359,13 +412,11 @@ public interface DeviceManagementService { "Using this REST API you can get the features that can be carried out on a preferred device type," + " such as iOS, Android or Windows.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Devices") } - ) - } + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:features") + }) + } ) @ApiResponses( value = { @@ -450,12 +501,10 @@ public interface DeviceManagementService { value = "Advanced Search for Devices", notes = "Search for devices by filtering the search result through the specified search terms.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:search") + }) } ) @ApiResponses( @@ -529,13 +578,12 @@ public interface DeviceManagementService { value = "Getting Installed Application Details of a Device", notes = "Get the list of applications subscribed to by a device.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Devices") } - ) - } + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:applications") + }) + + } ) @ApiResponses( value = { @@ -633,13 +681,11 @@ public interface DeviceManagementService { value = "Getting Device Operation Details", notes = "Get the details of operations carried out on a selected device.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Devices") } - ) - } + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:operations") + }) + } ) @ApiResponses( value = { @@ -746,13 +792,11 @@ public interface DeviceManagementService { "WSO2 EMM filters the policies based on the device platform (device type)," + "the device ownership type, the user role or name and finally, the policy that matches these filters will be enforced on the device.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Devices") } - ) - } + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:effective-policy") + }) + } ) @ApiResponses( value = { @@ -837,12 +881,10 @@ public interface DeviceManagementService { notes = "A policy is enforced on the devices that register with WSO2 EMM. " + "The server checks if the settings in the device comply with the policy that is enforced on the device using this REST API.", tags = "Device Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:compliance-data") + }) } ) @ApiResponses( diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java index 94b06ea751..963edc84f7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java @@ -24,15 +24,16 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceTypeList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.validation.constraints.Size; import javax.ws.rs.*; @@ -54,6 +55,22 @@ import javax.ws.rs.core.Response; @Tag(name = "device_management", description = "") } ) +@Scopes( + scopes = { + @Scope( + name = "Getting the Supported Device Platforms", + description = "Getting the Supported Device Platforms", + key = "cdmf:device-types:types", + permissions = {"/device-mgt/device-types/types"} + ), + @Scope( + name = "Get Feature Details of a Device Type", + description = "Get Feature Details of a Device Type", + key = "cdmf:device-types:features", + permissions = {"/device-mgt/device-types/features"} + ) + } +) @Path("/device-types") @Api(value = "Device Type Management", description = "This API corresponds to all tasks related to device " + "type management") @@ -68,12 +85,10 @@ public interface DeviceTypeManagementService { value = "Getting the Supported Device Platforms", notes = "Get the list of device platforms supported by WSO2 EMM.", tags = "Device Type Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Device Types") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:device-types:types") + }) } ) @ApiResponses( @@ -123,6 +138,7 @@ public interface DeviceTypeManagementService { String ifModifiedSince); @GET + @Path("/{type}/features") @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = "GET", @@ -131,12 +147,10 @@ public interface DeviceTypeManagementService { "Using this REST API you can get the features that can be carried out on a preferred device type," + " such as iOS, Android or Windows.", tags = "Device Type Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/devices/owning-device/view", - description = "View Device Types") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:device-types:features") + }) } ) @ApiResponses( diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java index 9d1b255e96..ab274b5a94 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java @@ -24,8 +24,6 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.AuthorizationScope; import io.swagger.annotations.Extension; import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Info; @@ -33,6 +31,8 @@ import io.swagger.annotations.ResponseHeader; import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.Tag; import org.apache.axis2.transport.http.HTTPConstants; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup; import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceGroupList; @@ -40,6 +40,7 @@ import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList; import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceToGroupsAssignment; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.RoleList; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.validation.Valid; import javax.ws.rs.Consumes; @@ -75,6 +76,82 @@ import java.util.List; "details.") } ) +@Scopes( + scopes = { + @Scope( + name = "Get the list of groups belongs to current user.", + description = "Get the list of groups belongs to current user.", + key = "cdmf:groups:groups", + permissions = {"/device-mgt/groups/groups"} + ), + @Scope( + name = "Get the count of groups belongs to current user.", + description = "Get the count of groups belongs to current user.", + key = "cdmf:groups:count", + permissions = {"/device-mgt/groups/count"} + ), + @Scope( + name = "Add new device group to the system.", + description = "Add new device group to the system.", + key = "cdmf:groups:add", + permissions = {"/device-mgt/groups/add"} + ), + @Scope( + name = "View group specified", + description = "View group specified", + key = "cdmf:groups:groups-view", + permissions = {"/device-mgt/groups/groups-view"} + ), + @Scope( + name = "Update a group", + description = "Update a group", + key = "cdmf:groups:update", + permissions = {"/device-mgt/groups/update"} + ), + @Scope( + name = "Delete a group", + description = "Delete a group", + key = "cdmf:groups:remove", + permissions = {"/device-mgt/groups/remove"} + ), + @Scope( + name = "Manage group sharing with a user", + description = "Manage group sharing with a user", + key = "cdmf:groups:share", + permissions = {"/device-mgt/groups/share"} + ), + @Scope( + name = "View list of roles of a device group", + description = "View list of roles of a device group", + key = "cdmf:groups:roles", + permissions = {"/device-mgt/groups/roles"} + ), + @Scope( + name = "View list of devices in the device group", + description = "View list of devices in the device group", + key = "cdmf:groups:devices", + permissions = {"/device-mgt/groups/devices"} + ), + @Scope( + name = "View list of device count in the device group", + description = "View list of device count in the device group", + key = "cdmf:groups:devices-count", + permissions = {"/device-mgt/groups/devices/devices-count"} + ), + @Scope( + name = "Add devices to group", + description = "Add devices to group", + key = "cdmf:groups:devices-add", + permissions = {"/device-mgt/groups/devices/devices-add"} + ), + @Scope( + name = "Remove devices from group", + description = "Remove devices from group", + key = "cdmf:groups:devices-remove", + permissions = {"/device-mgt/groups/devices/devices-remove"} + ) + } +) @Path("/groups") @Api(value = "Device Group Management", description = "This API carries all device group management related " + "operations such as get all the available groups, etc.") @@ -89,12 +166,10 @@ public interface GroupManagementService { value = "Get the list of groups belongs to current user.", notes = "Returns all permitted groups enrolled with the system.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/view", - description = "View Groups") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:groups") + }) } ) @ApiResponses(value = { @@ -154,13 +229,12 @@ public interface GroupManagementService { value = "Get the count of groups belongs to current user.", notes = "Returns count of all permitted groups enrolled with the system.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/view", - description = "View Groups") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:count") + }) } + ) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK. \n Successfully fetched the device group count.", @@ -203,12 +277,10 @@ public interface GroupManagementService { value = "Add new device group to the system.", notes = "Add device group with current user as the owner.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/add", - description = "Add Group") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:add") + }) } ) @ApiResponses( @@ -271,12 +343,10 @@ public interface GroupManagementService { value = "View group specified.", notes = "Returns details of group enrolled with the system.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/view", - description = "View Groups") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:groups-view") + }) } ) @ApiResponses(value = { @@ -326,12 +396,10 @@ public interface GroupManagementService { notes = "If you wish to make changes to an existing group, that can be done by updating the group using " + "this resource.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/update", - description = "Update Group") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:update") + }) } ) @ApiResponses(value = { @@ -385,12 +453,10 @@ public interface GroupManagementService { notes = "If you wish to remove an existing group, that can be done by updating the group using " + "this resource.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/remove", - description = "Remove Group") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:remove") + }) } ) @ApiResponses(value = { @@ -439,12 +505,10 @@ public interface GroupManagementService { notes = "If you wish to share /un share an existing group with a user under defined sharing roles, " + "that can be done using this resource.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/share", - description = "Share Group") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:share") + }) } ) @ApiResponses(value = { @@ -497,12 +561,10 @@ public interface GroupManagementService { value = "View list of roles of a device group.", notes = "Returns details of roles which particular group has been shared with.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/roles/view", - description = "View roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:roles") + }) } ) @ApiResponses(value = { @@ -551,12 +613,10 @@ public interface GroupManagementService { value = "View list of devices in the device group.", notes = "Returns list of devices in the device group.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/devices/view", - description = "View devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:devices") + }) } ) @ApiResponses(value = { @@ -613,12 +673,10 @@ public interface GroupManagementService { value = "View list of device count in the device group.", notes = "Returns device count in the device group.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/devices/view", - description = "View devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:devices-count") + }) } ) @ApiResponses(value = { @@ -667,12 +725,10 @@ public interface GroupManagementService { value = "Add devices to group.", notes = "Add existing devices to the device group.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/devices/add", - description = "Add devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:devices-add") + }) } ) @ApiResponses(value = { @@ -725,12 +781,10 @@ public interface GroupManagementService { value = "Remove devices from group.", notes = "Remove existing devices from the device group.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/groups/devices/remove", - description = "Remove devices") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:devices-remove") + }) } ) @ApiResponses(value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java index 0a2998251c..a3d0d556f3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java @@ -24,16 +24,17 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.notification.mgt.Notification; import org.wso2.carbon.device.mgt.jaxrs.NotificationList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.validation.constraints.Max; import javax.validation.constraints.Size; @@ -60,6 +61,22 @@ import javax.ws.rs.core.Response; @Tag(name = "device_management", description = "") } ) +@Scopes( + scopes = { + @Scope( + name = "Getting All Device Notification Details", + description = "Getting All Device Notification Details", + key = "cdmf:notifications:view", + permissions = {"/device-mgt/notifications/view"} + ), + @Scope( + name = "Updating the Device Notification Status", + description = "Updating the Device Notification Status", + key = "cdmf:notifications:mark-checked", + permissions = {"/device-mgt/notifications/mark-checked"} + ) + } +) @Api(value = "Device Notification Management", description = "Device notification related operations can be found here.") @Path("/notifications") @Produces(MediaType.APPLICATION_JSON) @@ -73,12 +90,10 @@ public interface NotificationManagementService { value = "Getting All Device Notification Details", notes = "Get the details of all the notifications that were pushed to the devices registered with WSO2 EMM using this REST API.", tags = "Device Notification Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/notifications/view", - description = "View notifications") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:notifications:view") + }) } ) @ApiResponses( @@ -164,12 +179,10 @@ public interface NotificationManagementService { notes = "When a user has read the the device notification the device notification status must " + "change from NEW to CHECKED. This API is used to update device notification status.", tags = "Device Notification Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/notifications/view", - description = "View notifications") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:notifications:mark-checked") + }) } ) @ApiResponses( diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java index 7f28227964..968d0ea0ea 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java @@ -24,16 +24,17 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.PolicyWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.PriorityUpdatedPolicyWrapper; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import org.wso2.carbon.policy.mgt.common.Policy; import javax.validation.Valid; @@ -62,6 +63,64 @@ import java.util.List; @Tag(name = "device_management", description = "") } ) +@Scopes( + scopes = { + @Scope( + name = "Adding a Policy", + description = "Adding a Policy", + key = "cdmf:policies:manage", + permissions = {"/device-mgt/policies/manage"} + ), + @Scope( + name = "Getting Details of Policies", + description = "Getting Details of Policies", + key = "cdmf:policies:get-details", + permissions = {"/device-mgt/policies/get-details"} + ), + @Scope( + name = "Getting Details of a Policy", + description = "Getting Details of a Policy", + key = "cdmf:policies:get-policy-details", + permissions = {"/device-mgt/policies/get-policy-details"} + ), + @Scope( + name = "Updating a Policy", + description = "Updating a Policy", + key = "cdmf:policies:update", + permissions = {"/device-mgt/policies/update"} + ), + @Scope( + name = "Removing Multiple Policies", + description = "Removing Multiple Policies", + key = "cdmf:policies:remove", + permissions = {"/device-mgt/policies/remove"} + ), + @Scope( + name = "Activating Policies", + description = "Activating Policies", + key = "cdmf:policies:activate", + permissions = {"/device-mgt/policies/activate"} + ), + @Scope( + name = "Deactivating Policies", + description = "Deactivating Policies", + key = "cdmf:policies:deactivate", + permissions = {"/device-mgt/policies/deactivate"} + ), + @Scope( + name = "Applying Changes on Policies", + description = "Applying Changes on Policies", + key = "cdmf:policies:changes", + permissions = {"/device-mgt/policies/changes"} + ), + @Scope( + name = "Updating the Policy Priorities", + description = "Updating the Policy Priorities", + key = "cdmf:policies:priorities", + permissions = {"/device-mgt/policies/priorities"} + ) + } +) @Api(value = "Device Policy Management", description = "This API includes the functionality around device policy management") @Path("/policies") @Produces(MediaType.APPLICATION_JSON) @@ -77,12 +136,10 @@ public interface PolicyManagementService { notes = "Add a policy using this REST API command. When adding a policy you will have the option of saving the policy or saving and publishing the policy." + "Using this REST API you are able to save a created Policy and this policy will be in the inactive state.", tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", - description = "Manage policies") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:manage") + }) } ) @ApiResponses( @@ -147,12 +204,10 @@ public interface PolicyManagementService { notes = "Retrieve the details of all the policies in WSO2 EMM.", response = Policy.class, tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/view", - description = "View policies") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:get-details") + }) } ) @ApiResponses( @@ -224,12 +279,10 @@ public interface PolicyManagementService { notes = "Retrieve the details of a policy that is in WSO2 EMM.", response = Policy.class, tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/view", - description = "View policies") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:get-policy-details") + }) } ) @ApiResponses( @@ -294,12 +347,10 @@ public interface PolicyManagementService { value = "Updating a Policy", notes = "Make changes to an existing policy by updating the policy using this resource.", tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", - description = "Manage policies") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:update") + }) } ) @ApiResponses( @@ -364,12 +415,10 @@ public interface PolicyManagementService { value = "Removing Multiple Policies", notes = "Delete one or more than one policy using this API.", tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", - description = "Manage policies") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:remove") + }) } ) @ApiResponses( @@ -412,12 +461,10 @@ public interface PolicyManagementService { value = "Activating Policies", notes = "Publish a policy using this API to bring a policy that is in the inactive state to the active state.", tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", - description = "Manage policies") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:activate") + }) } ) @ApiResponses( @@ -455,12 +502,10 @@ public interface PolicyManagementService { value = "Deactivating Policies", notes = "Unpublish a policy using this API to bring a policy that is in the active state to the inactive state.", tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", - description = "Manage policies") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:deactivate") + }) } ) @ApiResponses( @@ -503,12 +548,10 @@ public interface PolicyManagementService { " devices will not receive these changes immediately. Once all the required changes are made" + " you need to apply the changes to push the policy changes to the existing devices.", tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", - description = "Manage policies") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:changes") + }) } ) @ApiResponses( @@ -533,13 +576,11 @@ public interface PolicyManagementService { value = "Updating the Policy Priorities", notes = "Make changes to the existing policy priority order by updating the priority order using this API.", tags = "Device Policy Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/policies/manage", - description = "Manage policies") } - ) - } + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:priorities") + }) + } ) @ApiResponses( value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java index cc894b9c0b..b308ddc970 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java @@ -24,16 +24,17 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ResponseHeader; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.RoleInfo; import org.wso2.carbon.device.mgt.jaxrs.beans.RoleList; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import org.wso2.carbon.user.mgt.common.UIPermissionNode; import javax.ws.rs.*; @@ -56,6 +57,58 @@ import java.util.List; @Tag(name = "device_management", description = "") } ) +@Scopes( + scopes = { + @Scope( + name = "Getting the List of Roles", + description = "Getting the List of Roles", + key = "cdmf:roles:view", + permissions = {"/device-mgt/roles/view"} + ), + @Scope( + name = "Getting Permission Details of a Role", + description = "Getting Permission Details of a Role", + key = "cdmf:roles:permissions", + permissions = {"/device-mgt/roles/permissions"} + ), + @Scope( + name = "Getting the List of Roles", + description = "Getting the List of Roles", + key = "cdmf:roles:details", + permissions = {"/device-mgt/roles/details"} + ), + @Scope( + name = "Adding a Role", + description = "Adding a Role", + key = "cdmf:roles:add", + permissions = {"/device-mgt/roles/add"} + ), + @Scope( + name = "Adding a combined Role", + description = "Adding a combined Role", + key = "cdmf:roles:create-combined-role", + permissions = {"/device-mgt/roles/create-combined-role"} + ), + @Scope( + name = "Updating Role Details", + description = "Updating Role Details", + key = "cdmf:roles:update", + permissions = {"/device-mgt/roles/update"} + ), + @Scope( + name = "Deleting a Role", + description = "Deleting a Role", + key = "cdmf:roles:delete", + permissions = {"/device-mgt/roles/delete"} + ), + @Scope( + name = "Adding Users to a Role", + description = "Adding Users to a Role", + key = "cdmf:roles:add-users", + permissions = {"/device-mgt/roles/add-users"} + ) + } +) @Path("/roles") @Api(value = "Role Management", description = "Role management related operations can be found here.") @Produces(MediaType.APPLICATION_JSON) @@ -70,11 +123,10 @@ public interface RoleManagementService { notes = "WSO2 EMM supports role-based access control (RBAC) and role management. Using this API you can the list of roles that are in WSO2 EMM.\n" + "Note: Internal roles, roles created for service-providers, and application related roles will not be given in the output.", tags = "Role Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/roles/view", description = "View Roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:view") + }) } ) @ApiResponses( @@ -151,11 +203,10 @@ public interface RoleManagementService { response = UIPermissionNode.class, responseContainer = "List", tags = "Role Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/roles/view", description = "View Roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:permissions") + }) } ) @ApiResponses( @@ -227,12 +278,10 @@ public interface RoleManagementService { notes = "Get the permissions associated with a role and role specific details using this REST API.", response = RoleInfo.class, tags = "Role Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/roles/view", - description = "View Roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:details") + }) } ) @ApiResponses( @@ -303,12 +352,10 @@ public interface RoleManagementService { value = "Adding a Role", notes = "WSO2 EMM supports role-based access control (RBAC) and role management. Add a new role to WSO2 EMM using this REST API.", tags = "Role Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/roles/manage", - description = "Manage Roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:add") + }) } ) @ApiResponses(value = { @@ -365,12 +412,10 @@ public interface RoleManagementService { value = "Adding a combined Role", notes = "WSO2 EMM supports role-based access control (RBAC) and role management. Add a new combined role to WSO2 EMM using this REST API.", tags = "Role Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/roles/manage", - description = "Manage Roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:create-combined-role") + }) } ) @ApiResponses(value = { @@ -430,12 +475,10 @@ public interface RoleManagementService { notes = "There will be situations where you need to update the role details, such as the permissions" + " or the role name. Update the role details using this REST API.", tags = "Role Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/roles/manage", - description = "Manage Roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:update") + }) } ) @ApiResponses(value = { @@ -498,12 +541,10 @@ public interface RoleManagementService { notes = "Roles become obsolete over time due to various reasons. In a situation where your Organization identifies that a specific role is no longer required, you " + "can delete a role using this REST API.", tags = "Role Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/roles/manage", - description = "Manage Roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:delete") + }) } ) @ApiResponses(value = { @@ -550,12 +591,10 @@ public interface RoleManagementService { "be cumbersome. Therefore, you can define all the new employees that belong to the engineering " + "role using this API.", tags = "Role Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/roles/manage", - description = "Manage Roles") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:add-users") + }) } ) @ApiResponses( diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java index 41353a0f4c..f2ad567c6c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java @@ -18,7 +18,14 @@ */ package org.wso2.carbon.device.mgt.jaxrs.service.api; +import io.swagger.annotations.SwaggerDefinition; +import io.swagger.annotations.Info; +import io.swagger.annotations.ExtensionProperty; +import io.swagger.annotations.Extension; +import io.swagger.annotations.Tag; import io.swagger.annotations.Api; +import io.swagger.annotations.AuthorizationScope; +import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; @@ -70,6 +77,76 @@ import java.util.List; @Tag(name = "device_management", description = "") } ) +@Scopes( + scopes = { + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Adding a User", + description = "Adding a User", + key = "cdmf:users:add", + permissions = {"/device-mgt/users/add"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Getting Details of a User", + description = "Getting Details of a User", + key = "cdmf:users:details", + permissions = {"/device-mgt/users/details"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Updating Details of a User", + description = "Updating Details of a User", + key = "cdmf:users:update", + permissions = {"/device-mgt/policies/update"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Deleting a User", + description = "Deleting a User", + key = "cdmf:users:delete", + permissions = {"/device-mgt/policies/delete"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Getting the Role Details of a User", + description = "Getting the Role Details of a User", + key = "cdmf:users:roles", + permissions = {"/device-mgt/policies/roles"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Getting Details of Users", + description = "Getting Details of Users", + key = "cdmf:users:user-details", + permissions = {"/device-mgt/policies/user-details"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Getting the User Count", + description = "Getting the User Count", + key = "cdmf:users:count", + permissions = {"/device-mgt/policies/count"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Getting the User existence status", + description = "Getting the User existence status", + key = "cdmf:users:is-exist", + permissions = {"/device-mgt/policies/is-exist"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Searching for a User Name", + description = "Searching for a User Name", + key = "cdmf:users:search", + permissions = {"/device-mgt/policies/search"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Changing the User Password", + description = "Adding a User", + key = "cdmf:users:credentials", + permissions = {"/device-mgt/policies/credentials"} + ), + @org.wso2.carbon.apimgt.annotations.api.Scope( + name = "Sending Enrollment Invitations to Users", + description = "Sending Enrollment Invitations to Users", + key = "cdmf:users:send-invitation", + permissions = {"/device-mgt/policies/send-invitation"} + ) + } +) @Path("/users") @Api(value = "User Management", description = "User management related operations can be found here.") @Produces(MediaType.APPLICATION_JSON) @@ -84,12 +161,10 @@ public interface UserManagementService { value = "Adding a User", notes = "WSO2 IoTS supports user management. Add a new user to the WSO2 IoTS user management system via this REST API", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/manage", - description = "Manage Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:add") + }) } ) @ApiResponses( @@ -146,12 +221,10 @@ public interface UserManagementService { notes = "Get the details of a user registered with WSO2 IoTS using the REST API.", response = BasicUserInfo.class, tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", - description = "View Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:details") + }) } ) @ApiResponses(value = { @@ -219,12 +292,10 @@ public interface UserManagementService { notes = "There will be situations where you will want to update the user details. In such " + "situation you can update the user details using this REST API.", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/manage", - description = "Manage Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:update") + }) } ) @ApiResponses(value = { @@ -286,12 +357,10 @@ public interface UserManagementService { value = "Deleting a User", notes = "When an employee leaves the organization, you can remove the user details from WSO2 IoTS using this REST API.", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/manage", - description = "Manage Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:delete") + }) } ) @ApiResponses(value = { @@ -331,12 +400,10 @@ public interface UserManagementService { value = "Getting the Role Details of a User", notes = "A user can be assigned to one or more role in IoTS. Using this REST API you can get the role/roles a user is assigned to.", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", - description = "View Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:roles") + }) } ) @ApiResponses(value = { @@ -395,12 +462,10 @@ public interface UserManagementService { notes = "You are able to manage users in WSO2 IoTS by adding, updating and removing users. If you wish to get the list of users registered with WSO2 IoTS, you can do so " + "using this REST API", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", - description = "View Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:user-details") + }) } ) @ApiResponses(value = { @@ -468,11 +533,10 @@ public interface UserManagementService { value = "Getting the User Count", notes = "Get the number of users in WSO2 IoTS via this REST API.", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", description = "View Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:count") + }) } ) @ApiResponses(value = { @@ -504,12 +568,10 @@ public interface UserManagementService { value = "Getting the User existence status", notes = "Check if the user exists in the user store.", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", - description = "View Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:is-exist") + }) } ) @ApiResponses(value = { @@ -549,11 +611,10 @@ public interface UserManagementService { + "You will be given a list of users having the user name in the exact order of the " + "characters you provided.", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/view", description = "View Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:search") + }) } ) @ApiResponses(value = { @@ -627,11 +688,10 @@ public interface UserManagementService { value = "Changing the User Password", notes = "A user is able to change the password to secure their WSO2 IoTS profile via this REST API.", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/login", description = "Reset user password") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:credentials") + }) } ) @ApiResponses(value = { @@ -673,11 +733,10 @@ public interface UserManagementService { notes = "Send the users a mail inviting them to enroll their devices using the REST API given below.\n" + "Before running the REST API command to send the enrollment invitations to users make sure to configure WSO2 IoTS as explained in step 4, under the WSO2 IoTS general server configurations documentation.", tags = "User Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/manage", description = "Manage Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:send-invitation") + }) } ) @ApiResponses(value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java index 8f49261202..450b3a3778 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java @@ -18,9 +18,18 @@ */ package org.wso2.carbon.device.mgt.jaxrs.service.api.admin; -import io.swagger.annotations.*; -import org.wso2.carbon.apimgt.annotations.api.*; +import io.swagger.annotations.SwaggerDefinition; +import io.swagger.annotations.Info; +import io.swagger.annotations.ExtensionProperty; +import io.swagger.annotations.Extension; +import io.swagger.annotations.Tag; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.jaxrs.beans.ApplicationWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; @@ -55,10 +64,16 @@ import javax.ws.rs.core.Response; @Scopes( scopes = { @Scope( - name = "Manage application", - description = "", - key = "cdmf:manage-application", - permissions = {"/device-mgt/applications/manage"} + name = "Installing an Application (Internal API)", + description = "Installing an Application (Internal API)", + key = "cdmf:applications:install", + permissions = {"/device-mgt/applications/install"} + ), + @Scope( + name = "Uninstalling an Application (Internal API)", + description = "Uninstalling an Application (Internal API)", + key = "cdmf:applications:uninstall", + permissions = {"/device-mgt/applications/uninstall"} ) } ) @@ -78,7 +93,7 @@ public interface ApplicationManagementAdminService { tags = "Application Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:manage-application") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:applications:install") }) } ) @@ -122,7 +137,7 @@ public interface ApplicationManagementAdminService { tags = "Application Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:manage-application") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:applications:uninstall") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java index a2e80bcbf9..72ba18d506 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java @@ -24,8 +24,6 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; @@ -66,10 +64,10 @@ import javax.ws.rs.core.Response; @Scopes( scopes = { @Scope( - name = "Manage device", - description = "", - key = "cdmf:manage-own-device", - permissions = {"/device-mgt/devices/owning-device/view"} + name = "Getting Details of a Device", + description = "Getting Details of a Device", + key = "cdmf:admin:devices:view", + permissions = {"/device-mgt/devices/admin/devices/view"} ) } ) @@ -86,7 +84,7 @@ public interface DeviceManagementAdminService { tags = "Device Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:manage-own-device") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:admin:devices:view") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java index b5716e9db3..06d0842985 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java @@ -25,8 +25,6 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; @@ -69,8 +67,14 @@ import javax.ws.rs.core.Response; @Scope( name = "View groups", description = "", - key = "cdmf:view-groups", + key = "cdmf:admin-groups:view", permissions = {"/device-mgt/admin/groups/view"} + ), + @Scope( + name = "Count groups", + description = "", + key = "cdmf:admin-groups:count", + permissions = {"/device-mgt/admin/groups/count"} ) } ) @@ -85,7 +89,7 @@ public interface GroupManagementAdminService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:view-groups") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:admin-groups:view") }) } ) @@ -146,12 +150,10 @@ public interface GroupManagementAdminService { value = "Get the count of groups belongs to current user.", notes = "Returns count of all permitted groups enrolled with the system.", tags = "Device Group Management", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/admin/groups/view", description - = "View Groups") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:admin-groups:count") + }) } ) @ApiResponses(value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java index 99914a94ab..fbb3603e56 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java @@ -24,14 +24,15 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Extension; import io.swagger.annotations.Tag; import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.PasswordResetWrapper; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.validation.constraints.Size; import javax.ws.rs.*; @@ -53,6 +54,16 @@ import javax.ws.rs.core.Response; @Tag(name = "device_management", description = "") } ) +@Scopes( + scopes = { + @Scope( + name = "View Users", + description = "View Users", + key = "cdmf:admin-users:view", + permissions = {"/device-mgt/admin/users/view"} + ) + } +) @Path("/admin/users") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @@ -71,12 +82,10 @@ public interface UserManagementAdminService { notes = "The EMM administrator is able to change the password of the users in " + "the system and block them from logging into their EMM profile using this REST API.", tags = "User Management Administrative Service", - authorizations = { - @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/users/manage", description - = "View Users") } - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:admin-users:view") + }) } ) @ApiResponses(value = { From d13dadff08efce32a86841c277b4979fb91c4a25 Mon Sep 17 00:00:00 2001 From: Milan Perera Date: Thu, 5 Jan 2017 12:35:02 +0530 Subject: [PATCH 22/47] Renamed prefix of scopes --- .../jaxrs/service/api/ActivityInfoProviderService.java | 6 +++--- .../jaxrs/service/api/ConfigurationManagementService.java | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java index 9c3e2c4f5b..bf99446804 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java @@ -57,7 +57,7 @@ import javax.ws.rs.core.Response; @Scope( name = "Get activities", description = "Get activities", - key = "cdmf:get-activity", + key = "perm:get-activity", permissions = {"/device-mgt/devices/owning-device/view"} ) } @@ -77,7 +77,7 @@ public interface ActivityInfoProviderService { tags = "Activity Info Provider", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:get-activity") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:get-activity") }) } ) @@ -150,7 +150,7 @@ public interface ActivityInfoProviderService { tags = "Activity Info Provider", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:get-activity") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:get-activity") }) } ) 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 504bd75f1d..840f4692a3 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 @@ -68,13 +68,13 @@ import javax.ws.rs.core.Response; @Scope( name = "View configurations", description = "", - key = "cdmf:view-configuration", + key = "perm:view-configuration", permissions = {"/device-mgt/platform-configurations/view"} ), @Scope( name = "Manage configurations", description = "", - key = "cdmf:manage-configuration", + key = "perm:manage-configuration", permissions = {"/device-mgt/platform-configurations/manage"} ) } @@ -92,7 +92,7 @@ public interface ConfigurationManagementService { tags = "Configuration Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:view-configuration") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:view-configuration") }) } ) @@ -151,7 +151,7 @@ public interface ConfigurationManagementService { tags = "Configuration Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:manage-configuration") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:manage-configuration") }) } ) From 5d1435c7bc2e33b70f83274d949a68f7be223f06 Mon Sep 17 00:00:00 2001 From: GPrathap Date: Thu, 5 Jan 2017 16:47:53 +0530 Subject: [PATCH 23/47] renamed permission string --- .../mgt/jaxrs/api/CertificateMgtService.java | 2 +- .../api/ActivityInfoProviderService.java | 20 +- .../mgt/jaxrs/service/api/Dashboard.java | 184 ++++++++++++------ .../service/api/DeviceManagementService.java | 14 +- .../api/DeviceTypeManagementService.java | 4 +- .../service/api/GroupManagementService.java | 48 +++-- .../api/NotificationManagementService.java | 2 +- .../service/api/PolicyManagementService.java | 16 +- .../service/api/RoleManagementService.java | 14 +- .../service/api/UserManagementService.java | 54 +++-- .../ApplicationManagementAdminService.java | 4 +- .../admin/DeviceManagementAdminService.java | 2 +- .../admin/GroupManagementAdminService.java | 2 +- .../api/admin/UserManagementAdminService.java | 2 +- 14 files changed, 218 insertions(+), 150 deletions(-) diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java index a5ad6f1204..9fb7d0ccfb 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java @@ -41,7 +41,7 @@ import javax.ws.rs.core.Response; name = "Sign CSR", description = "Sign CSR", key = "cdmf:sign-csr", - permissions = {"/certificate-mgt/sign-csr"} + permissions = {"/device-mgt/certificates/manage"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java index 3a040fa216..cb0c6dbec6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java @@ -64,12 +64,18 @@ import javax.ws.rs.core.Response; " operation details and responses from devices.") @Scopes( scopes = { - @Scope( - name = "Getting Details of an Activity", - description = "Getting Details of an Activity", - key = "cdmf:activities:details", - permissions = {"/device-mgt/devices/owning-device/view"} - ) + @Scope( + name = "Getting Details of an Activity", + description = "Getting Details of an Activity", + key = "cdmf:activities:id", + permissions = {"/device-mgt/devices/owning-device/view"} + ), + @Scope( + name = "Getting Activity Details", + description = "Getting Activity Details", + key = "cdmf:activities:details", + permissions = {"/device-mgt/devices/owning-device/view"} + ) } ) @Produces(MediaType.APPLICATION_JSON) @@ -87,7 +93,7 @@ public interface ActivityInfoProviderService { tags = "Activity Info Provider", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:activities:details") + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:activities:id") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java index b9d5058ce0..76aab15079 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java @@ -13,10 +13,13 @@ import io.swagger.annotations.Info; import io.swagger.annotations.ResponseHeader; import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.Tag; +import org.wso2.carbon.apimgt.annotations.api.Scope; +import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup; import org.wso2.carbon.device.mgt.jaxrs.beans.DashboardGadgetDataWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.DashboardPaginationGadgetDataWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -44,6 +47,70 @@ import javax.ws.rs.core.Response; @Tag(name = "device_management", description = "Device Analytics Dashboard related APIs.") } ) +@Scopes( + scopes = { + @Scope( + name = "Device Count Overview", + description = "Device Count Overview", + key = "cdmf:dashboard:count-overview", + permissions = {"/device-mgt/dashboard/view"} + ), + @Scope( + name = "Device Counts by Potential Vulnerabilities", + description = "Device Counts by Potential Vulnerabilities", + key = "cdmf:dashboard:vulnerabilities", + permissions = {"/device-mgt/dashboard/view"} + ), + @Scope( + name = "Get the number of devices that have not complied to a policy", + description = "Get the number of devices that have not complied to a policy", + key = "cdmf:dashboard:non-compliant", + permissions = {"/device-mgt/dashboard/view"} + ), + @Scope( + name = "Get the number of devices for a given device type, such as connectivity status, " + + "potential vulnerability, platform, and ownership", + description = "Get the number of devices for a given device type, such as connectivity status, " + + "potential vulnerability, platform, and ownership", + key = "cdmf:dashboard:by-groups", + permissions = {"/device-mgt/dashboard/view"} + ), + @Scope( + name = "Get the number of devices that have not complied to a given policy based on a particular", + description = "Get the number of devices that have not complied to a given policy based on a particular", + key = "cdmf:dashboard:device-counts", + permissions = {"/device-mgt/dashboard/view"} + ), + @Scope( + name = "Get the number of devices that have not complied to a given policy based on a particular" + + " device type.", + description = "Get the number of devices that have not complied to a given policy based on a " + + "particular device type.", + key = "cdmf:dashboard:filtered-count", + permissions = {"/device-mgt/dashboard/view"} + ), + @Scope( + name = "Get the number of devices that have not complied to a given policy over the total" + + " number of devices registered with WSO2 EMM.\n", + description = "Get the number of devices that have not complied to a given policy over the total" + + " number of devices registered with WSO2 EMM.\n", + key = "cdmf:dashboard:non-compliant-count", + permissions = {"/device-mgt/dashboard/view"} + ), + @Scope( + name = "Get device details of devices based on a particular device type.", + description = "Get device details of devices based on a particular device type.", + key = "cdmf:dashboard:details", + permissions = {"/device-mgt/dashboard/view"} + ), + @Scope( + name = "Get device details of non-compliant devices which do not comply to a given policy.", + description = "Get device details of non-compliant devices which do not comply to a given policy.", + key = "cdmf:dashboard:feature-non-compliant", + permissions = {"/device-mgt/dashboard/view"} + ) + } +) @Path("/dashboard") @Api(value = "Device Analytics Dashboard", description = "Device Analytics Dashboard related information APIs are described here.") @@ -70,13 +137,12 @@ public interface Dashboard { notes = "Get the details of active, inactive, removed and total number of registered devices in" + " WSO2 IoT.", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:count-overview") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -127,13 +193,12 @@ public interface Dashboard { httpMethod = "GET", value = "Get the number of unmonitored and non-compliant devices in WSO2 IoT.", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:vulnerabilities") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -185,13 +250,12 @@ public interface Dashboard { value = "Get the number of devices that have not complied to a policy that was enforced on a " + "device.", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:non-compliant") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -256,13 +320,12 @@ public interface Dashboard { value = "Get the number of devices for a given device type, such as connectivity status, " + "potential vulnerability, platform, and ownership.\n", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:by-groups") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -346,13 +409,12 @@ public interface Dashboard { value = "Get the number of devices that have not complied to a given policy based on a particular" + " device type.", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:device-counts") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -426,13 +488,12 @@ public interface Dashboard { + "The device ownership type, such as BYOD or COPE.\n" + "The device platform.\n" + "The potential vulnerabilities faced by the devices.", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:filtered-count") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -519,13 +580,12 @@ public interface Dashboard { value = "Get the number of devices that have not complied to a given policy over the total" + " number of devices registered with WSO2 IoT.\n", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:non-compliant-count") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -595,13 +655,12 @@ public interface Dashboard { httpMethod = "GET", value = "Get device details of devices based on a particular device type.", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:details") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, @@ -698,13 +757,12 @@ public interface Dashboard { httpMethod = "GET", value = "Get device details of non-compliant devices which do not comply to a given policy.", tags = "Dashboard", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/dashboard/view", - description = "View Dashboard")} - ) - }) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:feature-non-compliant") + }) + } + ) @ApiResponses(value = { @ApiResponse( code = 200, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java index ed9290df4c..3ea1cd7bf6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java @@ -77,19 +77,19 @@ import javax.ws.rs.core.Response; name = "Getting Details of a Device", description = "Getting Details of a Device", key = "cdmf:devices:details", - permissions = {"/device-mgt/devices/owning-device/details"} + permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Delete the device specified by device id", description = "Delete the device specified by device id", key = "cdmf:devices:delete", - permissions = {"/device-mgt/devices/owning-device/delete"} + permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Getting Feature Details of a Device", description = "Getting Feature Details of a Device", key = "cdmf:devices:features", - permissions = {"/device-mgt/devices/owning-device/features"} + permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Advanced Search for Devices", @@ -101,25 +101,25 @@ import javax.ws.rs.core.Response; name = "Getting Installed Application Details of a Device", description = "Getting Installed Application Details of a Device", key = "cdmf:devices:applications", - permissions = {"/device-mgt/devices/owning-device/applications"} + permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Getting Device Operation Details", description = "Getting Device Operation Details", key = "cdmf:devices:operations", - permissions = {"/device-mgt/devices/owning-device/operations"} + permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Get the details of the policy that is enforced on a device.", description = "Get the details of the policy that is enforced on a device.", key = "cdmf:devices:effective-policy", - permissions = {"/device-mgt/devices/owning-device/effective-policy"} + permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Getting Policy Compliance Details of a Device", description = "Getting Policy Compliance Details of a Device", key = "cdmf:devices:compliance-data", - permissions = {"/device-mgt/devices/owning-device/compliance-data"} + permissions = {"/device-mgt/devices/owning-device/view"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java index 963edc84f7..eca9527f5f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java @@ -61,13 +61,13 @@ import javax.ws.rs.core.Response; name = "Getting the Supported Device Platforms", description = "Getting the Supported Device Platforms", key = "cdmf:device-types:types", - permissions = {"/device-mgt/device-types/types"} + permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Get Feature Details of a Device Type", description = "Get Feature Details of a Device Type", key = "cdmf:device-types:features", - permissions = {"/device-mgt/device-types/features"} + permissions = {"/device-mgt/devices/owning-device/view"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java index ab274b5a94..d22b2883e9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java @@ -82,13 +82,13 @@ import java.util.List; name = "Get the list of groups belongs to current user.", description = "Get the list of groups belongs to current user.", key = "cdmf:groups:groups", - permissions = {"/device-mgt/groups/groups"} + permissions = {"/device-mgt/groups/view"} ), @Scope( name = "Get the count of groups belongs to current user.", description = "Get the count of groups belongs to current user.", key = "cdmf:groups:count", - permissions = {"/device-mgt/groups/count"} + permissions = {"/device-mgt/groups/view"} ), @Scope( name = "Add new device group to the system.", @@ -100,7 +100,7 @@ import java.util.List; name = "View group specified", description = "View group specified", key = "cdmf:groups:groups-view", - permissions = {"/device-mgt/groups/groups-view"} + permissions = {"/device-mgt/groups/view"} ), @Scope( name = "Update a group", @@ -124,31 +124,43 @@ import java.util.List; name = "View list of roles of a device group", description = "View list of roles of a device group", key = "cdmf:groups:roles", - permissions = {"/device-mgt/groups/roles"} + permissions = {"/device-mgt/groups/roles/view"} ), @Scope( name = "View list of devices in the device group", description = "View list of devices in the device group", key = "cdmf:groups:devices", - permissions = {"/device-mgt/groups/devices"} + permissions = {"/device-mgt/groups/devices/view"} ), @Scope( name = "View list of device count in the device group", description = "View list of device count in the device group", key = "cdmf:groups:devices-count", - permissions = {"/device-mgt/groups/devices/devices-count"} + permissions = {"/device-mgt/groups/devices/view"} ), @Scope( name = "Add devices to group", description = "Add devices to group", key = "cdmf:groups:devices-add", - permissions = {"/device-mgt/groups/devices/devices-add"} + permissions = {"/device-mgt/groups/devices/add"} ), @Scope( name = "Remove devices from group", description = "Remove devices from group", key = "cdmf:groups:devices-remove", - permissions = {"/device-mgt/groups/devices/devices-remove"} + permissions = {"/device-mgt/groups/devices/remove"} + ), + @Scope( + name = "Assign devices to groups", + description = "Assign devices to groups", + key = "cdmf:groups:assign", + permissions = {"/device-mgt/groups/devices/add"} + ), + @Scope( + name = "List of groups that have the device", + description = "List of groups that have the device", + key = "cdmf:groups:device", + permissions = {"/device-mgt/groups/devices/view"} ) } ) @@ -837,12 +849,10 @@ public interface GroupManagementService { value = "Assign devices to groups", notes = "Add existing device to device groups.", tags = "Device Group Management", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/groups/devices/add", - description = "Add devices")} - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:assign") + }) } ) @ApiResponses(value = { @@ -891,12 +901,10 @@ public interface GroupManagementService { value = "List of groups that have the device", notes = "List of groups that have the device.", tags = "Device Group Management", - authorizations = { - @Authorization( - value = "permission", - scopes = {@AuthorizationScope(scope = "/device-mgt/groups/devices/view", - description = "Add devices")} - ) + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:device") + }) } ) @ApiResponses(value = { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java index a3d0d556f3..0463594290 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java @@ -73,7 +73,7 @@ import javax.ws.rs.core.Response; name = "Updating the Device Notification Status", description = "Updating the Device Notification Status", key = "cdmf:notifications:mark-checked", - permissions = {"/device-mgt/notifications/mark-checked"} + permissions = {"/device-mgt/notifications/view"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java index 968d0ea0ea..0b5ad17b49 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java @@ -75,49 +75,49 @@ import java.util.List; name = "Getting Details of Policies", description = "Getting Details of Policies", key = "cdmf:policies:get-details", - permissions = {"/device-mgt/policies/get-details"} + permissions = {"/device-mgt/policies/view"} ), @Scope( name = "Getting Details of a Policy", description = "Getting Details of a Policy", key = "cdmf:policies:get-policy-details", - permissions = {"/device-mgt/policies/get-policy-details"} + permissions = {"/device-mgt/policies/view"} ), @Scope( name = "Updating a Policy", description = "Updating a Policy", key = "cdmf:policies:update", - permissions = {"/device-mgt/policies/update"} + permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Removing Multiple Policies", description = "Removing Multiple Policies", key = "cdmf:policies:remove", - permissions = {"/device-mgt/policies/remove"} + permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Activating Policies", description = "Activating Policies", key = "cdmf:policies:activate", - permissions = {"/device-mgt/policies/activate"} + permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Deactivating Policies", description = "Deactivating Policies", key = "cdmf:policies:deactivate", - permissions = {"/device-mgt/policies/deactivate"} + permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Applying Changes on Policies", description = "Applying Changes on Policies", key = "cdmf:policies:changes", - permissions = {"/device-mgt/policies/changes"} + permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Updating the Policy Priorities", description = "Updating the Policy Priorities", key = "cdmf:policies:priorities", - permissions = {"/device-mgt/policies/priorities"} + permissions = {"/device-mgt/policies/manage"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java index b308ddc970..383c40e121 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java @@ -69,43 +69,43 @@ import java.util.List; name = "Getting Permission Details of a Role", description = "Getting Permission Details of a Role", key = "cdmf:roles:permissions", - permissions = {"/device-mgt/roles/permissions"} + permissions = {"/device-mgt/roles/view"} ), @Scope( name = "Getting the List of Roles", description = "Getting the List of Roles", key = "cdmf:roles:details", - permissions = {"/device-mgt/roles/details"} + permissions = {"/device-mgt/roles/view"} ), @Scope( name = "Adding a Role", description = "Adding a Role", key = "cdmf:roles:add", - permissions = {"/device-mgt/roles/add"} + permissions = {"/device-mgt/roles/manage"} ), @Scope( name = "Adding a combined Role", description = "Adding a combined Role", key = "cdmf:roles:create-combined-role", - permissions = {"/device-mgt/roles/create-combined-role"} + permissions = {"/device-mgt/roles/manage"} ), @Scope( name = "Updating Role Details", description = "Updating Role Details", key = "cdmf:roles:update", - permissions = {"/device-mgt/roles/update"} + permissions = {"/device-mgt/roles/manage"} ), @Scope( name = "Deleting a Role", description = "Deleting a Role", key = "cdmf:roles:delete", - permissions = {"/device-mgt/roles/delete"} + permissions = {"/device-mgt/roles/manage"} ), @Scope( name = "Adding Users to a Role", description = "Adding Users to a Role", key = "cdmf:roles:add-users", - permissions = {"/device-mgt/roles/add-users"} + permissions = {"/device-mgt/roles/manage"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java index f2ad567c6c..b97270b19f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java @@ -30,15 +30,10 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Info; import io.swagger.annotations.ResponseHeader; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import org.apache.axis2.transport.http.HTTPConstants; +import org.wso2.carbon.apimgt.annotations.api.Scopes; +import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.device.mgt.jaxrs.beans.BasicUserInfo; import org.wso2.carbon.device.mgt.jaxrs.beans.BasicUserInfoList; import org.wso2.carbon.device.mgt.jaxrs.beans.EnrollmentInvitation; @@ -46,6 +41,7 @@ import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.OldPasswordResetWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.RoleList; import org.wso2.carbon.device.mgt.jaxrs.beans.UserInfo; +import org.wso2.carbon.device.mgt.jaxrs.util.Constants; import javax.validation.Valid; import javax.ws.rs.Consumes; @@ -79,71 +75,71 @@ import java.util.List; ) @Scopes( scopes = { - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Adding a User", description = "Adding a User", key = "cdmf:users:add", - permissions = {"/device-mgt/users/add"} + permissions = {"/device-mgt/users/manage"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Getting Details of a User", description = "Getting Details of a User", key = "cdmf:users:details", - permissions = {"/device-mgt/users/details"} + permissions = {"/device-mgt/users/view"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Updating Details of a User", description = "Updating Details of a User", key = "cdmf:users:update", - permissions = {"/device-mgt/policies/update"} + permissions = {"/device-mgt/users/manage"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Deleting a User", description = "Deleting a User", key = "cdmf:users:delete", - permissions = {"/device-mgt/policies/delete"} + permissions = {"/device-mgt/users/manage"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Getting the Role Details of a User", description = "Getting the Role Details of a User", key = "cdmf:users:roles", - permissions = {"/device-mgt/policies/roles"} + permissions = {"/device-mgt/users/view"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Getting Details of Users", description = "Getting Details of Users", key = "cdmf:users:user-details", - permissions = {"/device-mgt/policies/user-details"} + permissions = {"/device-mgt/users/view"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Getting the User Count", description = "Getting the User Count", key = "cdmf:users:count", - permissions = {"/device-mgt/policies/count"} + permissions = {"/device-mgt/users/view"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Getting the User existence status", description = "Getting the User existence status", key = "cdmf:users:is-exist", - permissions = {"/device-mgt/policies/is-exist"} + permissions = {"/device-mgt/users/view"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Searching for a User Name", description = "Searching for a User Name", key = "cdmf:users:search", - permissions = {"/device-mgt/policies/search"} + permissions = {"/device-mgt/users/view"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Changing the User Password", description = "Adding a User", key = "cdmf:users:credentials", - permissions = {"/device-mgt/policies/credentials"} + permissions = {"/login"} ), - @org.wso2.carbon.apimgt.annotations.api.Scope( + @Scope( name = "Sending Enrollment Invitations to Users", description = "Sending Enrollment Invitations to Users", key = "cdmf:users:send-invitation", - permissions = {"/device-mgt/policies/send-invitation"} + permissions = {"/device-mgt/users/manage"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java index 450b3a3778..fdf51ec358 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java @@ -67,13 +67,13 @@ import javax.ws.rs.core.Response; name = "Installing an Application (Internal API)", description = "Installing an Application (Internal API)", key = "cdmf:applications:install", - permissions = {"/device-mgt/applications/install"} + permissions = {"/device-mgt/applications/manage"} ), @Scope( name = "Uninstalling an Application (Internal API)", description = "Uninstalling an Application (Internal API)", key = "cdmf:applications:uninstall", - permissions = {"/device-mgt/applications/uninstall"} + permissions = {"/device-mgt/applications/manage"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java index 72ba18d506..eb570819b4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java @@ -67,7 +67,7 @@ import javax.ws.rs.core.Response; name = "Getting Details of a Device", description = "Getting Details of a Device", key = "cdmf:admin:devices:view", - permissions = {"/device-mgt/devices/admin/devices/view"} + permissions = {"/device-mgt/devices/owning-device/view"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java index 06d0842985..0188425051 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java @@ -74,7 +74,7 @@ import javax.ws.rs.core.Response; name = "Count groups", description = "", key = "cdmf:admin-groups:count", - permissions = {"/device-mgt/admin/groups/count"} + permissions = {"/device-mgt/admin/groups/view"} ) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java index fbb3603e56..bef81df1a1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java @@ -60,7 +60,7 @@ import javax.ws.rs.core.Response; name = "View Users", description = "View Users", key = "cdmf:admin-users:view", - permissions = {"/device-mgt/admin/users/view"} + permissions = {"/device-mgt/users/manage"} ) } ) From 637c014866c738fb08394bd4121c314636551978 Mon Sep 17 00:00:00 2001 From: Milan Perera Date: Fri, 6 Jan 2017 10:15:21 +0530 Subject: [PATCH 24/47] Refactored scope strings --- .../mgt/jaxrs/api/CertificateMgtService.java | 4 +- .../CertificateManagementAdminService.java | 16 +++--- .../mgt/jaxrs/service/api/Dashboard.java | 36 ++++++------ .../service/api/DeviceManagementService.java | 36 ++++++------ .../api/DeviceTypeManagementService.java | 8 +-- .../service/api/GroupManagementService.java | 56 +++++++++---------- .../api/NotificationManagementService.java | 8 +-- .../service/api/PolicyManagementService.java | 36 ++++++------ .../service/api/RoleManagementService.java | 32 +++++------ .../service/api/UserManagementService.java | 44 +++++++-------- .../ApplicationManagementAdminService.java | 8 +-- .../admin/DeviceManagementAdminService.java | 4 +- .../admin/GroupManagementAdminService.java | 8 +-- .../api/admin/UserManagementAdminService.java | 4 +- 14 files changed, 150 insertions(+), 150 deletions(-) diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java index 9fb7d0ccfb..2357d61044 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java @@ -40,7 +40,7 @@ import javax.ws.rs.core.Response; @Scope( name = "Sign CSR", description = "Sign CSR", - key = "cdmf:sign-csr", + key = "perm:sign-csr", permissions = {"/device-mgt/certificates/manage"} ) } @@ -68,7 +68,7 @@ public interface CertificateMgtService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:sign-csr") + @ExtensionProperty(name = SCOPE, value = "perm:sign-csr") }) } ) diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java index df92a10eb3..69a10a16d8 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java @@ -43,25 +43,25 @@ import javax.ws.rs.core.Response; @Scope( name = "Adding a new SSL certificate", description = "Adding a new SSL certificate", - key = "cdmf:admin:certificates:add", + key = "perm:admin:certificates:add", permissions = {"/device-mgt/admin/certificates/add"} ), @Scope( name = "Getting Details of an SSL Certificate", description = "Getting Details of an SSL Certificate", - key = "cdmf:admin:certificates:details", + key = "perm:admin:certificates:details", permissions = {"/device-mgt/admin/certificates/details"} ), @Scope( name = "Getting Details of Certificates", description = "Getting Details of Certificates", - key = "cdmf:admin:certificates:view", + key = "perm:admin:certificates:view", permissions = {"/device-mgt/admin/certificates/view"} ), @Scope( name = "Deleting an SSL Certificate", description = "Deleting an SSL Certificate", - key = "cdmf:admin:certificates:delete", + key = "perm:admin:certificates:delete", permissions = {"/device-mgt/admin/certificates/delete"} ) } @@ -89,7 +89,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:admin:certificates:add") + @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:add") }) } ) @@ -158,7 +158,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:admin:certificates:details") + @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:details") }) } ) @@ -229,7 +229,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:admin:certificates:view") + @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:view") }) } ) @@ -308,7 +308,7 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = SCOPE, value = "cdmf:admin:certificates:delete") + @ExtensionProperty(name = SCOPE, value = "perm:admin:certificates:delete") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java index 76aab15079..3a0564bb06 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/Dashboard.java @@ -52,19 +52,19 @@ import javax.ws.rs.core.Response; @Scope( name = "Device Count Overview", description = "Device Count Overview", - key = "cdmf:dashboard:count-overview", + key = "perm:dashboard:count-overview", permissions = {"/device-mgt/dashboard/view"} ), @Scope( name = "Device Counts by Potential Vulnerabilities", description = "Device Counts by Potential Vulnerabilities", - key = "cdmf:dashboard:vulnerabilities", + key = "perm:dashboard:vulnerabilities", permissions = {"/device-mgt/dashboard/view"} ), @Scope( name = "Get the number of devices that have not complied to a policy", description = "Get the number of devices that have not complied to a policy", - key = "cdmf:dashboard:non-compliant", + key = "perm:dashboard:non-compliant", permissions = {"/device-mgt/dashboard/view"} ), @Scope( @@ -72,13 +72,13 @@ import javax.ws.rs.core.Response; + "potential vulnerability, platform, and ownership", description = "Get the number of devices for a given device type, such as connectivity status, " + "potential vulnerability, platform, and ownership", - key = "cdmf:dashboard:by-groups", + key = "perm:dashboard:by-groups", permissions = {"/device-mgt/dashboard/view"} ), @Scope( name = "Get the number of devices that have not complied to a given policy based on a particular", description = "Get the number of devices that have not complied to a given policy based on a particular", - key = "cdmf:dashboard:device-counts", + key = "perm:dashboard:device-counts", permissions = {"/device-mgt/dashboard/view"} ), @Scope( @@ -86,7 +86,7 @@ import javax.ws.rs.core.Response; + " device type.", description = "Get the number of devices that have not complied to a given policy based on a " + "particular device type.", - key = "cdmf:dashboard:filtered-count", + key = "perm:dashboard:filtered-count", permissions = {"/device-mgt/dashboard/view"} ), @Scope( @@ -94,19 +94,19 @@ import javax.ws.rs.core.Response; + " number of devices registered with WSO2 EMM.\n", description = "Get the number of devices that have not complied to a given policy over the total" + " number of devices registered with WSO2 EMM.\n", - key = "cdmf:dashboard:non-compliant-count", + key = "perm:dashboard:non-compliant-count", permissions = {"/device-mgt/dashboard/view"} ), @Scope( name = "Get device details of devices based on a particular device type.", description = "Get device details of devices based on a particular device type.", - key = "cdmf:dashboard:details", + key = "perm:dashboard:details", permissions = {"/device-mgt/dashboard/view"} ), @Scope( name = "Get device details of non-compliant devices which do not comply to a given policy.", description = "Get device details of non-compliant devices which do not comply to a given policy.", - key = "cdmf:dashboard:feature-non-compliant", + key = "perm:dashboard:feature-non-compliant", permissions = {"/device-mgt/dashboard/view"} ) } @@ -139,7 +139,7 @@ public interface Dashboard { tags = "Dashboard", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:count-overview") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:dashboard:count-overview") }) } ) @@ -195,7 +195,7 @@ public interface Dashboard { tags = "Dashboard", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:vulnerabilities") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:dashboard:vulnerabilities") }) } ) @@ -252,7 +252,7 @@ public interface Dashboard { tags = "Dashboard", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:non-compliant") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:dashboard:non-compliant") }) } ) @@ -322,7 +322,7 @@ public interface Dashboard { tags = "Dashboard", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:by-groups") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:dashboard:by-groups") }) } ) @@ -411,7 +411,7 @@ public interface Dashboard { tags = "Dashboard", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:device-counts") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:dashboard:device-counts") }) } ) @@ -490,7 +490,7 @@ public interface Dashboard { tags = "Dashboard", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:filtered-count") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:dashboard:filtered-count") }) } ) @@ -582,7 +582,7 @@ public interface Dashboard { tags = "Dashboard", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:non-compliant-count") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:dashboard:non-compliant-count") }) } ) @@ -657,7 +657,7 @@ public interface Dashboard { tags = "Dashboard", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:details") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:dashboard:details") }) } ) @@ -759,7 +759,7 @@ public interface Dashboard { tags = "Dashboard", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:dashboard:feature-non-compliant") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:dashboard:feature-non-compliant") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java index 3ea1cd7bf6..3df745d8a7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java @@ -70,55 +70,55 @@ import javax.ws.rs.core.Response; @Scope( name = "Getting Details of Registered Devices", description = "Getting Details of Registered Devices", - key = "cdmf:devices:view", + key = "perm:devices:view", permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Getting Details of a Device", description = "Getting Details of a Device", - key = "cdmf:devices:details", + key = "perm:devices:details", permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Delete the device specified by device id", description = "Delete the device specified by device id", - key = "cdmf:devices:delete", + key = "perm:devices:delete", permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Getting Feature Details of a Device", description = "Getting Feature Details of a Device", - key = "cdmf:devices:features", + key = "perm:devices:features", permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Advanced Search for Devices", description = "Advanced Search for Devices", - key = "cdmf:devices:search", + key = "perm:devices:search", permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Getting Installed Application Details of a Device", description = "Getting Installed Application Details of a Device", - key = "cdmf:devices:applications", + key = "perm:devices:applications", permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Getting Device Operation Details", description = "Getting Device Operation Details", - key = "cdmf:devices:operations", + key = "perm:devices:operations", permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Get the details of the policy that is enforced on a device.", description = "Get the details of the policy that is enforced on a device.", - key = "cdmf:devices:effective-policy", + key = "perm:devices:effective-policy", permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Getting Policy Compliance Details of a Device", description = "Getting Policy Compliance Details of a Device", - key = "cdmf:devices:compliance-data", + key = "perm:devices:compliance-data", permissions = {"/device-mgt/devices/owning-device/view"} ) } @@ -139,7 +139,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:view") }) } ) @@ -264,7 +264,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:details") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:details") }) } ) @@ -342,7 +342,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:delete") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:delete") }) } ) @@ -414,7 +414,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:features") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:features") }) } ) @@ -503,7 +503,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:search") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:search") }) } ) @@ -580,7 +580,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:applications") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:applications") }) } @@ -683,7 +683,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:operations") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:operations") }) } ) @@ -794,7 +794,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:effective-policy") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:effective-policy") }) } ) @@ -883,7 +883,7 @@ public interface DeviceManagementService { tags = "Device Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:devices:compliance-data") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:devices:compliance-data") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java index eca9527f5f..83566b6f12 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java @@ -60,13 +60,13 @@ import javax.ws.rs.core.Response; @Scope( name = "Getting the Supported Device Platforms", description = "Getting the Supported Device Platforms", - key = "cdmf:device-types:types", + key = "perm:device-types:types", permissions = {"/device-mgt/devices/owning-device/view"} ), @Scope( name = "Get Feature Details of a Device Type", description = "Get Feature Details of a Device Type", - key = "cdmf:device-types:features", + key = "perm:device-types:features", permissions = {"/device-mgt/devices/owning-device/view"} ) } @@ -87,7 +87,7 @@ public interface DeviceTypeManagementService { tags = "Device Type Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:device-types:types") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:types") }) } ) @@ -149,7 +149,7 @@ public interface DeviceTypeManagementService { tags = "Device Type Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:device-types:features") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:device-types:features") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java index d22b2883e9..51a6dae87c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java @@ -81,85 +81,85 @@ import java.util.List; @Scope( name = "Get the list of groups belongs to current user.", description = "Get the list of groups belongs to current user.", - key = "cdmf:groups:groups", + key = "perm:groups:groups", permissions = {"/device-mgt/groups/view"} ), @Scope( name = "Get the count of groups belongs to current user.", description = "Get the count of groups belongs to current user.", - key = "cdmf:groups:count", + key = "perm:groups:count", permissions = {"/device-mgt/groups/view"} ), @Scope( name = "Add new device group to the system.", description = "Add new device group to the system.", - key = "cdmf:groups:add", + key = "perm:groups:add", permissions = {"/device-mgt/groups/add"} ), @Scope( name = "View group specified", description = "View group specified", - key = "cdmf:groups:groups-view", + key = "perm:groups:groups-view", permissions = {"/device-mgt/groups/view"} ), @Scope( name = "Update a group", description = "Update a group", - key = "cdmf:groups:update", + key = "perm:groups:update", permissions = {"/device-mgt/groups/update"} ), @Scope( name = "Delete a group", description = "Delete a group", - key = "cdmf:groups:remove", + key = "perm:groups:remove", permissions = {"/device-mgt/groups/remove"} ), @Scope( name = "Manage group sharing with a user", description = "Manage group sharing with a user", - key = "cdmf:groups:share", + key = "perm:groups:share", permissions = {"/device-mgt/groups/share"} ), @Scope( name = "View list of roles of a device group", description = "View list of roles of a device group", - key = "cdmf:groups:roles", + key = "perm:groups:roles", permissions = {"/device-mgt/groups/roles/view"} ), @Scope( name = "View list of devices in the device group", description = "View list of devices in the device group", - key = "cdmf:groups:devices", + key = "perm:groups:devices", permissions = {"/device-mgt/groups/devices/view"} ), @Scope( name = "View list of device count in the device group", description = "View list of device count in the device group", - key = "cdmf:groups:devices-count", + key = "perm:groups:devices-count", permissions = {"/device-mgt/groups/devices/view"} ), @Scope( name = "Add devices to group", description = "Add devices to group", - key = "cdmf:groups:devices-add", + key = "perm:groups:devices-add", permissions = {"/device-mgt/groups/devices/add"} ), @Scope( name = "Remove devices from group", description = "Remove devices from group", - key = "cdmf:groups:devices-remove", + key = "perm:groups:devices-remove", permissions = {"/device-mgt/groups/devices/remove"} ), @Scope( name = "Assign devices to groups", description = "Assign devices to groups", - key = "cdmf:groups:assign", + key = "perm:groups:assign", permissions = {"/device-mgt/groups/devices/add"} ), @Scope( name = "List of groups that have the device", description = "List of groups that have the device", - key = "cdmf:groups:device", + key = "perm:groups:device", permissions = {"/device-mgt/groups/devices/view"} ) } @@ -180,7 +180,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:groups") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:groups") }) } ) @@ -243,7 +243,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:count") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:count") }) } @@ -291,7 +291,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:add") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:add") }) } ) @@ -357,7 +357,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:groups-view") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:groups-view") }) } ) @@ -410,7 +410,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:update") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:update") }) } ) @@ -467,7 +467,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:remove") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:remove") }) } ) @@ -519,7 +519,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:share") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:share") }) } ) @@ -575,7 +575,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:roles") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:roles") }) } ) @@ -627,7 +627,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:devices") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices") }) } ) @@ -687,7 +687,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:devices-count") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices-count") }) } ) @@ -739,7 +739,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:devices-add") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices-add") }) } ) @@ -795,7 +795,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:devices-remove") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:devices-remove") }) } ) @@ -851,7 +851,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:assign") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:assign") }) } ) @@ -903,7 +903,7 @@ public interface GroupManagementService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:groups:device") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:groups:device") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java index 0463594290..62db9aacd8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/NotificationManagementService.java @@ -66,13 +66,13 @@ import javax.ws.rs.core.Response; @Scope( name = "Getting All Device Notification Details", description = "Getting All Device Notification Details", - key = "cdmf:notifications:view", + key = "perm:notifications:view", permissions = {"/device-mgt/notifications/view"} ), @Scope( name = "Updating the Device Notification Status", description = "Updating the Device Notification Status", - key = "cdmf:notifications:mark-checked", + key = "perm:notifications:mark-checked", permissions = {"/device-mgt/notifications/view"} ) } @@ -92,7 +92,7 @@ public interface NotificationManagementService { tags = "Device Notification Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:notifications:view") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:notifications:view") }) } ) @@ -181,7 +181,7 @@ public interface NotificationManagementService { tags = "Device Notification Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:notifications:mark-checked") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:notifications:mark-checked") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java index 0b5ad17b49..91f2e07a59 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/PolicyManagementService.java @@ -68,55 +68,55 @@ import java.util.List; @Scope( name = "Adding a Policy", description = "Adding a Policy", - key = "cdmf:policies:manage", + key = "perm:policies:manage", permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Getting Details of Policies", description = "Getting Details of Policies", - key = "cdmf:policies:get-details", + key = "perm:policies:get-details", permissions = {"/device-mgt/policies/view"} ), @Scope( name = "Getting Details of a Policy", description = "Getting Details of a Policy", - key = "cdmf:policies:get-policy-details", + key = "perm:policies:get-policy-details", permissions = {"/device-mgt/policies/view"} ), @Scope( name = "Updating a Policy", description = "Updating a Policy", - key = "cdmf:policies:update", + key = "perm:policies:update", permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Removing Multiple Policies", description = "Removing Multiple Policies", - key = "cdmf:policies:remove", + key = "perm:policies:remove", permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Activating Policies", description = "Activating Policies", - key = "cdmf:policies:activate", + key = "perm:policies:activate", permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Deactivating Policies", description = "Deactivating Policies", - key = "cdmf:policies:deactivate", + key = "perm:policies:deactivate", permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Applying Changes on Policies", description = "Applying Changes on Policies", - key = "cdmf:policies:changes", + key = "perm:policies:changes", permissions = {"/device-mgt/policies/manage"} ), @Scope( name = "Updating the Policy Priorities", description = "Updating the Policy Priorities", - key = "cdmf:policies:priorities", + key = "perm:policies:priorities", permissions = {"/device-mgt/policies/manage"} ) } @@ -138,7 +138,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:manage") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:manage") }) } ) @@ -206,7 +206,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:get-details") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:get-details") }) } ) @@ -281,7 +281,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:get-policy-details") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:get-policy-details") }) } ) @@ -349,7 +349,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:update") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:update") }) } ) @@ -417,7 +417,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:remove") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:remove") }) } ) @@ -463,7 +463,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:activate") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:activate") }) } ) @@ -504,7 +504,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:deactivate") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:deactivate") }) } ) @@ -550,7 +550,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:changes") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:changes") }) } ) @@ -578,7 +578,7 @@ public interface PolicyManagementService { tags = "Device Policy Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:policies:priorities") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:policies:priorities") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java index 383c40e121..e330d7d3d3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/RoleManagementService.java @@ -62,49 +62,49 @@ import java.util.List; @Scope( name = "Getting the List of Roles", description = "Getting the List of Roles", - key = "cdmf:roles:view", + key = "perm:roles:view", permissions = {"/device-mgt/roles/view"} ), @Scope( name = "Getting Permission Details of a Role", description = "Getting Permission Details of a Role", - key = "cdmf:roles:permissions", + key = "perm:roles:permissions", permissions = {"/device-mgt/roles/view"} ), @Scope( name = "Getting the List of Roles", description = "Getting the List of Roles", - key = "cdmf:roles:details", + key = "perm:roles:details", permissions = {"/device-mgt/roles/view"} ), @Scope( name = "Adding a Role", description = "Adding a Role", - key = "cdmf:roles:add", + key = "perm:roles:add", permissions = {"/device-mgt/roles/manage"} ), @Scope( name = "Adding a combined Role", description = "Adding a combined Role", - key = "cdmf:roles:create-combined-role", + key = "perm:roles:create-combined-role", permissions = {"/device-mgt/roles/manage"} ), @Scope( name = "Updating Role Details", description = "Updating Role Details", - key = "cdmf:roles:update", + key = "perm:roles:update", permissions = {"/device-mgt/roles/manage"} ), @Scope( name = "Deleting a Role", description = "Deleting a Role", - key = "cdmf:roles:delete", + key = "perm:roles:delete", permissions = {"/device-mgt/roles/manage"} ), @Scope( name = "Adding Users to a Role", description = "Adding Users to a Role", - key = "cdmf:roles:add-users", + key = "perm:roles:add-users", permissions = {"/device-mgt/roles/manage"} ) } @@ -125,7 +125,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:view") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:view") }) } ) @@ -205,7 +205,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:permissions") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:permissions") }) } ) @@ -280,7 +280,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:details") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:details") }) } ) @@ -354,7 +354,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:add") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:add") }) } ) @@ -414,7 +414,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:create-combined-role") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:create-combined-role") }) } ) @@ -477,7 +477,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:update") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:update") }) } ) @@ -543,7 +543,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:delete") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:delete") }) } ) @@ -593,7 +593,7 @@ public interface RoleManagementService { tags = "Role Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:roles:add-users") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:roles:add-users") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java index b97270b19f..1b9acd0c65 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java @@ -78,67 +78,67 @@ import java.util.List; @Scope( name = "Adding a User", description = "Adding a User", - key = "cdmf:users:add", + key = "perm:users:add", permissions = {"/device-mgt/users/manage"} ), @Scope( name = "Getting Details of a User", description = "Getting Details of a User", - key = "cdmf:users:details", + key = "perm:users:details", permissions = {"/device-mgt/users/view"} ), @Scope( name = "Updating Details of a User", description = "Updating Details of a User", - key = "cdmf:users:update", + key = "perm:users:update", permissions = {"/device-mgt/users/manage"} ), @Scope( name = "Deleting a User", description = "Deleting a User", - key = "cdmf:users:delete", + key = "perm:users:delete", permissions = {"/device-mgt/users/manage"} ), @Scope( name = "Getting the Role Details of a User", description = "Getting the Role Details of a User", - key = "cdmf:users:roles", + key = "perm:users:roles", permissions = {"/device-mgt/users/view"} ), @Scope( name = "Getting Details of Users", description = "Getting Details of Users", - key = "cdmf:users:user-details", + key = "perm:users:user-details", permissions = {"/device-mgt/users/view"} ), @Scope( name = "Getting the User Count", description = "Getting the User Count", - key = "cdmf:users:count", + key = "perm:users:count", permissions = {"/device-mgt/users/view"} ), @Scope( name = "Getting the User existence status", description = "Getting the User existence status", - key = "cdmf:users:is-exist", + key = "perm:users:is-exist", permissions = {"/device-mgt/users/view"} ), @Scope( name = "Searching for a User Name", description = "Searching for a User Name", - key = "cdmf:users:search", + key = "perm:users:search", permissions = {"/device-mgt/users/view"} ), @Scope( name = "Changing the User Password", description = "Adding a User", - key = "cdmf:users:credentials", + key = "perm:users:credentials", permissions = {"/login"} ), @Scope( name = "Sending Enrollment Invitations to Users", description = "Sending Enrollment Invitations to Users", - key = "cdmf:users:send-invitation", + key = "perm:users:send-invitation", permissions = {"/device-mgt/users/manage"} ) } @@ -159,7 +159,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:add") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:add") }) } ) @@ -219,7 +219,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:details") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:details") }) } ) @@ -290,7 +290,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:update") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:update") }) } ) @@ -355,7 +355,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:delete") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:delete") }) } ) @@ -398,7 +398,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:roles") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:roles") }) } ) @@ -460,7 +460,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:user-details") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:user-details") }) } ) @@ -531,7 +531,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:count") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:count") }) } ) @@ -566,7 +566,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:is-exist") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:is-exist") }) } ) @@ -609,7 +609,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:search") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:search") }) } ) @@ -686,7 +686,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:credentials") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:credentials") }) } ) @@ -731,7 +731,7 @@ public interface UserManagementService { tags = "User Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:users:send-invitation") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:users:send-invitation") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java index fdf51ec358..92c42bfb3b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/ApplicationManagementAdminService.java @@ -66,13 +66,13 @@ import javax.ws.rs.core.Response; @Scope( name = "Installing an Application (Internal API)", description = "Installing an Application (Internal API)", - key = "cdmf:applications:install", + key = "perm:applications:install", permissions = {"/device-mgt/applications/manage"} ), @Scope( name = "Uninstalling an Application (Internal API)", description = "Uninstalling an Application (Internal API)", - key = "cdmf:applications:uninstall", + key = "perm:applications:uninstall", permissions = {"/device-mgt/applications/manage"} ) } @@ -93,7 +93,7 @@ public interface ApplicationManagementAdminService { tags = "Application Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:applications:install") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:applications:install") }) } ) @@ -137,7 +137,7 @@ public interface ApplicationManagementAdminService { tags = "Application Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:applications:uninstall") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:applications:uninstall") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java index eb570819b4..14a34d3520 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java @@ -66,7 +66,7 @@ import javax.ws.rs.core.Response; @Scope( name = "Getting Details of a Device", description = "Getting Details of a Device", - key = "cdmf:admin:devices:view", + key = "perm:admin:devices:view", permissions = {"/device-mgt/devices/owning-device/view"} ) } @@ -84,7 +84,7 @@ public interface DeviceManagementAdminService { tags = "Device Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:admin:devices:view") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin:devices:view") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java index 0188425051..64020ce56e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/GroupManagementAdminService.java @@ -67,13 +67,13 @@ import javax.ws.rs.core.Response; @Scope( name = "View groups", description = "", - key = "cdmf:admin-groups:view", + key = "perm:admin-groups:view", permissions = {"/device-mgt/admin/groups/view"} ), @Scope( name = "Count groups", description = "", - key = "cdmf:admin-groups:count", + key = "perm:admin-groups:count", permissions = {"/device-mgt/admin/groups/view"} ) } @@ -89,7 +89,7 @@ public interface GroupManagementAdminService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:admin-groups:view") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin-groups:view") }) } ) @@ -152,7 +152,7 @@ public interface GroupManagementAdminService { tags = "Device Group Management", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:admin-groups:count") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin-groups:count") }) } ) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java index bef81df1a1..c6c7130926 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/UserManagementAdminService.java @@ -59,7 +59,7 @@ import javax.ws.rs.core.Response; @Scope( name = "View Users", description = "View Users", - key = "cdmf:admin-users:view", + key = "perm:admin-users:view", permissions = {"/device-mgt/users/manage"} ) } @@ -84,7 +84,7 @@ public interface UserManagementAdminService { tags = "User Management Administrative Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "cdmf:admin-users:view") + @ExtensionProperty(name = Constants.SCOPE, value = "perm:admin-users:view") }) } ) From 11d2ecac10d16f81513b9fbacc2366db4317a8d3 Mon Sep 17 00:00:00 2001 From: inoshperera Date: Fri, 6 Jan 2017 11:34:48 +0530 Subject: [PATCH 25/47] removing basic auth headers from API definitions. --- .../wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java index 99b625504b..d158182247 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java @@ -75,7 +75,7 @@ public class APIPublisherUtil { api.setUrl(config.getEndpoint()); api.addAvailableTiers(provider.getTiers()); - api.setEndpointSecured(true); + api.setEndpointSecured(false); api.setStatus(APIStatus.CREATED); api.setTransports(config.getTransports()); api.setApiLevelPolicy(config.getPolicy()); From b83479b214b78b7e6a1d69ba63319287c4509b43 Mon Sep 17 00:00:00 2001 From: Ace Date: Fri, 6 Jan 2017 13:20:56 +0530 Subject: [PATCH 26/47] Fixing device listing issue --- .../devicemgt/app/pages/cdmf.page.devices/public/js/listing.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js index c0f0d2f8aa..90c1149b0d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js @@ -166,7 +166,7 @@ function loadDevices(searchType, searchParam) { serviceURL = "/api/device-mgt/v1.0/devices"; } else if (permissionsUtil.hasPermission("LIST_OWN_DEVICES")) { //Get authenticated users devices - serviceURL = "/api/device-mgt/v1.0/users/devices?username=" + currentUser; + serviceURL = "/api/device-mgt/v1.0/devices?username=" + currentUser; } else { $("#loading-content").remove(); $('#device-table').addClass('hidden'); From e6e39532b7b7af3820f15c13596bc4f15b16bf6e Mon Sep 17 00:00:00 2001 From: charitha Date: Fri, 6 Jan 2017 14:55:26 +0530 Subject: [PATCH 27/47] Fixed https://wso2.org/jira/browse/IOTS-103 and UI improvements --- .../app/pages/cdmf.page.devices/devices.hbs | 121 +++++--- .../cdmf.page.devices/public/js/listing.js | 279 +++++++++++++----- .../cdmf.page.groups/public/js/listing.js | 30 +- 3 files changed, 298 insertions(+), 132 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs index 8a32659700..e585fea5fe 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs @@ -102,7 +102,7 @@ Owner - {{group.owner}} + {{group.owner}} Shared with roles @@ -175,19 +175,42 @@ - - - - - - - - - - - - - + + + + + @@ -272,7 +295,10 @@ Add device group - + + Add devices to group + + Update assignment @@ -295,7 +321,11 @@ - -
-
+ +
+ +
+ @@ -488,3 +521,19 @@ type="text/x-handlebars-template"> {{js "js/listing.js"}} {{/zone}} + +{{#zone "topCss"}} + +{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js index c0f0d2f8aa..dca934fb7c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js @@ -22,7 +22,8 @@ * initial mode and with out select mode. */ function InitiateViewOption(url) { - if ($(".select-enable-btn").text() == "Select") { + if ($(".select-enable-btn").text() == "Select" && !$(this).hasClass("btn")) { + url = $(this).parent().data("url"); $(location).attr('href', url); } } @@ -84,18 +85,6 @@ $(document).ready(function () { return $("#content-filter-types").html(); } }); - - $(".ast-container").on("click", ".claim-btn", function (e) { - e.stopPropagation(); - var deviceId = $(this).data("deviceid"); - var serviceURL = "/temp-controller-agent/enrollment/claim?username=" + currentUser; - var deviceIdentifier = {id: deviceId, type: "TemperatureController"}; - invokerUtil.put(serviceURL, deviceIdentifier, function (message) { - console.log(message); - }, function (message) { - console.log(message.content); - }); - }); }); /* @@ -255,18 +244,16 @@ function loadDevices(searchType, searchParam) { { targets: 0, data: 'name', - class: 'remove-padding icon-only content-fill', + class: 'remove-padding icon-only content-fill viewEnabledIcon', render: function (data, type, row, meta) { - return '
'; + return '
'; } }, { targets: 1, data: 'name', - class: '', + class: 'viewEnabledIcon', render: function (name, type, row, meta) { var model = getPropertyValue(row.properties, 'DEVICE_MODEL'); var vendor = getPropertyValue(row.properties, 'VENDOR'); @@ -280,12 +267,12 @@ function loadDevices(searchType, searchParam) { { targets: 2, data: 'user', - class: 'remove-padding-top', + class: 'remove-padding-top viewEnabledIcon' }, { targets: 3, data: 'status', - class: 'remove-padding-top', + class: 'remove-padding-top viewEnabledIcon', render: function (status, type, row, meta) { var html; switch (status) { @@ -308,7 +295,7 @@ function loadDevices(searchType, searchParam) { { targets: 4, data: 'deviceType', - class: 'remove-padding-top', + class: 'remove-padding-top viewEnabledIcon', render: function (status, type, row, meta) { return getDeviceTypeLabel(row.deviceType); } @@ -316,7 +303,7 @@ function loadDevices(searchType, searchParam) { { targets: 5, data: 'ownership', - class: 'remove-padding-top', + class: 'remove-padding-top viewEnabledIcon', render: function (status, type, row, meta) { if (getDeviceTypeCategory(row.deviceType) == 'mobile') { return row.ownership; @@ -357,20 +344,29 @@ function loadDevices(searchType, searchParam) { html += '' + - '' + - '' + - ''; - html += - '' + - '' + - '' + - ''; + + 'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType + + '" data-devicename="' + row.name + '">' + + '' + + '' + + ''; + var groupOwner = $('#group_owner').text(); + if (groupId && groupOwner != "wso2.system.user") { + html += + '' + + '' + + '' + + ''; + } else { + html += + '' + + '' + + '' + + ''; + } } return html; } @@ -380,13 +376,14 @@ function loadDevices(searchType, searchParam) { var fnCreatedRow = function (row, data, dataIndex) { $(row).attr('data-type', 'selectable'); $(row).attr('data-deviceid', data.deviceIdentifier); - $(row).attr('data-devicetype', data.type); + $(row).attr('data-devicetype', data.deviceType); + $(row).attr('data-url', context + '/device/' + data.deviceType + '?id=' + data.deviceIdentifier); var model = getPropertyValue(data.properties, 'DEVICE_MODEL'); var vendor = getPropertyValue(data.properties, 'VENDOR'); var owner = data.user; var status = data.status; var ownership = data.ownership; - var deviceType = data.type; + var deviceType = data.deviceType; var category = getDeviceTypeCategory(deviceType); $.each($('td', row), function (colIndex) { switch (colIndex) { @@ -560,17 +557,13 @@ function markAlreadyAssignedGroups(deviceId, deviceType) { data = JSON.parse(data); if (xhr.status == 200) { if (data.length > 0) { + var selectedValues = []; for (var i = 0; i < data.length; i++) { - $('.groupCheckBoxes').each( - function () { - if (data[i].id == $(this).data('groupid')) { - $(this).attr('checked', true); - } - } - ); + if (data[i].owner != "wso2.system.user") { + selectedValues.push(data[i].id); + } } - } else { - return; + $("#groups").val(selectedValues).trigger("change"); } } else { displayErrors(xhr); @@ -600,7 +593,7 @@ function attachDeviceEvents() { $(modalPopupContent).html($('#group-device-modal-content').html()); $('#user-groups').html( '
'); - $("a#group-device-yes-link").hide(); + $("a#group-device-update-link").hide(); showPopup(); var serviceURL; @@ -612,39 +605,39 @@ function attachDeviceEvents() { } invokerUtil.get(serviceURL, function (data) { + $("a#group-device-add-link").hide(); var groups = JSON.parse(data); var html = ''; var hasGroups = false; for (var i = 0; i < groups.deviceGroups.length; i++) { if (groups.deviceGroups[i].owner != "wso2.system.user") { - html += '
'; + html += ''; hasGroups = true; } } if (hasGroups) { - html = '

Please select device group(s)


' + html; + html = '

Please select device group(s)


' + + '
' + + '
'; markAlreadyAssignedGroups(deviceId, deviceType); - $("a#group-device-yes-link").show(); + $("a#group-device-update-link").show(); $("a#group-add-link").hide(); } else { - $("a#group-device-yes-link").hide(); + $("a#group-device-update-link").hide(); $("a#group-add-link").show(); html += '

You don\'t have any existing device groups. Please add new device group first.

' } $('#user-groups').html(html); - $("a#group-device-yes-link").click(function () { + $("select.select2[multiple=multiple]").select2({ + tags: false + }); + $("a#group-device-update-link").click(function () { var deviceIdentifier = {"id": deviceId, "type": deviceType}; - var deviceGroupIds = []; - $('.modal .groupCheckBoxes').each( - function () { - if ($(this).is(':checked')) { - deviceGroupIds.push($(this).data('groupid')); - } - } - ); + var deviceGroupIds = $("#groups").val(); + if (!deviceGroupIds) { + deviceGroupIds = []; + } var deviceToGroupsAssignment = { deviceIdentifier: deviceIdentifier, deviceGroupIds: deviceGroupIds @@ -684,36 +677,42 @@ function attachDeviceEvents() { * on Device Management page in WSO2 MDM Console. */ $("a.remove-device-link").click(function () { + var deviceIdentifiers = []; var deviceId = $(this).data("deviceid"); var deviceType = $(this).data("devicetype"); - var serviceURL = "/api/device-mgt/v1.0/devices/type/" + deviceType + "/id/" + deviceId; + + if (deviceId && deviceType) { + deviceIdentifiers = [{"id": deviceId, "type": deviceType}]; + } else { + deviceIdentifiers = getSelectedDevices(); + } + + if (deviceIdentifiers.length == 0) { + $(modalPopupContent).html($('#no-device-selected').html()); + $("a#no-device-selected-link").click(function () { + hidePopup(); + }); + showPopup(); + return; + } $(modalPopupContent).html($('#remove-device-modal-content').html()); showPopup(); $("a#remove-device-yes-link").click(function () { if (groupId) { - var deviceIdentifiers = [{"id": deviceId, "type": deviceType}]; - serviceURL = "/api/device-mgt/v1.0/groups/id/" + groupId + "/devices/remove"; + var serviceURL = "/api/device-mgt/v1.0/groups/id/" + groupId + "/devices/remove"; invokerUtil.post(serviceURL, deviceIdentifiers, function (message) { - $(modalPopupContent).html($('#remove-device-from-group-200-content').html()); - setTimeout(function () { - hidePopup(); - location.reload(false); - }, 2000); - }, function (message) { - displayDeviceErrors(message); - }); - } else { - invokerUtil.delete(serviceURL, function (message) { $(modalPopupContent).html($('#remove-device-200-content').html()); setTimeout(function () { hidePopup(); location.reload(false); }, 2000); - }, function (message) { + }, function (jqXHR) { displayDeviceErrors(jqXHR); }); + } else { + removeDevices(deviceIdentifiers); } }); @@ -745,7 +744,7 @@ function attachDeviceEvents() { hidePopup(); location.reload(false); }, 2000); - }, function (message) { + }, function (jqXHR) { displayDeviceErrors(jqXHR); }); }); @@ -754,6 +753,106 @@ function attachDeviceEvents() { hidePopup(); }); }); + + /** + * Following click function would execute + * when a user clicks on "Add to Group" link + * on Device Management page in WSO2 devicemgt Console. + */ + $("a.add-devices-to-group-link").click(function () { + $("a#group-device-update-link").hide(); + var deviceIdentifiers = getSelectedDevices(); + if (deviceIdentifiers.length == 0) { + $(modalPopupContent).html($('#no-device-selected').html()); + $("a#no-device-selected-link").click(function () { + hidePopup(); + }); + showPopup(); + return; + } + + $(modalPopupContent).html($('#group-device-modal-content').html()); + $('#user-groups').html( + '
'); + $("a#group-device-add-link").hide(); + showPopup(); + + var serviceURL; + if ($.hasPermission("LIST_ALL_GROUPS")) { + serviceURL = "/api/device-mgt/v1.0/admin/groups?limit=100"; + } else if ($.hasPermission("LIST_GROUPS")) { + //Get authenticated users groups + serviceURL = "/api/device-mgt/v1.0/groups?limit=100"; + } + + invokerUtil.get(serviceURL, function (data) { + var groups = JSON.parse(data); + var html = ''; + var hasGroups = false; + for (var i = 0; i < groups.deviceGroups.length; i++) { + if (groups.deviceGroups[i].owner != "wso2.system.user") { + html += ''; + hasGroups = true; + } + } + if (hasGroups) { + html = '
'; + $("a#group-add-link").hide(); + $("a#group-device-add-link").show(); + } else { + html += '

You don\'t have any existing device groups. Please add new device group first.

'; + $("a#group-add-link").show(); + $("a#group-device-add-link").hide(); + } + $('#user-groups').html(html); + $("a#group-device-add-link").click(function () { + var selectedGroup = $('#assign-group-selector').val(); + serviceURL = "/api/device-mgt/v1.0/groups/id/" + selectedGroup + "/devices/add"; + invokerUtil.post(serviceURL, deviceIdentifiers, function (data) { + $(modalPopupContent).html($('#group-associate-device-200-content').html()); + setTimeout(function () { + hidePopup(); + location.reload(false); + }, 2000); + }, function (jqXHR) { + displayDeviceErrors(jqXHR); + }); + }); + }, function (jqXHR) { + if (jqXHR.status == 404) { + $(modalPopupContent).html($('#group-404-content').html()); + $("a#cancel-link").click(function () { + hidePopup(); + }); + } else { + displayDeviceErrors(jqXHR); + } + }); + + $("a#group-device-cancel-link").click(function () { + hidePopup(); + }); + }); +} + +function removeDevices(deviceIdentifiers) { + var serviceURL = "/api/device-mgt/v1.0/devices/type/" + deviceIdentifiers[0].type + "/id/" + deviceIdentifiers[0].id; + invokerUtil.delete(serviceURL, function (message) { + if (deviceIdentifiers.length > 1) { + deviceIdentifiers.slice(1, deviceIdentifiers.length); + removeDevices(deviceIdentifiers); + } else { + $(modalPopupContent).html($('#remove-device-200-content').html()); + setTimeout(function () { + hidePopup(); + location.reload(false); + }, 2000); + } + }, function (jqXHR) { + displayDeviceErrors(jqXHR); + }); } function displayDeviceErrors(jqXHR) { @@ -788,3 +887,23 @@ function getParameterByName(name) { results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } + +/* + * Function to get selected devices. + */ +function getSelectedDevices() { + var deviceList = []; + var thisTable = $(".DTTT_selected").closest('.dataTables_wrapper').find('.dataTable').dataTable(); + thisTable.api().rows().every(function () { + if ($(this.node()).hasClass('DTTT_selected')) { + deviceList.push( + { + "id": $(thisTable.api().row(this).node()).data('deviceid'), + "type": $(thisTable.api().row(this).node()).data('devicetype') + } + ); + } + }); + + return deviceList; +} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/js/listing.js index 6661e775b4..a229215b57 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/js/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/js/listing.js @@ -23,6 +23,7 @@ */ function InitiateViewOption(url) { if ($(".select-enable-btn").text() == "Select") { + url = $(this).parent().data("url"); $(location).attr('href', url); } } @@ -147,35 +148,30 @@ function loadGroups() { return JSON.stringify(json); }; - var columns = [{ - targets: 0, - data: 'id', - class: 'remove-padding icon-only content-fill', - render: function (data, type, row, meta) { - if ($.hasPermission("VIEW_GROUP_DEVICES")) { - return '
'; - } else { + var columns = [ + { + targets: 0, + data: 'id', + class: 'remove-padding icon-only content-fill viewEnabledIcon', + render: function (data, type, row, meta) { return '
'; } - } - }, + }, { targets: 1, data: 'name', - class: '' + class: 'viewEnabledIcon' }, { targets: 2, data: 'owner', - class: 'remove-padding-top', + class: 'remove-padding-top viewEnabledIcon' }, { targets: 3, data: 'description', - class: 'remove-padding-top', + class: 'remove-padding-top viewEnabledIcon' }, { targets: 4, @@ -226,7 +222,9 @@ function loadGroups() { var fnCreatedRow = function (row, data) { $(row).attr('data-type', 'selectable'); - $(row).attr('data-groupid', data.id); + if ($.hasPermission("VIEW_GROUP_DEVICES")) { + $(row).attr('data-url', 'devices?groupId=' + data.groupId + '&groupName=' + data.name); + } $.each($('td', row), function (colIndex) { switch (colIndex) { case 1: From 42a587904f9163f4d8c6bebfe21541970921a0bc Mon Sep 17 00:00:00 2001 From: Milan Perera Date: Fri, 6 Jan 2017 16:10:52 +0530 Subject: [PATCH 28/47] Fixed issues in permission-scope mapping --- .../lifecycle/util/AnnotationProcessor.java | 6 +- .../permission/AnnotationProcessor.java | 7 +- .../devicemgt/app/conf/config.json | 125 +++++++++++------- pom.xml | 2 +- 4 files changed, 89 insertions(+), 51 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java index e27c3edbe8..b820a4426f 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java @@ -66,6 +66,8 @@ public class AnnotationProcessor { private static final String SWAGGER_ANNOTATIONS_PROPERTIES_VALUE = "value"; private static final String ANNOTATIONS_SCOPES = "scopes"; + private static final String PERMISSION_PREFIX = "/permission/admin"; + private StandardContext context; private Method[] pathClazzMethods; @@ -201,8 +203,9 @@ public class AnnotationProcessor { Scope scope; String permissions[]; - StringBuilder aggregatedPermissions = new StringBuilder(); + StringBuilder aggregatedPermissions; for(int i=0; i pathClazz; @@ -391,8 +393,9 @@ public class AnnotationProcessor { Scope scope; String permissions[]; - StringBuilder aggregatedPermissions = new StringBuilder(); + StringBuilder aggregatedPermissions; for(int i=0; i[2.6.0,3.0.0) - 6.1.30-SNAPSHOT + 6.1.35 (6.0.0,7.0.0] From 7af63522f2e92b42100915e8c3731068e0a389cf Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Fri, 6 Jan 2017 16:14:24 +0530 Subject: [PATCH 29/47] Fixed quick startup guide doc url --- .../app/units/cdmf.unit.device.types.listing/listing.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.types.listing/listing.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.types.listing/listing.hbs index 5069d083d4..977bc73610 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.types.listing/listing.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.types.listing/listing.hbs @@ -43,7 +43,7 @@

No device type is available to be displayed.

- From e501724c3c6c8a7d6547e6f7303e2ed52a92b28e Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Fri, 6 Jan 2017 16:26:59 +0530 Subject: [PATCH 30/47] Replaced [EMM] with [IoT Server] --- .../app/pages/cdmf.page.certificate.create/create.hbs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.hbs index 46e213d374..230d57d161 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificate.create/create.hbs @@ -73,9 +73,9 @@ click "View Certificate List" to complete the process and go back to the certificate list.
- -
+ From ab28d596e7ded7ba6febfe7d04572909ea11fda0 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Fri, 6 Jan 2017 16:56:20 +0530 Subject: [PATCH 31/47] Fixing CDMF version in footer --- .../devicemgt/app/units/cdmf.unit.footer/footer.hbs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.footer/footer.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.footer/footer.hbs index f47c63c2de..5165fc7a5f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.footer/footer.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.footer/footer.hbs @@ -17,8 +17,8 @@ }} {{#zone "footer"}}

- - WSO2 CDMF v1.2.6 | © , + + WSO2 CDMF v2.0.6 | © , Inc. All Rights Reserved.

{{/zone}} \ No newline at end of file From 44c7383b1525abc085629345a7c0e6a50948b69b Mon Sep 17 00:00:00 2001 From: geethkokila Date: Fri, 6 Jan 2017 17:04:00 +0530 Subject: [PATCH 32/47] Adding support to send ios request the synapse gateway --- .../org.wso2.carbon.apimgt.handlers/pom.xml | 73 +++- .../AuthenticationHandler.java | 336 +++++++----------- .../beans/Certificate.java | 52 +++ .../beans/DCR.java | 61 ++++ .../beans/ValidationResponce.java | 61 ++++ .../config/IOTServerConfiguration.java | 118 ++++++ .../invoker/RESTInvoker.java | 141 ++++---- .../utils/CoreUtils.java | 178 +++++----- .../utils/Utils.java | 154 ++++++++ .../src/main/resources/api-filter-config.xml | 24 -- .../src/main/resources/ios-synapse-config.xml | 138 ------- .../src/main/resources/iot-api-config.xml | 48 +++ .../pom.xml | 5 + .../CertificateManagementAdminService.java | 151 +++++--- .../jaxrs/api/beans/ValidationResponce.java | 61 ++++ ...CertificateManagementAdminServiceImpl.java | 150 ++++++-- .../api/util/CertificateMgtAPIUtils.java | 16 + .../pom.xml | 8 +- .../pom.xml | 106 ++++++ .../src/main/resources/build.properties | 1 + .../main/resources/conf/iot-api-config.xml | 40 +++ .../src/main/resources/p2.inf | 2 + .../main/resources/conf/.cdm-config.xml.swp | Bin 16384 -> 0 bytes 23 files changed, 1292 insertions(+), 632 deletions(-) create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/Certificate.java create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/DCR.java create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/ValidationResponce.java create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/config/IOTServerConfiguration.java create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java delete mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/api-filter-config.xml delete mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/ios-synapse-config.xml create mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/iot-api-config.xml create mode 100644 components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/ValidationResponce.java create mode 100644 features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml create mode 100644 features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/src/main/resources/build.properties create mode 100644 features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/src/main/resources/conf/iot-api-config.xml create mode 100644 features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/src/main/resources/p2.inf delete mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/.cdm-config.xml.swp diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml index b8133bc6d8..e707cbc5f3 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml @@ -1,32 +1,53 @@ + + apimgt-extensions org.wso2.carbon.devicemgt - 1.2.8-SNAPSHOT + 2.0.6-SNAPSHOT + ../pom.xml - 4.0.0 + 4.0.0 org.wso2.carbon.apimgt.handlers + 2.0.6-SNAPSHOT + bundle WSO2 Carbon - API Security Handler Component + WSO2 Carbon - API Management Security Handler Module + http://wso2.org + org.wso2.carbon org.wso2.carbon.logging - ${carbon.kernel.version} org.apache.synapse synapse-core - ${org.apache.synapse.version} org.apache.ws.security.wso2 wss4j - ${org.apache.ws.security.wso2.version} org.wso2.carbon.devicemgt @@ -35,8 +56,48 @@ org.json.wso2 json - ${commons-json.version} + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + 1.4.0 + true + + + ${project.artifactId} + ${project.artifactId} + ${carbon.device.mgt.version} + WSO2 Carbon - API Security Handler Component + + org.apache.axiom.*, + javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, + javax.xml.*, + org.apache.axis2.*, + org.apache.commons.*, + org.apache.http.*, + org.apache.http.util, + org.apache.ws.*;version="${org.apache.ws.security.wso2.version}", + org.json, + org.wso2.carbon.utils, + org.wso2.carbon.context, + com.google.gson, + org.w3c.dom, + org.apache.synapse, + org.apache.synapse.core.axis2, + org.apache.synapse.rest + + + + + + + \ No newline at end of file diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java index 1c320410b6..1d4282f1a5 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java @@ -17,268 +17,176 @@ */ package org.wso2.carbon.apimgt.handlers; -import org.apache.axiom.soap.SOAP11Constants; -import org.apache.axiom.soap.SOAP12Constants; -import org.apache.axis2.AxisFault; +import com.google.gson.Gson; import org.apache.axis2.context.MessageContext; import org.apache.axis2.description.HandlerDescription; -import org.apache.axis2.description.Parameter; -import org.apache.axis2.engine.Handler; -import org.apache.axis2.namespace.Constants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.ws.security.WSConstants; -import org.apache.ws.security.WSSecurityException; -import org.apache.ws.security.util.Base64; -import org.json.JSONException; -import org.json.JSONObject; +import org.apache.synapse.core.axis2.Axis2MessageContext; +import org.apache.synapse.rest.AbstractHandler; +import org.wso2.carbon.apimgt.handlers.beans.Certificate; +import org.wso2.carbon.apimgt.handlers.beans.ValidationResponce; +import org.wso2.carbon.apimgt.handlers.config.IOTServerConfiguration; import org.wso2.carbon.apimgt.handlers.invoker.RESTInvoker; import org.wso2.carbon.apimgt.handlers.invoker.RESTResponse; import org.wso2.carbon.apimgt.handlers.utils.AuthConstants; -import org.wso2.carbon.apimgt.handlers.utils.CoreUtils; +import org.wso2.carbon.apimgt.handlers.utils.Utils; +import org.wso2.carbon.context.PrivilegedCarbonContext; -import javax.xml.namespace.QName; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; -public class AuthenticationHandler implements Handler { +public class AuthenticationHandler extends AbstractHandler { private static final Log log = LogFactory.getLog(AuthenticationHandler.class); private static HandlerDescription EMPTY_HANDLER_METADATA = new HandlerDescription("API Security Handler"); private HandlerDescription handlerDesc; - private ArrayList apiList; private RESTInvoker restInvoker; + private IOTServerConfiguration iotServerConfiguration; + /** * Setting up configurations at the constructor */ public AuthenticationHandler() { - log.info("Engaging API Security Handler"); - apiList = CoreUtils.readApiFilterList(); + log.info("Engaging API Security Handler.........."); restInvoker = new RESTInvoker(); this.handlerDesc = EMPTY_HANDLER_METADATA; + this.iotServerConfiguration = Utils.initConfig(); } - /** - * Handles incoming http/s requests - * - * @param messageContext - * @return response - * @throws AxisFault - */ - public InvocationResponse invoke(MessageContext messageContext) throws AxisFault { - if (isSecuredAPI(messageContext)) { - String ctxPath = messageContext.getTo().getAddress().trim(); - CoreUtils.debugLog(log, "Authentication handler invoked by: ", ctxPath); - Map headers = (Map) messageContext.getProperty(MessageContext.TRANSPORT_HEADERS); - try { - RESTResponse response = null; - if (headers.containsKey(AuthConstants.MDM_SIGNATURE)) { + @Override + public boolean handleRequest(org.apache.synapse.MessageContext messageContext) { + org.apache.axis2.context.MessageContext axisMC = ((Axis2MessageContext) messageContext).getAxis2MessageContext(); - String mdmSignature = headers.get(AuthConstants.MDM_SIGNATURE).toString(); - CoreUtils.debugLog(log, "Verify Cert:\n", mdmSignature); + String ctxPath = messageContext.getTo().getAddress().trim(); - String accessToken = getAccessToken(); - URI certVerifyUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils - .getHttpsPort() + CoreUtils.getIosVerifyEndpoint()); - Map certVerifyHeaders = new HashMap<>(); - certVerifyHeaders.put("Authorization", "Bearer " + accessToken); - certVerifyHeaders.put("Content-Type", "application/json"); - String certVerifyContent = "{\n" + - "\"pem\":\"" + mdmSignature + "\",\n" + - "\"tenantId\": \"-1234\",\n" + - "\"serial\":\"\"\n" + - "}"; + if (log.isDebugEnabled()) { + log.debug("Authentication handler invoked by: " + ctxPath); + } + Map headers = (Map) axisMC.getProperty(MessageContext.TRANSPORT_HEADERS); + try { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); + RESTResponse response; + if (headers.containsKey(AuthConstants.MDM_SIGNATURE)) { - response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, - null, certVerifyContent); - CoreUtils.debugLog(log, "Verify response:", response.getContent()); + String mdmSignature = headers.get(AuthConstants.MDM_SIGNATURE).toString(); + if (log.isDebugEnabled()) { + log.debug("Verify Cert:\n" + mdmSignature); + } + String accessToken = Utils.getAccessToken(iotServerConfiguration); - } else if (headers.containsKey(AuthConstants.PROXY_MUTUAL_AUTH_HEADER)) { - String subjectDN = headers.get(AuthConstants.PROXY_MUTUAL_AUTH_HEADER).toString(); - CoreUtils.debugLog(log, "Verify subject DN: ", subjectDN); - String accessToken = getAccessToken(); - URI certVerifyUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils - .getHttpsPort() + CoreUtils.getAndroidVerifyEndpoint()); - Map certVerifyHeaders = new HashMap<>(); - certVerifyHeaders.put("Authorization", "Bearer " + accessToken); - certVerifyHeaders.put("Content-Type", "application/json"); - String certVerifyContent = "{\n" + - "\"pem\":\"" + subjectDN + "\",\n" + - "\"tenantId\": \"-1234\",\n" + - "\"serial\":\"" + AuthConstants.PROXY_MUTUAL_AUTH_HEADER + "\"\n" + - "}"; + String deviceType = this.getDeviceType(messageContext.getTo().getAddress().trim()); + URI certVerifyUrl = new URI(iotServerConfiguration.getVerificationEndpoint() + deviceType); - response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, - null, certVerifyContent); - CoreUtils.debugLog(log, "Verify response:", response.getContent()); + Map certVerifyHeaders = new HashMap<>(); + certVerifyHeaders.put("Authorization", "Bearer " + accessToken); + certVerifyHeaders.put("Content-Type", "application/json"); - } else if (headers.containsKey(AuthConstants.ENCODED_PEM)) { - String encodedPem = headers.get(AuthConstants.ENCODED_PEM).toString(); - CoreUtils.debugLog(log, "Verify Cert:\n", encodedPem); + Certificate certificate = new Certificate(); + certificate.setPem(mdmSignature); + certificate.setTenantId(tenantId); + certificate.setSerial(""); - String accessToken = getAccessToken(); - URI certVerifyUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils - .getHttpsPort() + CoreUtils.getAndroidVerifyEndpoint()); - Map certVerifyHeaders = new HashMap<>(); - certVerifyHeaders.put("Authorization", "Bearer " + accessToken); - certVerifyHeaders.put("Content-Type", "application/json"); - String certVerifyContent = "{\n" + - "\"pem\":\"" + encodedPem + "\",\n" + - "\"tenantId\": \"-1234\",\n" + - "\"serial\":\"\"\n" + - "}"; + Gson gson = new Gson(); + String certVerifyContent = gson.toJson(certificate); + response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, + null, certVerifyContent); - response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, - null, certVerifyContent); - CoreUtils.debugLog(log, "Verify response:", response.getContent()); - - } else { - log.warn("Unauthorized request for api: " + ctxPath); - setFaultCodeAndThrowAxisFault(messageContext, new Exception("SSL required")); - return InvocationResponse.SUSPEND; + String str = response.getContent(); + if (str.contains("JWTToken")) { + ValidationResponce validationResponce = gson.fromJson(str, ValidationResponce.class); + // TODO: send the JWT token with user details. + // headers.put("X-JWT-Assertion", validationResponce.getJWTToken()); + } + if (log.isDebugEnabled()) { + log.debug("Verify response:" + response.getContent()); + log.debug("Response String : " + str); } - if (response != null && !response.getContent().contains("invalid")) { - return InvocationResponse.CONTINUE; + } else if (headers.containsKey(AuthConstants.PROXY_MUTUAL_AUTH_HEADER)) { + String subjectDN = headers.get(AuthConstants.PROXY_MUTUAL_AUTH_HEADER).toString(); + + if (log.isDebugEnabled()) { + log.debug("Verify subject DN: " + subjectDN); } + String accessToken = Utils.getAccessToken(iotServerConfiguration); + String deviceType = this.getDeviceType(messageContext.getTo().getAddress().trim()); + URI certVerifyUrl = new URI(iotServerConfiguration.getVerificationEndpoint() + deviceType); + Map certVerifyHeaders = new HashMap<>(); + certVerifyHeaders.put("Authorization", "Bearer " + accessToken); + certVerifyHeaders.put("Content-Type", "application/json"); + Certificate certificate = new Certificate(); + certificate.setPem(subjectDN); + certificate.setTenantId(tenantId); + certificate.setSerial(AuthConstants.PROXY_MUTUAL_AUTH_HEADER); + + Gson gson = new Gson(); + String certVerifyContent = gson.toJson(certificate); + response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, + null, certVerifyContent); + if (log.isDebugEnabled()) { + log.debug("Verify response:" + response.getContent()); + } + } else if (headers.containsKey(AuthConstants.ENCODED_PEM)) { + String encodedPem = headers.get(AuthConstants.ENCODED_PEM).toString(); + if (log.isDebugEnabled()) { + log.debug("Verify Cert:\n" + encodedPem); + } + String accessToken = Utils.getAccessToken(iotServerConfiguration); + URI certVerifyUrl = new URI(iotServerConfiguration.getVerificationEndpoint() + "android"); + Map certVerifyHeaders = new HashMap<>(); + certVerifyHeaders.put("Authorization", "Bearer " + accessToken); + certVerifyHeaders.put("Content-Type", "application/json"); + + Certificate certificate = new Certificate(); + certificate.setPem(encodedPem); + certificate.setTenantId(tenantId); + certificate.setSerial(""); + Gson gson = new Gson(); + String certVerifyContent = gson.toJson(certificate); + response = restInvoker.invokePOST(certVerifyUrl, certVerifyHeaders, null, + null, certVerifyContent); + if (log.isDebugEnabled()) { + log.debug("Verify response:" + response.getContent()); + } + } else { log.warn("Unauthorized request for api: " + ctxPath); - setFaultCodeAndThrowAxisFault(messageContext, new Exception("Unauthorized!")); - return InvocationResponse.SUSPEND; - } catch (Exception e) { - log.error("Error while processing certificate.", e); - setFaultCodeAndThrowAxisFault(messageContext, e); - return InvocationResponse.SUSPEND; + return false; } - } else { - return InvocationResponse.CONTINUE; - } - - } - - /** - * API filter - * - * @param messageContext - * @return boolean - */ - private boolean isSecuredAPI(MessageContext messageContext) { - if (messageContext.getTo() != null && messageContext.getTransportIn() != null && - messageContext.getTransportIn().getName().toLowerCase().equals(AuthConstants.HTTPS)) { - for (String path : apiList) { - if (messageContext.getTo().getAddress().trim().contains(path)) { - return true; - } + if (response != null && !response.getContent().contains("invalid")) { + return true; } - } - return false; - } - - /** - * Get access token to call admin certificate management service for cert validation. - * - * @return accessToken String - * @throws URISyntaxException - * @throws IOException - */ - private String getAccessToken() throws URISyntaxException, IOException, JSONException { - URI dcrUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils - .getHttpsPort() + "/dynamic-client-web/register"); - String dcrContent = "{\n" + - "\"owner\":\"" + CoreUtils.getUsername() + "\",\n" + - "\"clientName\":\"emm\",\n" + - "\"grantType\":\"refresh_token password client_credentials\",\n" + - "\"tokenScope\":\"default\"\n" + - "}"; - Map drcHeaders = new HashMap(); - drcHeaders.put("Content-Type", "application/json"); - - RESTResponse response = restInvoker.invokePOST(dcrUrl, drcHeaders, null, - null, dcrContent); - CoreUtils.debugLog(log, "DCR response:", response.getContent()); - JSONObject jsonResponse = new JSONObject(response.getContent()); - String clientId = jsonResponse.getString("client_id"); - String clientSecret = jsonResponse.getString("client_secret"); - - URI tokenUrl = new URI(AuthConstants.HTTPS + "://" + CoreUtils.getHost() + ":" + CoreUtils - .getHttpsPort() + "/oauth2/token"); - String tokenContent = "grant_type=password&username=" + CoreUtils.getUsername() + "&password=" + - CoreUtils.getPassword() + "&scope=activity-view"; - String tokenBasicAuth = "Basic " + Base64.encode((clientId + ":" + clientSecret).getBytes()); - Map tokenHeaders = new HashMap(); - tokenHeaders.put("Authorization", tokenBasicAuth); - tokenHeaders.put("Content-Type", "application/x-www-form-urlencoded"); - - response = restInvoker.invokePOST(tokenUrl, tokenHeaders, null, - null, tokenContent); - CoreUtils.debugLog(log, "Token response:", response.getContent()); - jsonResponse = new JSONObject(response.getContent()); - String accessToken = jsonResponse.getString("access_token"); - return accessToken; - } - - /** - * Thow error message to client - * @param msgContext - * @param e Exception - * @throws AxisFault - */ - private void setFaultCodeAndThrowAxisFault(MessageContext msgContext, Exception e) throws AxisFault { - - msgContext.setProperty(AuthConstants.SEC_FAULT, Boolean.TRUE); - String soapVersionURI = msgContext.getEnvelope().getNamespace().getNamespaceURI(); - QName faultCode = null; - /* - * Get the faultCode from the thrown WSSecurity exception, if there is one - */ - if (e instanceof WSSecurityException) { - faultCode = ((WSSecurityException) e).getFaultCode(); - } - /* - * Otherwise default to InvalidSecurity - */ - if (faultCode == null) { - faultCode = new QName(WSConstants.INVALID_SECURITY.getNamespaceURI(), - WSConstants.INVALID_SECURITY.getLocalPart(), AuthConstants.WSSE); - } - - if (soapVersionURI.equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) { - - throw new AxisFault(faultCode, e.getMessage(), e); - - } else if (soapVersionURI.equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) { - - List subfaultCodes = new ArrayList(); - subfaultCodes.add(faultCode); - throw new AxisFault(Constants.FAULT_SOAP12_SENDER, subfaultCodes, e.getMessage(), e); - + log.warn("Unauthorized request for api: " + ctxPath); + return false; + } catch (IOException e) { + log.error("Error while processing certificate.", e); + return false; + } catch (URISyntaxException e) { + log.error("Error while processing certificate.", e); + return false; + } catch (APIMCertificateMGTExcepton e) { + log.error("Error while processing certificate.", e); + return false; } } - public void cleanup() { + @Override + public boolean handleResponse(org.apache.synapse.MessageContext messageContext) { + return true; } - public void init(HandlerDescription handlerDescription) { - this.handlerDesc = handlerDescription; - } - public void flowComplete(MessageContext messageContext) { - } + // TODO : take this from the url. + private String getDeviceType(String url) { + if (url.contains("ios")) { + return "ios"; + } else if (url.contains("android")) { + return "android"; + } else return null; - public HandlerDescription getHandlerDesc() { - return this.handlerDesc; - } - - public String getName() { - return "API security inflow handler"; - } - - public Parameter getParameter(String name) { - return this.handlerDesc.getParameter(name); } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/Certificate.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/Certificate.java new file mode 100644 index 0000000000..3f0b65f0ae --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/Certificate.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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 org.wso2.carbon.apimgt.handlers.beans; + +public class Certificate { + + private String pem; + private int tenantId; + private String serial; + + public String getPem() { + return pem; + } + + public void setPem(String pem) { + this.pem = pem; + } + + public int getTenantId() { + return tenantId; + } + + public void setTenantId(int tenantId) { + this.tenantId = tenantId; + } + + public String getSerial() { + return serial; + } + + public void setSerial(String serial) { + this.serial = serial; + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/DCR.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/DCR.java new file mode 100644 index 0000000000..88ae6de8ce --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/DCR.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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 org.wso2.carbon.apimgt.handlers.beans; + +public class DCR { + + private String owner; + private String clientName; + private String grantType; + private String tokenScope; + + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getClientName() { + return clientName; + } + + public void setClientName(String clientName) { + this.clientName = clientName; + } + + public String getGrantType() { + return grantType; + } + + public void setGrantType(String grantType) { + this.grantType = grantType; + } + + public String getTokenScope() { + return tokenScope; + } + + public void setTokenScope(String tokenScope) { + this.tokenScope = tokenScope; + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/ValidationResponce.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/ValidationResponce.java new file mode 100644 index 0000000000..5d698fb5a3 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/ValidationResponce.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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 org.wso2.carbon.apimgt.handlers.beans; + +public class ValidationResponce { + + private String JWTToken; // X-JWT-Assertion + private String deviceId; + private String deviceType; + private int tenantId; + + public String getJWTToken() { + return JWTToken; + } + + public void setJWTToken(String JWTToken) { + this.JWTToken = JWTToken; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } + + public int getTenantId() { + return tenantId; + } + + public void setTenantId(int tenantId) { + this.tenantId = tenantId; + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/config/IOTServerConfiguration.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/config/IOTServerConfiguration.java new file mode 100644 index 0000000000..71b430ff40 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/config/IOTServerConfiguration.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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 org.wso2.carbon.apimgt.handlers.config; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlValue; +import java.util.List; + +@XmlRootElement(name = "ServerConfiguration") +public class IOTServerConfiguration { + + private String hostname; + private String verificationEndpoint; + private String username; + private String password; + private String dynamicClientRegistrationEndpoint; + private String oauthTokenEndpoint; + private List apis; + + @XmlElement(name = "Hostname", required = true) + public String getHostname() { + return hostname; + } + + public void setHostname(String hostname) { + this.hostname = hostname; + } + + @XmlElement(name = "VerificationEndpoint", required = true) + public String getVerificationEndpoint() { + return verificationEndpoint; + } + + public void setVerificationEndpoint(String verificationEndpoint) { + this.verificationEndpoint = verificationEndpoint; + } + + @XmlElement(name = "Username", required = true) + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + @XmlElement(name = "Password", required = true) + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @XmlElement(name = "DynamicClientRegistrationEndpoint", required = true) + public String getDynamicClientRegistrationEndpoint() { + return dynamicClientRegistrationEndpoint; + } + + public void setDynamicClientRegistrationEndpoint(String dynamicClientRegistrationEndpoint) { + this.dynamicClientRegistrationEndpoint = dynamicClientRegistrationEndpoint; + } + + @XmlElement(name = "OauthTokenEndpoint", required = true) + public String getOauthTokenEndpoint() { + return oauthTokenEndpoint; + } + + public void setOauthTokenEndpoint(String oauthTokenEndpoint) { + this.oauthTokenEndpoint = oauthTokenEndpoint; + } + + @XmlElementWrapper(name="APIS") + @XmlElement(name = "ContextPath", required = true) + public List getApis() { + return apis; + } + + public void setApis(List apis) { + this.apis = apis; + } + + @XmlRootElement(name = "ContextPath") + public static class ContextPath { + + private String contextPath; + + @XmlValue() + public String getContextPath() { + return contextPath; + } + + public void setContextPath(String contextPath) { + this.contextPath = contextPath; + } + } +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTInvoker.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTInvoker.java index 7873a7fc54..95b4fdecca 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTInvoker.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTInvoker.java @@ -61,64 +61,64 @@ public class RESTInvoker { configureHttpClient(); } - private void parseConfiguration() { - String carbonConfigDirPath = CarbonUtils.getCarbonConfigDirPath(); - String apiFilterConfigPath = carbonConfigDirPath + File.separator + - AuthConstants.AUTH_CONFIGURATION_FILE_NAME; - File configFile = new File(apiFilterConfigPath); - - try { - String configContent = FileUtils.readFileToString(configFile); - OMElement configElement = AXIOMUtil.stringToOM(configContent); - Iterator beans = configElement.getChildrenWithName( - new QName("http://www.springframework.org/schema/beans", "bean")); - - while (beans.hasNext()) { - OMElement bean = (OMElement) beans.next(); - String beanId = bean.getAttributeValue(new QName(null, "id")); - if (beanId.equals(RESTConstants.REST_CLIENT_CONFIG_ELEMENT)) { - Iterator beanProps = bean.getChildrenWithName( - new QName("http://www.springframework.org/schema/beans", "property")); - - while (beanProps.hasNext()) { - OMElement beanProp = (OMElement) beanProps.next(); - String beanName = beanProp.getAttributeValue(new QName(null, "name")); - if (RESTConstants.REST_CLIENT_MAX_TOTAL_CONNECTIONS.equals(beanName)) { - String value = beanProp.getAttributeValue(new QName(null, "value")); - if (value != null && !value.trim().equals("")) { - maxTotalConnections = Integer.parseInt(value); - } - CoreUtils.debugLog(log, "Max total http connections ", maxTotalConnections); - } else if (RESTConstants.REST_CLIENT_MAX_CONNECTIONS_PER_ROUTE.equals(beanName)) { - String value = beanProp.getAttributeValue(new QName(null, "value")); - if (value != null && !value.trim().equals("")) { - maxTotalConnectionsPerRoute = Integer.parseInt(value); - } - CoreUtils.debugLog(log, "Max total client connections per route ", maxTotalConnectionsPerRoute); - } else if (RESTConstants.REST_CLEINT_CONNECTION_TIMEOUT.equals(beanName)) { - String value = beanProp.getAttributeValue(new QName(null, "value")); - if (value != null && !value.trim().equals("")) { - connectionTimeout = Integer.parseInt(value); - } - } else if (RESTConstants.REST_CLEINT_SOCKET_TIMEOUT.equals(beanName)) { - String value = beanProp.getAttributeValue(new QName(null, "value")); - if (value != null && !value.trim().equals("")) { - socketTimeout = Integer.parseInt(value); - } - } - } - } - } - } catch (XMLStreamException e) { - log.error("Error in processing http connection settings, using default settings", e); - } catch (IOException e) { - log.error("Error in processing http connection settings, using default settings", e); - } - } +// private void parseConfiguration() { +// String carbonConfigDirPath = CarbonUtils.getCarbonConfigDirPath(); +// String apiFilterConfigPath = carbonConfigDirPath + File.separator + +// AuthConstants.AUTH_CONFIGURATION_FILE_NAME; +// File configFile = new File(apiFilterConfigPath); +// +// try { +// String configContent = FileUtils.readFileToString(configFile); +// OMElement configElement = AXIOMUtil.stringToOM(configContent); +// Iterator beans = configElement.getChildrenWithName( +// new QName("http://www.springframework.org/schema/beans", "bean")); +// +// while (beans.hasNext()) { +// OMElement bean = (OMElement) beans.next(); +// String beanId = bean.getAttributeValue(new QName(null, "id")); +// if (beanId.equals(RESTConstants.REST_CLIENT_CONFIG_ELEMENT)) { +// Iterator beanProps = bean.getChildrenWithName( +// new QName("http://www.springframework.org/schema/beans", "property")); +// +// while (beanProps.hasNext()) { +// OMElement beanProp = (OMElement) beanProps.next(); +// String beanName = beanProp.getAttributeValue(new QName(null, "name")); +// if (RESTConstants.REST_CLIENT_MAX_TOTAL_CONNECTIONS.equals(beanName)) { +// String value = beanProp.getAttributeValue(new QName(null, "value")); +// if (value != null && !value.trim().equals("")) { +// maxTotalConnections = Integer.parseInt(value); +// } +// CoreUtils.debugLog(log, "Max total http connections ", maxTotalConnections); +// } else if (RESTConstants.REST_CLIENT_MAX_CONNECTIONS_PER_ROUTE.equals(beanName)) { +// String value = beanProp.getAttributeValue(new QName(null, "value")); +// if (value != null && !value.trim().equals("")) { +// maxTotalConnectionsPerRoute = Integer.parseInt(value); +// } +// CoreUtils.debugLog(log, "Max total client connections per route ", maxTotalConnectionsPerRoute); +// } else if (RESTConstants.REST_CLEINT_CONNECTION_TIMEOUT.equals(beanName)) { +// String value = beanProp.getAttributeValue(new QName(null, "value")); +// if (value != null && !value.trim().equals("")) { +// connectionTimeout = Integer.parseInt(value); +// } +// } else if (RESTConstants.REST_CLEINT_SOCKET_TIMEOUT.equals(beanName)) { +// String value = beanProp.getAttributeValue(new QName(null, "value")); +// if (value != null && !value.trim().equals("")) { +// socketTimeout = Integer.parseInt(value); +// } +// } +// } +// } +// } +// } catch (XMLStreamException e) { +// log.error("Error in processing http connection settings, using default settings", e); +// } catch (IOException e) { +// log.error("Error in processing http connection settings, using default settings", e); +// } +// } private void configureHttpClient() { - parseConfiguration(); +// parseConfiguration(); RequestConfig defaultRequestConfig = RequestConfig.custom() .setExpectContinueEnabled(true) @@ -134,10 +134,17 @@ public class RESTInvoker { .setDefaultRequestConfig(defaultRequestConfig) .build(); - CoreUtils.debugLog(log, "REST client initialized with ", - "maxTotalConnection = ", maxTotalConnections, - "maxConnectionsPerRoute = ", maxTotalConnectionsPerRoute, - "connectionTimeout = ", connectionTimeout); + if(log.isDebugEnabled()){ + log.debug("REST client initialized with " + + "maxTotalConnection = " + maxTotalConnections + + "maxConnectionsPerRoute = " + maxTotalConnectionsPerRoute + + "connectionTimeout = " + connectionTimeout); + } +// +// CoreUtils.debugLog(log, "REST client initialized with ", +// "maxTotalConnection = ", maxTotalConnections, +// "maxConnectionsPerRoute = ", maxTotalConnectionsPerRoute, +// "connectionTimeout = ", connectionTimeout); } public void closeHttpClient() { @@ -176,8 +183,8 @@ public class RESTInvoker { headers = response.getAllHeaders(); httpStatus = response.getStatusLine().getStatusCode(); contentType = response.getEntity().getContentType().getValue(); - if (log.isTraceEnabled()) { - log.trace("Invoked GET " + uri.toString() + " - Response message: " + output); + if (log.isDebugEnabled()) { + log.debug("Invoked GET " + uri.toString() + " - Response message: " + output); } EntityUtils.consume(response.getEntity()); } finally { @@ -215,8 +222,8 @@ public class RESTInvoker { headers = response.getAllHeaders(); httpStatus = response.getStatusLine().getStatusCode(); contentType = response.getEntity().getContentType().getValue(); - if (log.isTraceEnabled()) { - log.trace("Invoked POST " + uri.toString() + + if (log.isDebugEnabled()) { + log.debug("Invoked POST " + uri.toString() + " - Input payload: " + payload + " - Response message: " + output); } EntityUtils.consume(response.getEntity()); @@ -265,8 +272,8 @@ public class RESTInvoker { headers = response.getAllHeaders(); httpStatus = response.getStatusLine().getStatusCode(); contentType = response.getEntity().getContentType().getValue(); - if (log.isTraceEnabled()) { - log.trace("Invoked PUT " + uri.toString() + " - Response message: " + output); + if (log.isDebugEnabled()) { + log.debug("Invoked PUT " + uri.toString() + " - Response message: " + output); } EntityUtils.consume(response.getEntity()); } finally { @@ -311,8 +318,8 @@ public class RESTInvoker { headers = response.getAllHeaders(); httpStatus = response.getStatusLine().getStatusCode(); contentType = response.getEntity().getContentType().getValue(); - if (log.isTraceEnabled()) { - log.trace("Invoked DELETE " + uri.toString() + " - Response message: " + output); + if (log.isDebugEnabled()) { + log.debug("Invoked DELETE " + uri.toString() + " - Response message: " + output); } EntityUtils.consume(response.getEntity()); } finally { diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java index 852e2529b7..605ad801e6 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java @@ -40,95 +40,95 @@ public class CoreUtils { private static String iosVerifyEndpoint = "/api/certificate-mgt/v1.0/admin/certificates/verify/ios"; private static String androidVerifyEndpoint = "/api/certificate-mgt/v1.0/admin/certificates/verify/android"; - /** - * Reading configurations from api-filter-config.xml file - * - * @return ArrayList of api contexts - */ - public static ArrayList readApiFilterList() { - ArrayList apiList = new ArrayList(); - String carbonConfigDirPath = CarbonUtils.getCarbonConfigDirPath(); - String apiFilterConfigPath = carbonConfigDirPath + File.separator + - AuthConstants.AUTH_CONFIGURATION_FILE_NAME; - File configFile = new File(apiFilterConfigPath); - - try { - String configContent = FileUtils.readFileToString(configFile); - OMElement configElement = AXIOMUtil.stringToOM(configContent); - Iterator beans = configElement.getChildrenWithName( - new QName("http://www.springframework.org/schema/beans", "bean")); - - while (beans.hasNext()) { - OMElement bean = (OMElement) beans.next(); - String beanId = bean.getAttributeValue(new QName(null, "id")); - if (beanId.equals(AuthConstants.API_FILTER_CONFIG_ELEMENT)) { - Iterator beanProps = bean.getChildrenWithName( - new QName("http://www.springframework.org/schema/beans", "property")); - - while (beanProps.hasNext()) { - OMElement beanProp = (OMElement) beanProps.next(); - String beanName = beanProp.getAttributeValue(new QName(null, "name")); - if (AuthConstants.API_LIST_PROPERTY.equals(beanName)) { - Iterator apiListSet = ((OMElement) beanProp.getChildrenWithLocalName("set").next()) - .getChildrenWithLocalName("value"); - while (apiListSet.hasNext()) { - String apiContext = ((OMElement) apiListSet.next()).getText(); - apiList.add(apiContext); - CoreUtils.debugLog(log, "Adding security to api: ", apiContext); - } - } else if (AuthConstants.HOST.equals(beanName)) { - String value = beanProp.getAttributeValue(new QName(null, "value")); - host = value; - } else if (AuthConstants.HTTPS_PORT.equals(beanName)) { - String value = beanProp.getAttributeValue(new QName(null, "value")); - if (value != null && !value.trim().equals("")) { - httpsPort = Integer.parseInt(value); - } - } else if (AuthConstants.USERNAME.equals(beanName)) { - String value = beanProp.getAttributeValue(new QName(null, "value")); - username = value; - } else if (AuthConstants.PASSWORD.equals(beanName)) { - String value = beanProp.getAttributeValue(new QName(null, "value")); - password = value; - } else if (AuthConstants.IOS_VERIFY_ENDPOINT.equals(beanName)) { - String value = beanProp.getAttributeValue(new QName(null, "value")); - iosVerifyEndpoint = value; - } else if (AuthConstants.ANDROID_VERIFY_ENDPOINT.equals(beanName)) { - String value = beanProp.getAttributeValue(new QName(null, "value")); - androidVerifyEndpoint = value; - } - } - } - } - } catch (IOException e) { - log.error("Error in reading api filter settings", e); - } catch (XMLStreamException e) { - log.error("Error in reading api filter settings", e); - } - return apiList; - } - - /** - * Universal debug log function - * - * @param logger Log object specific to the class - * @param message initial debug log message - * @param vars optional strings to be appended for the log - */ - public static void debugLog(Log logger, String message, Object ... vars) { - if(logger.isDebugEnabled()) { - if (vars.length < 1) { - logger.debug(message); - return; - } - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(message); - for (Object var : vars) { - stringBuilder.append(var.toString()); - } - logger.debug(stringBuilder.toString()); - } - } +// /** +// * Reading configurations from api-filter-config.xml file +// * +// * @return ArrayList of api contexts +// */ +// public static ArrayList readApiFilterList() { +// ArrayList apiList = new ArrayList(); +// String carbonConfigDirPath = CarbonUtils.getCarbonConfigDirPath(); +// String apiFilterConfigPath = carbonConfigDirPath + File.separator + +// AuthConstants.AUTH_CONFIGURATION_FILE_NAME; +// File configFile = new File(apiFilterConfigPath); +// +// try { +// String configContent = FileUtils.readFileToString(configFile); +// OMElement configElement = AXIOMUtil.stringToOM(configContent); +// Iterator beans = configElement.getChildrenWithName( +// new QName("http://www.springframework.org/schema/beans", "bean")); +// +// while (beans.hasNext()) { +// OMElement bean = (OMElement) beans.next(); +// String beanId = bean.getAttributeValue(new QName(null, "id")); +// if (beanId.equals(AuthConstants.API_FILTER_CONFIG_ELEMENT)) { +// Iterator beanProps = bean.getChildrenWithName( +// new QName("http://www.springframework.org/schema/beans", "property")); +// +// while (beanProps.hasNext()) { +// OMElement beanProp = (OMElement) beanProps.next(); +// String beanName = beanProp.getAttributeValue(new QName(null, "name")); +// if (AuthConstants.API_LIST_PROPERTY.equals(beanName)) { +// Iterator apiListSet = ((OMElement) beanProp.getChildrenWithLocalName("set").next()) +// .getChildrenWithLocalName("value"); +// while (apiListSet.hasNext()) { +// String apiContext = ((OMElement) apiListSet.next()).getText(); +// apiList.add(apiContext); +// CoreUtils.debugLog(log, "Adding security to api: ", apiContext); +// } +// } else if (AuthConstants.HOST.equals(beanName)) { +// String value = beanProp.getAttributeValue(new QName(null, "value")); +// host = value; +// } else if (AuthConstants.HTTPS_PORT.equals(beanName)) { +// String value = beanProp.getAttributeValue(new QName(null, "value")); +// if (value != null && !value.trim().equals("")) { +// httpsPort = Integer.parseInt(value); +// } +// } else if (AuthConstants.USERNAME.equals(beanName)) { +// String value = beanProp.getAttributeValue(new QName(null, "value")); +// username = value; +// } else if (AuthConstants.PASSWORD.equals(beanName)) { +// String value = beanProp.getAttributeValue(new QName(null, "value")); +// password = value; +// } else if (AuthConstants.IOS_VERIFY_ENDPOINT.equals(beanName)) { +// String value = beanProp.getAttributeValue(new QName(null, "value")); +// iosVerifyEndpoint = value; +// } else if (AuthConstants.ANDROID_VERIFY_ENDPOINT.equals(beanName)) { +// String value = beanProp.getAttributeValue(new QName(null, "value")); +// androidVerifyEndpoint = value; +// } +// } +// } +// } +// } catch (IOException e) { +// log.error("Error in reading api filter settings", e); +// } catch (XMLStreamException e) { +// log.error("Error in reading api filter settings", e); +// } +// return apiList; +// } +// +// /** +// * Universal debug log function +// * +// * @param logger Log object specific to the class +// * @param message initial debug log message +// * @param vars optional strings to be appended for the log +// */ +// public static void debugLog(Log logger, String message, Object ... vars) { +// if(logger.isDebugEnabled()) { +// if (vars.length < 1) { +// logger.debug(message); +// return; +// } +// StringBuilder stringBuilder = new StringBuilder(); +// stringBuilder.append(message); +// for (Object var : vars) { +// stringBuilder.append(var.toString()); +// } +// logger.debug(stringBuilder.toString()); +// } +// } public static String getHost() { return host; diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java new file mode 100644 index 0000000000..416ae306ae --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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 org.wso2.carbon.apimgt.handlers.utils; + +import com.google.gson.Gson; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.ws.security.util.Base64; +import org.json.JSONException; +import org.json.JSONObject; +import org.w3c.dom.Document; +import org.wso2.carbon.apimgt.handlers.APIMCertificateMGTExcepton; +import org.wso2.carbon.apimgt.handlers.beans.DCR; +import org.wso2.carbon.apimgt.handlers.config.IOTServerConfiguration; +import org.wso2.carbon.apimgt.handlers.invoker.RESTInvoker; +import org.wso2.carbon.apimgt.handlers.invoker.RESTResponse; +import org.wso2.carbon.utils.CarbonUtils; + +import javax.xml.XMLConstants; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.HashMap; +import java.util.Map; + +public class Utils { + + private static final Log log = LogFactory.getLog(Utils.class); + private static final String IOT_APIS_CONFIG_FILE = "iot-api-config.xml"; + private static String clientId; + private static String clientSecret; + + public static IOTServerConfiguration initConfig() { + try { + + String IOTServerAPIConfigurationPath = + CarbonUtils.getCarbonConfigDirPath() + File.separator + IOT_APIS_CONFIG_FILE; + File file = new File(IOTServerAPIConfigurationPath); + Document doc = Utils.convertToDocument(file); + + JAXBContext fileContext = JAXBContext.newInstance(IOTServerConfiguration.class); + Unmarshaller unmarshaller = fileContext.createUnmarshaller(); + return (IOTServerConfiguration) unmarshaller.unmarshal(doc); + + } catch (JAXBException | APIMCertificateMGTExcepton e) { + log.error("Error occurred while initializing Data Source config", e); + return null; + } + } + + public static Document convertToDocument(File file) throws APIMCertificateMGTExcepton { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + try { + DocumentBuilder docBuilder = factory.newDocumentBuilder(); + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + return docBuilder.parse(file); + } catch (Exception e) { + throw new APIMCertificateMGTExcepton("Error occurred while parsing file, while converting " + + "to a org.w3c.dom.Document", e); + } + } + + public static String getAccessToken(IOTServerConfiguration iotServerConfiguration) + throws APIMCertificateMGTExcepton { + try { + if (clientId == null || clientSecret == null) { + getClientSecretes(iotServerConfiguration); + } + URI tokenUrl = new URI(iotServerConfiguration.getOauthTokenEndpoint()); + String tokenContent = "grant_type=password&username=" + iotServerConfiguration.getUsername()+ "&password=" + + iotServerConfiguration.getPassword() + "&scope=activity-view"; + String tokenBasicAuth = "Basic " + Base64.encode((clientId + ":" + clientSecret).getBytes()); + Map tokenHeaders = new HashMap(); + tokenHeaders.put("Authorization", tokenBasicAuth); + tokenHeaders.put("Content-Type", "application/x-www-form-urlencoded"); + + RESTInvoker restInvoker = new RESTInvoker(); + RESTResponse response = restInvoker.invokePOST(tokenUrl, tokenHeaders, null, + null, tokenContent); + if(log.isDebugEnabled()) { + log.debug("Token response:" + response.getContent()); + } + JSONObject jsonResponse = new JSONObject(response.getContent()); + String accessToken = jsonResponse.getString("access_token"); + return accessToken; + + } catch (URISyntaxException e) { + throw new APIMCertificateMGTExcepton("Error occurred while trying to call oauth token endpoint", e); + } catch (JSONException e) { + throw new APIMCertificateMGTExcepton("Error occurred while converting the json to object", e); + } catch (IOException e) { + throw new APIMCertificateMGTExcepton("Error occurred while trying to call oauth token endpoint", e); + } + } + + private static void getClientSecretes(IOTServerConfiguration iotServerConfiguration) + throws APIMCertificateMGTExcepton { + try { + DCR dcr = new DCR(); + dcr.setOwner(iotServerConfiguration.getUsername()); + dcr.setClientName("IOT-API-MANAGER"); + dcr.setGrantType("refresh_token password client_credentials"); + dcr.setTokenScope("default"); + Gson gson = new Gson(); + String dcrContent = gson.toJson(dcr); + Map drcHeaders = new HashMap(); + drcHeaders.put("Content-Type", "application/json"); + URI dcrUrl = new URI(iotServerConfiguration.getDynamicClientRegistrationEndpoint()); + RESTInvoker restInvoker = new RESTInvoker(); + RESTResponse response = restInvoker.invokePOST(dcrUrl, drcHeaders, null, + null, dcrContent); + + if (log.isDebugEnabled()) { + log.debug("DCR response :" + response.getContent()); + } + JSONObject jsonResponse = new JSONObject(response.getContent()); + clientId = jsonResponse.getString("client_id"); + clientSecret = jsonResponse.getString("client_secret"); + } catch (JSONException e) { + throw new APIMCertificateMGTExcepton("Error occurred while converting the json to object", e); + } catch (IOException e) { + throw new APIMCertificateMGTExcepton("Error occurred while trying to call DCR endpoint", e); + } catch (URISyntaxException e) { + throw new APIMCertificateMGTExcepton("Error occurred while trying to call DCR endpoint", e); + } + + } + +} + diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/api-filter-config.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/api-filter-config.xml deleted file mode 100644 index fc6c241759..0000000000 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/api-filter-config.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - /services/echo - /abc - - - - - - - - - - \ No newline at end of file diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/ios-synapse-config.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/ios-synapse-config.xml deleted file mode 100644 index cba71164e1..0000000000 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/ios-synapse-config.xml +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/iot-api-config.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/iot-api-config.xml new file mode 100644 index 0000000000..c5447fb0e5 --- /dev/null +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/iot-api-config.xml @@ -0,0 +1,48 @@ + + + + + + https://localhost:9443/ + + + https://localhost:9443/api/certificate-mgt/v1.0/admin/certificates/verify/ + + + admin + admin + + + https://localhost:9443/dynamic-client-web/register + + + https://localhost:9443/oauth2/token + + + /services/echo + /abc + /ca + /authenticate + /enroll + /enrolled + /license + /checkin + /server + + \ No newline at end of file diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml index 377b33ea3e..4c572152a9 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml @@ -149,6 +149,11 @@ org.wso2.carbon.certificate.mgt.core provided + + org.wso2.carbon.devicemgt + org.wso2.carbon.identity.jwt.client.extension + provided + io.swagger swagger-annotations diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java index a273a52fd2..857f2ab2a6 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java @@ -18,6 +18,7 @@ import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.EnrollmentCertificat import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.ErrorResponse; import org.wso2.carbon.certificate.mgt.core.dto.CertificateResponse; +import javax.validation.constraints.Size; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -60,9 +61,9 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", authorizations = { @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/certificates/manage", - description = "Manage certificates") } + value = "permission", + scopes = {@AuthorizationScope(scope = "/device-mgt/certificates/manage", + description = "Manage certificates")} ) } ) @@ -131,9 +132,9 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", authorizations = { @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/certificates/view", - description = "View certificates") } + value = "permission", + scopes = {@AuthorizationScope(scope = "/device-mgt/certificates/view", + description = "View certificates")} ) } ) @@ -204,9 +205,9 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", authorizations = { @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/certificates/view", - description = "View certificates") } + value = "permission", + scopes = {@AuthorizationScope(scope = "/device-mgt/certificates/view", + description = "View certificates")} ) } ) @@ -285,9 +286,9 @@ public interface CertificateManagementAdminService { tags = "Certificate Management", authorizations = { @Authorization( - value="permission", - scopes = { @AuthorizationScope(scope = "/device-mgt/certificates/manage", - description = "Manage certificates") } + value = "permission", + scopes = {@AuthorizationScope(scope = "/device-mgt/certificates/manage", + description = "Manage certificates")} ) } ) @@ -316,43 +317,81 @@ public interface CertificateManagementAdminService { defaultValue = "12438035315552875930") @PathParam("serialNumber") String serialNumber); - /** - * Verify IOS Certificate for the API security filter - * - * @param certificate to be verified as a String - * @return Status of the certificate verification. - */ - @POST - @Path("/verify/ios") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - produces = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Verify IOS SSL certificate", - notes = "Verify IOS Certificate for the API security filter.\n", - tags = "Certificate Management") - @ApiResponses( - value = { - @ApiResponse( - code = 200, - message = "Return the status of the IOS certificate verification.", - responseHeaders = { - @ResponseHeader( - name = "Content-Type", - description = "The content type of the body")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error.", - response = ErrorResponse.class) - }) - @Permission(name = "Manage certificates", permission = "/device-mgt/certificates/manage") - Response verifyIOSCertificate( - @ApiParam( - name = "certificate", - value = "The properties to verify certificate. It includes the following: \n" + - "serial: The unique ID of the certificate. (optional) \n" + - "pem: mdm-signature of the certificate", - required = true) EnrollmentCertificate certificate); +// /** +// * Verify IOS Certificate for the API security filter +// * +// * @param certificate to be verified as a String +// * @return Status of the certificate verification. +// */ +// @POST +// @Path("/verify/ios") +// @ApiOperation( +// consumes = MediaType.APPLICATION_JSON, +// produces = MediaType.APPLICATION_JSON, +// httpMethod = "POST", +// value = "Verify IOS SSL certificate", +// notes = "Verify IOS Certificate for the API security filter.\n", +// tags = "Certificate Management") +// @ApiResponses( +// value = { +// @ApiResponse( +// code = 200, +// message = "Return the status of the IOS certificate verification.", +// responseHeaders = { +// @ResponseHeader( +// name = "Content-Type", +// description = "The content type of the body")}), +// @ApiResponse( +// code = 400, +// message = "Bad Request. \n Invalid request or validation error.", +// response = ErrorResponse.class) +// }) +// Response verifyIOSCertificate( +// @ApiParam( +// name = "certificate", +// value = "The properties to verify certificate. It includes the following: \n" + +// "serial: The unique ID of the certificate. (optional) \n" + +// "pem: mdm-signature of the certificate", +// required = true) EnrollmentCertificate certificate); +// +// /** +// * Verify Android Certificate for the API security filter +// * +// * @param certificate to be verified as a String +// * @return Status of the certificate verification. +// */ +// @POST +// @Path("/verify/android") +// @ApiOperation( +// consumes = MediaType.APPLICATION_JSON, +// produces = MediaType.APPLICATION_JSON, +// httpMethod = "POST", +// value = "Verify Android SSL certificate", +// notes = "Verify Android Certificate for the API security filter.\n", +// tags = "Certificate Management") +// @ApiResponses( +// value = { +// @ApiResponse( +// code = 200, +// message = "Return the status of the Android certificate verification.", +// responseHeaders = { +// @ResponseHeader( +// name = "Content-Type", +// description = "The content type of the body")}), +// @ApiResponse( +// code = 400, +// message = "Bad Request. \n Invalid request or validation error.", +// response = ErrorResponse.class) +// }) +// Response verifyAndroidCertificate( +// @ApiParam( +// name = "certificate", +// value = "The properties to verify certificate. It includes the following: \n" + +// "serial: The unique ID of the certificate. (optional) \n" + +// "pem: pem String of the certificate", +// required = true) EnrollmentCertificate certificate); +// + /** * Verify Android Certificate for the API security filter @@ -361,7 +400,7 @@ public interface CertificateManagementAdminService { * @return Status of the certificate verification. */ @POST - @Path("/verify/android") + @Path("/verify/{type}") @ApiOperation( consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON, @@ -383,8 +422,15 @@ public interface CertificateManagementAdminService { message = "Bad Request. \n Invalid request or validation error.", response = ErrorResponse.class) }) - @Permission(name = "Manage certificates", permission = "/device-mgt/certificates/manage") - Response verifyAndroidCertificate( + Response verifyCertificate( + @ApiParam( + name = "type", + value = "The device type, such as ios, android or windows.", + required = true, + allowableValues = "android, ios, windows") + @PathParam("type") + @Size(max = 45) + String type, @ApiParam( name = "certificate", value = "The properties to verify certificate. It includes the following: \n" + @@ -392,3 +438,4 @@ public interface CertificateManagementAdminService { "pem: pem String of the certificate", required = true) EnrollmentCertificate certificate); } + diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/ValidationResponce.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/ValidationResponce.java new file mode 100644 index 0000000000..5a72112e4d --- /dev/null +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/beans/ValidationResponce.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. 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 org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans; + +public class ValidationResponce { + + private String JWTToken; // X-JWT-Assertion + private String deviceId; + private String deviceType; + private int tenantId; + + public String getJWTToken() { + return JWTToken; + } + + public void setJWTToken(String JWTToken) { + this.JWTToken = JWTToken; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } + + public int getTenantId() { + return tenantId; + } + + public void setTenantId(int tenantId) { + this.tenantId = tenantId; + } +} + diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/impl/CertificateManagementAdminServiceImpl.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/impl/CertificateManagementAdminServiceImpl.java index 0b7b7210e8..0f62d9e72b 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/impl/CertificateManagementAdminServiceImpl.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/impl/CertificateManagementAdminServiceImpl.java @@ -1,12 +1,12 @@ package org.wso2.carbon.certificate.mgt.cert.jaxrs.api.impl; -import io.swagger.annotations.ApiParam; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.CertificateManagementAdminService; import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.CertificateList; import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.EnrollmentCertificate; import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.ErrorResponse; +import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.beans.ValidationResponce; import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.util.CertificateMgtAPIUtils; import org.wso2.carbon.certificate.mgt.cert.jaxrs.api.util.RequestValidationUtil; import org.wso2.carbon.certificate.mgt.core.dto.CertificateResponse; @@ -20,6 +20,8 @@ import org.wso2.carbon.certificate.mgt.core.service.PaginationResult; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; +import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException; +import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService; import javax.ws.rs.*; import javax.ws.rs.core.Response; @@ -145,25 +147,119 @@ public class CertificateManagementAdminServiceImpl implements CertificateManagem } } +// @POST +// @Path("/verify/ios") +// public Response verifyIOSCertificate(@ApiParam(name = "certificate", value = "Mdm-Signature of the " + +// "certificate that needs to be verified", required = true) EnrollmentCertificate certificate) { +// try { +// CertificateManagementService certMgtService = CertificateMgtAPIUtils.getCertificateManagementService(); +// X509Certificate cert = certMgtService.extractCertificateFromSignature(certificate.getPem()); +// String challengeToken = certMgtService.extractChallengeToken(cert); +// +// if (challengeToken != null) { +// challengeToken = challengeToken.substring(challengeToken.indexOf("(") + 1).trim(); +// +// SCEPManager scepManager = CertificateMgtAPIUtils.getSCEPManagerService(); +// DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); +// deviceIdentifier.setId(challengeToken); +// deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS); +// TenantedDeviceWrapper tenantedDeviceWrapper = scepManager.getValidatedDevice(deviceIdentifier); +// +// if (tenantedDeviceWrapper != null) { +// return Response.status(Response.Status.OK).entity("valid").build(); +// } +// } +// } catch (SCEPException e) { +// String msg = "Error occurred while extracting information from certificate."; +// log.error(msg, e); +// return Response.serverError().entity( +// new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()).build(); +// } catch (KeystoreException e) { +// String msg = "Error occurred while converting PEM file to X509Certificate."; +// log.error(msg, e); +// return Response.serverError().entity( +// new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()).build(); +// } +// return Response.status(Response.Status.OK).entity("invalid").build(); +// } +// +// @POST +// @Path("/verify/android") +// public Response verifyAndroidCertificate(@ApiParam(name = "certificate", value = "Base64 encoded .pem file of the " + +// "certificate that needs to be verified", required = true) EnrollmentCertificate certificate) { +// CertificateResponse certificateResponse = null; +// try { +// CertificateManagementService certMgtService = CertificateMgtAPIUtils.getCertificateManagementService(); +// if (certificate.getSerial().toLowerCase().contains(PROXY_AUTH_MUTUAL_HEADER)) { +// certificateResponse = certMgtService.verifySubjectDN(certificate.getPem()); +// } else { +// X509Certificate clientCertificate = certMgtService.pemToX509Certificate(certificate.getPem()); +// if (clientCertificate != null) { +// certificateResponse = certMgtService.verifyPEMSignature(clientCertificate); +// } +// } +// +// if (certificateResponse != null && certificateResponse.getCommonName() != null && !certificateResponse +// .getCommonName().isEmpty()) { +// return Response.status(Response.Status.OK).entity("valid").build(); +// } +// } catch (KeystoreException e) { +// String msg = "Error occurred while converting PEM file to X509Certificate."; +// log.error(msg, e); +// return Response.serverError().entity( +// new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()).build(); +// } +// return Response.status(Response.Status.OK).entity("invalid").build(); +// } + @POST - @Path("/verify/ios") - public Response verifyIOSCertificate(@ApiParam(name = "certificate", value = "Mdm-Signature of the " + - "certificate that needs to be verified", required = true) EnrollmentCertificate certificate) { + @Path("/verify/{type}") + public Response verifyCertificate(@PathParam("type") String type, EnrollmentCertificate certificate) { try { CertificateManagementService certMgtService = CertificateMgtAPIUtils.getCertificateManagementService(); - X509Certificate cert = certMgtService.extractCertificateFromSignature(certificate.getPem()); - String challengeToken = certMgtService.extractChallengeToken(cert); - if (challengeToken != null) { - challengeToken = challengeToken.substring(challengeToken.indexOf("(") + 1).trim(); + if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS.equalsIgnoreCase(type)) { + X509Certificate cert = certMgtService.extractCertificateFromSignature(certificate.getPem()); + String challengeToken = certMgtService.extractChallengeToken(cert); - SCEPManager scepManager = CertificateMgtAPIUtils.getSCEPManagerService(); - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); - deviceIdentifier.setId(challengeToken); - deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS); - TenantedDeviceWrapper tenantedDeviceWrapper = scepManager.getValidatedDevice(deviceIdentifier); + if (challengeToken != null) { + challengeToken = challengeToken.substring(challengeToken.indexOf("(") + 1).trim(); - if (tenantedDeviceWrapper != null) { + SCEPManager scepManager = CertificateMgtAPIUtils.getSCEPManagerService(); + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId(challengeToken); + deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS); + TenantedDeviceWrapper tenantedDeviceWrapper = scepManager.getValidatedDevice(deviceIdentifier); + + JWTClientManagerService jwtClientManagerService = CertificateMgtAPIUtils.getJwtClientManagerService(); + String jwdToken = jwtClientManagerService.getJWTClient().getJwtToken( + tenantedDeviceWrapper.getDevice().getEnrolmentInfo().getOwner()); + + ValidationResponce validationResponce = new ValidationResponce(); + validationResponce.setDeviceId(challengeToken); + validationResponce.setDeviceType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS); + validationResponce.setJWTToken(jwdToken); + validationResponce.setTenantId(tenantedDeviceWrapper.getTenantId()); + + if (tenantedDeviceWrapper != null) { + return Response.status(Response.Status.OK).entity(validationResponce).build(); + } + } + } + + if (DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID.equalsIgnoreCase(type)) { + CertificateResponse certificateResponse = null; + if (certificate.getSerial().toLowerCase().contains(PROXY_AUTH_MUTUAL_HEADER)) { + certificateResponse = certMgtService.verifySubjectDN(certificate.getPem()); + } else { + X509Certificate clientCertificate = certMgtService.pemToX509Certificate(certificate.getPem()); + if (clientCertificate != null) { + certificateResponse = certMgtService.verifyPEMSignature(clientCertificate); + } + } + + if (certificateResponse != null && certificateResponse.getCommonName() != null && !certificateResponse + .getCommonName().isEmpty()) { return Response.status(Response.Status.OK).entity("valid").build(); } } @@ -177,31 +273,7 @@ public class CertificateManagementAdminServiceImpl implements CertificateManagem log.error(msg, e); return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()).build(); - } - return Response.status(Response.Status.OK).entity("invalid").build(); - } - - @POST - @Path("/verify/android") - public Response verifyAndroidCertificate(@ApiParam(name = "certificate", value = "Base64 encoded .pem file of the " + - "certificate that needs to be verified", required = true) EnrollmentCertificate certificate) { - CertificateResponse certificateResponse = null; - try { - CertificateManagementService certMgtService = CertificateMgtAPIUtils.getCertificateManagementService(); - if (certificate.getSerial().toLowerCase().contains(PROXY_AUTH_MUTUAL_HEADER)) { - certificateResponse = certMgtService.verifySubjectDN(certificate.getPem()); - } else { - X509Certificate clientCertificate = certMgtService.pemToX509Certificate(certificate.getPem()); - if (clientCertificate != null) { - certificateResponse = certMgtService.verifyPEMSignature(clientCertificate); - } - } - - if (certificateResponse != null && certificateResponse.getCommonName() != null && !certificateResponse - .getCommonName().isEmpty()) { - return Response.status(Response.Status.OK).entity("valid").build(); - } - } catch (KeystoreException e) { + } catch (JWTClientException e) { String msg = "Error occurred while converting PEM file to X509Certificate."; log.error(msg, e); return Response.serverError().entity( diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/CertificateMgtAPIUtils.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/CertificateMgtAPIUtils.java index 06bc3169fe..fc5264c4db 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/CertificateMgtAPIUtils.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/util/CertificateMgtAPIUtils.java @@ -24,6 +24,7 @@ import org.wso2.carbon.certificate.mgt.core.scep.SCEPManager; import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.core.search.mgt.SearchManagerService; +import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService; import javax.ws.rs.core.MediaType; @@ -51,6 +52,21 @@ public class CertificateMgtAPIUtils { } + public static JWTClientManagerService getJwtClientManagerService() { + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + JWTClientManagerService jwtClientManagerService = (JWTClientManagerService) + ctx.getOSGiService(JWTClientManagerService.class, null); + + if (jwtClientManagerService == null) { + String msg = "JWTClientManagerService Management service not initialized."; + log.error(msg); + throw new IllegalStateException(msg); + } + + return jwtClientManagerService; + } + + public static SCEPManager getSCEPManagerService() { PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml index 84d43cec1f..4d3056bf11 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml @@ -17,7 +17,8 @@ ~ under the License. --> - + org.wso2.carbon.devicemgt webapp-authenticator-framework @@ -81,7 +82,8 @@ org.wso2.carbon.core.util, org.wso2.carbon.identity.base; version="${carbon.identity.imp.pkg.version}", org.wso2.carbon.identity.core.util; version="${carbon.identity.imp.pkg.version}", - org.wso2.carbon.identity.oauth2.*; version="${carbon.identity-inbound-auth-oauth.imp.pkg.version}", + org.wso2.carbon.identity.oauth2.*; + version="${carbon.identity-inbound-auth-oauth.imp.pkg.version}", org.wso2.carbon.tomcat.ext.valves, org.wso2.carbon.user.api, org.wso2.carbon.user.core.service, @@ -111,7 +113,7 @@ org.apache.http.impl.conn, javax.xml.soap; version="${javax.xml.soap.imp.pkg.version}", javax.xml.stream, - org.apache.axiom.*; version="${axiom.osgi.version.range}", + org.apache.axiom.*; version="${axiom.osgi.version.range}", org.wso2.carbon.registry.core.*, org.wso2.carbon.registry.common.*;version="${carbon.registry.imp.pkg.version.range}", org.wso2.carbon.registry.indexing.*; version="${carbon.registry.imp.pkg.version.range}", diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml new file mode 100644 index 0000000000..fceb11b4e1 --- /dev/null +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml @@ -0,0 +1,106 @@ + + + + + + + org.wso2.carbon.devicemgt + apimgt-extensions-feature + 2.0.6-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.apimgt.handler.server.feature + pom + 2.0.6-SNAPSHOT + WSO2 Carbon - Device Management - APIM handler Server Feature + http://wso2.org + This feature contains the handler for the api authentications + + + + + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.handlers + + + + + + + maven-resources-plugin + 2.6 + + + copy-resources + generate-resources + + copy-resources + + + src/main/resources + + + resources + + build.properties + p2.inf + + + + + + + + + org.wso2.maven + carbon-p2-plugin + ${carbon.p2.plugin.version} + + + p2-feature-generation + package + + p2-feature-gen + + + org.wso2.carbon.apimgt.handler.server + ../../../features/etc/feature.properties + + + org.wso2.carbon.p2.category.type:server + org.eclipse.equinox.p2.type.group:false + + + + + org.wso2.carbon.devicemgt:org.wso2.carbon.apimgt.handlers:${carbon.device.mgt.version} + + + + + + + + + + + + diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/src/main/resources/build.properties b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/src/main/resources/build.properties new file mode 100644 index 0000000000..9c86577d76 --- /dev/null +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/src/main/resources/build.properties @@ -0,0 +1 @@ +custom = true diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/src/main/resources/conf/iot-api-config.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/src/main/resources/conf/iot-api-config.xml new file mode 100644 index 0000000000..c9a210d3bf --- /dev/null +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/src/main/resources/conf/iot-api-config.xml @@ -0,0 +1,40 @@ + + + + + + https://localhost:9443/ + + + https://localhost:9443/api/certificate-mgt/v1.0/admin/certificates/verify/ + + + admin + admin + + + https://localhost:9443/dynamic-client-web/register + + + https://localhost:9443/oauth2/token + + + /services + + \ No newline at end of file diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/src/main/resources/p2.inf b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/src/main/resources/p2.inf new file mode 100644 index 0000000000..e7c6acf89f --- /dev/null +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/src/main/resources/p2.inf @@ -0,0 +1,2 @@ +instructions.configure = \ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.apimgt.handler.server_${feature.version}/conf/iot-api-config.xml,target:${installFolder}/../../conf/iot-api-config.xml,overwrite:true);\ diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/.cdm-config.xml.swp b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/.cdm-config.xml.swp deleted file mode 100644 index a8e6a11569ace238c1868963897a7820a82ec4ac..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeHNO^hTr6)qOCKp-Rv;s6M68VT)+?W&pC9dYMKRs6fL&& zsk{81pY6}juWXmcE4yBoT(_@TNKaVSn>*KEdhy%B`hZwgl0}(N`Trtmz2<1j#k~Oy znxplrE43w#w4&3Iel}wwO`IN^-))D{lsZ0*$5J!{w$FXmoJ~?^kI^)XS>jakWIVCw ziCnXDbvqZ?P`48n@3Yu0N;ygFJ2T3K0}C>Xec17(*mL|~)>MD^#6FmXwXHOnhJlBb zfyb$kw`z!C5R;5zVC;G@r3)&Xz<*niZr-v2CgfnNY~;054ofCaqw8O!=PAb@q? zN#HFUO8f|T9(WY^`$gmdZvd|XF9UtxI`C!SZ;x2kkAYW!F>n*O2)zF(%lb9&8X$pP zpanbuyn_Rf-vB=WeBd_F1il3P8HXpo1bzlgfoFiP1CIcI1+Q-dKLs?$+6M@dJD?LT zXv(G7&^HpYSUsX=sTPjl# z#F7Wg3b;#ZcDI?I#WC)bjQETttyR}Km2;+kw?}8J)!E$jHa72W^*7ohuitYWoqIyr zT@ZDWj)#G#^#|ptJs50xIY)Q5yy58oji`Uup}gMh{)2K4#s!(^MKF=x0Fr7XF5EYS8A-tFFw+5LWS(sj0Wf)eyY)IlHAvvFUV0q1b=$jK zy3+Nhltk@h)t7qD7)uB+=UMy19pUB?UX?%?UU zF53=fTnsQ9=Q0jjR6V)Q$;`5EI)4Wj5`}ujRFxN*rSeeUTil7m)-+9{>-^!9{Po{j2`?>GNa-Rn*uKKt3&?0|XbYTZ66A6|li5onh@ebh#;aX@lJQ z?zs7@vpY#obpj;i{(3|*fq6vIDI;6Bqbw3;LwH1zi1})|k&uc>rWWcGiMOsmOe9!h z&v>Gz5W!oBgnY(RJueeo_C>GPxk4C+(U`D<2$z);f;GK*QE(R6gbW$0R;gF~(AK3J z?IH1o4f0%j=nb!sJKpH|{?3TpX>V`0dn0diNc!7kqu=XzYHf?B+oaw5e%@%gm(FR- zNWc>;6UJGJ{ll3K5}uq;kOIBX<#$A=nyS_hJVw#+A)yi4?5j5nn3$_x&`Hc7OC{lg z%wr6>m|RiCwFyF0z(c&7&*zvzcsns0Q^0`{MQ-9?!MWKRZZ_BKl|`XLnUNViByx;3 z4qAi#P=u$w6CBZ0R{*&$6_Hf^9KZ~3_+aX9emt6K0R;w&N0B+&1M16`K t;!CVPiLaO7^dV1fTOHctSouuBT0vQ^dV+hV?770SeBR?TC2O*+e*$B=U Date: Fri, 6 Jan 2017 17:09:46 +0530 Subject: [PATCH 33/47] Removing the hardcoded apis --- .../src/main/resources/iot-api-config.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/iot-api-config.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/iot-api-config.xml index c5447fb0e5..fc65693d28 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/iot-api-config.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/resources/iot-api-config.xml @@ -36,13 +36,5 @@ /services/echo - /abc - /ca - /authenticate - /enroll - /enrolled - /license - /checkin - /server \ No newline at end of file From 45a543d3ed436a6830e61cbf8fb99b104fc9ecae Mon Sep 17 00:00:00 2001 From: Hasunie Date: Fri, 6 Jan 2017 18:42:24 +0530 Subject: [PATCH 34/47] getting SkippedEndpoint path from URL --- .../authenticator/framework/WebappAuthenticationValve.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/WebappAuthenticationValve.java b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/WebappAuthenticationValve.java index df15f9f1c7..36d1da87cb 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/WebappAuthenticationValve.java +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/src/main/java/org/wso2/carbon/webapp/authenticator/framework/WebappAuthenticationValve.java @@ -123,7 +123,7 @@ public class WebappAuthenticationValve extends CarbonTomcatValve { StringTokenizer tokenizer = new StringTokenizer(param, ","); nonSecuredEndpoints.put(contextPath, "true"); while (tokenizer.hasMoreTokens()) { - skippedEndPoint = contextPath + tokenizer.nextToken(); + skippedEndPoint = tokenizer.nextToken(); skippedEndPoint = skippedEndPoint.replace("\n", "").replace("\r", "").trim(); if(!skippedEndPoint.endsWith("/")) { skippedEndPoint = skippedEndPoint + "/"; From d22de197a117fda78ebc0a5abcfc824832d74fc3 Mon Sep 17 00:00:00 2001 From: madhawap Date: Fri, 6 Jan 2017 19:07:49 +0530 Subject: [PATCH 35/47] fix to WebappPublisherConfig --- .../publisher/config/WebappPublisherConfig.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/config/WebappPublisherConfig.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/config/WebappPublisherConfig.java index faf94c8191..a54d370e5c 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/config/WebappPublisherConfig.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/config/WebappPublisherConfig.java @@ -42,6 +42,7 @@ public class WebappPublisherConfig { private boolean isPublished; private boolean isEnabledUpdateApi; private Profiles profiles; + private static boolean isInitialized = false; private static WebappPublisherConfig config; @@ -52,9 +53,13 @@ public class WebappPublisherConfig { } public static WebappPublisherConfig getInstance() { - if (config == null) { - throw new InvalidConfigurationStateException("Webapp Authenticator Configuration is not " + - "initialized properly"); + if (!isInitialized) { + try { + init(); + } catch (WebappPublisherConfigurationFailedException e) { + throw new InvalidConfigurationStateException("Webapp Authenticator Configuration is not " + + "initialized properly"); + } } return config; } @@ -95,7 +100,10 @@ public class WebappPublisherConfig { this.profiles = profiles; } - public static void init() throws WebappPublisherConfigurationFailedException { + public synchronized static void init() throws WebappPublisherConfigurationFailedException { + if (isInitialized) { + return; + } try { File emailSenderConfig = new File(WEBAPP_PUBLISHER_CONFIG_PATH); Document doc = WebappPublisherUtil.convertToDocument(emailSenderConfig); @@ -105,6 +113,7 @@ public class WebappPublisherConfig { Unmarshaller unmarshaller = ctx.createUnmarshaller(); //unmarshaller.setSchema(getSchema()); config = (WebappPublisherConfig) unmarshaller.unmarshal(doc); + isInitialized = true; } catch (JAXBException e) { throw new WebappPublisherConfigurationFailedException("Error occurred while un-marshalling Webapp " + "Publisher Config", e); From a5640f48b5f6a9b202486bd020ec209927fe76a4 Mon Sep 17 00:00:00 2001 From: Joseph Fonseka Date: Fri, 6 Jan 2017 18:44:47 +0530 Subject: [PATCH 36/47] Changed auth type on API resources as configured in web.xml --- .../webapp/publisher/APIPublisherUtil.java | 29 +++++++++++++++++++ .../APIPublisherLifecycleListener.java | 1 + .../lifecycle/util/AnnotationProcessor.java | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java index a4afb01808..8ae3c531c1 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/APIPublisherUtil.java @@ -28,6 +28,7 @@ import org.wso2.carbon.apimgt.impl.utils.APIUtil; import org.wso2.carbon.apimgt.webapp.publisher.config.APIResource; import org.wso2.carbon.apimgt.webapp.publisher.config.APIResourceConfiguration; import org.wso2.carbon.apimgt.webapp.publisher.config.WebappPublisherConfig; +import org.wso2.carbon.apimgt.webapp.publisher.lifecycle.util.AnnotationProcessor; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.core.util.Utils; @@ -51,6 +52,9 @@ public class APIPublisherUtil { private static final String PARAM_SHARED_WITH_ALL_TENANTS = "isSharedWithAllTenants"; private static final String PARAM_PROVIDER_TENANT_DOMAIN = "providerTenantDomain"; + private static final String NON_SECURED_RESOURCES = "nonSecuredEndPoints"; + private static final String AUTH_TYPE_NON_SECURED = "None"; + public static API getAPI(APIConfig config) throws APIManagementException { @@ -313,4 +317,29 @@ public class APIPublisherUtil { return apiConfig; } + + public static void setResourceAuthTypes(ServletContext servletContext, APIConfig apiConfig) { + List resourcesList = null; + String nonSecuredResources = servletContext.getInitParameter(NON_SECURED_RESOURCES); + if(null != nonSecuredResources){ + resourcesList = Arrays.asList(nonSecuredResources.split(",")); + } + Set templates = apiConfig.getUriTemplates(); + if(null != resourcesList) { + for (URITemplate template : templates) { + String fullPaath = ""; + if( template.getUriTemplate() != AnnotationProcessor.WILD_CARD ) { + fullPaath = apiConfig.getContext() + template.getUriTemplate(); + } + else{ + fullPaath = apiConfig.getContext(); + } + for(String context : resourcesList) { + if (context.trim().equals(fullPaath)) { + template.setAuthType(AUTH_TYPE_NON_SECURED); + } + } + } + } + } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java index f9a28ee41d..adf73f0d17 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java @@ -69,6 +69,7 @@ public class APIPublisherLifecycleListener implements LifecycleListener { annotatedSwaggerAPIClasses); for (APIResourceConfiguration apiDefinition : apiDefinitions) { APIConfig apiConfig = APIPublisherUtil.buildApiConfig(servletContext, apiDefinition); + APIPublisherUtil.setResourceAuthTypes(servletContext,apiConfig); try { int tenantId = APIPublisherDataHolder.getInstance().getTenantManager(). getTenantId(apiConfig.getTenantDomain()); diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java index b820a4426f..c967039259 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java @@ -51,7 +51,7 @@ public class AnnotationProcessor { private static final String PACKAGE_ORG_APACHE = "org.apache"; private static final String PACKAGE_ORG_CODEHAUS = "org.codehaus"; private static final String PACKAGE_ORG_SPRINGFRAMEWORK = "org.springframework"; - private static final String WILD_CARD = "/*"; + public static final String WILD_CARD = "/*"; private static final String SWAGGER_ANNOTATIONS_INFO = "info"; private static final String SWAGGER_ANNOTATIONS_TAGS = "tags"; From d826ba81d02441bd9fda67295ec87a8f037ab962 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Fri, 6 Jan 2017 20:27:24 +0530 Subject: [PATCH 37/47] UI improvement for Datatables --- .../units/cdmf.unit.ui.theme/public/css/custom-desktop.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css index 50185517cc..b143e04d3d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css @@ -6547,7 +6547,7 @@ select > option:hover { @media (min-width: 1200px){ table tbody tr { - width: 18% !important; + width: 14% !important; } .table .fw-stack{ font-size: 1.2vw; @@ -6556,7 +6556,7 @@ select > option:hover { @media (min-width: 1500px){ table tbody tr { - width: 14% !important; + width: 10% !important; } .table .fw-stack{ font-size: 0.8vw; From b4ed33bcd0ad0f0a2339d71a619f4958cde3d40f Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Fri, 6 Jan 2017 21:44:02 +0530 Subject: [PATCH 38/47] IOTS-171 : Register form validation message corrected --- .../devicemgt/app/pages/cdmf.page.user.create/create.hbs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs index b0088ff964..3ce1a6ece4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs @@ -74,8 +74,7 @@ data-errormsg="{{usernameRegExViolationErrorMsg}}" class="form-control"/> + Username should be at least 3 characters long with no white spaces.
From ebdba19041023b127c2f642b16350ebbfaffecc0 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Sat, 7 Jan 2017 08:04:48 +0530 Subject: [PATCH 39/47] IOTS-120 : Fixing firstName and lastName cannot contain whitespaces --- .../resources/jaggeryapps/devicemgt/app/conf/config.json | 4 ++-- .../devicemgt/app/pages/cdmf.page.register/register.hbs | 6 +++--- 2 files changed, 5 insertions(+), 5 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 442d77d41b..8b923a9b82 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 @@ -35,9 +35,9 @@ "usernameJSRegEx" : "^[\\S]{3,30}$", "usernameRegExViolationErrorMsg" : "Provided username is invalid.", "usernameHelpMsg" : "Should be in minimum 3 characters long and do not include any whitespaces.", - "firstnameJSRegEx" : "^[\\S]{3,30}$", + "firstnameJSRegEx" : "^.{3,30}$", "firstnameRegExViolationErrorMsg" : "Provided first name is invalid.", - "lastnameJSRegEx" : "^[\\S]{3,30}$", + "lastnameJSRegEx" : "^.{3,30}$", "lastnameRegExViolationErrorMsg" : "Provided last name is invalid.", "emailJSRegEx" : "/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/", "emailRegExViolationErrorMsg" : "Provided email is invalid." diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.hbs index 5544708f93..d105c30ec2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.register/register.hbs @@ -25,14 +25,14 @@
+ data-regex="{{firstnameJSRegEx}}" data-lengthmsg="{{usernameHelpText}}" + data-errormsg="{{firstnameRegExViolationErrorMsg}}"/>
+ data-regex="{{lastnameJSRegEx}}" data-errormsg="{{lastnameRegExViolationErrorMsg}}"/>
From c2490347b6ee7a74b51e4bd93c4ccf3df87f8e62 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Sat, 7 Jan 2017 10:25:32 +0530 Subject: [PATCH 40/47] Corrected a typo --- .../invoker/RESTConstants.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTConstants.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTConstants.java index c1d0413a70..122f4cfda2 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTConstants.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTConstants.java @@ -21,6 +21,6 @@ public class RESTConstants { static String REST_CLIENT_CONFIG_ELEMENT = "restClientConfiguration"; static String REST_CLIENT_MAX_TOTAL_CONNECTIONS = "maxTotalConnections"; static String REST_CLIENT_MAX_CONNECTIONS_PER_ROUTE = "maxConnectionsPerRoute"; - static String REST_CLEINT_CONNECTION_TIMEOUT = "connectionTimeout"; - static String REST_CLEINT_SOCKET_TIMEOUT = "socketTimeout"; + static String REST_CLIENT_CONNECTION_TIMEOUT = "connectionTimeout"; + static String REST_CLIENT_SOCKET_TIMEOUT = "socketTimeout"; } From a16052431c91a8e4750f962dfc5e1bf54cb30f36 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Sat, 7 Jan 2017 10:26:35 +0530 Subject: [PATCH 41/47] Corrected a typo on [APIMCertificateMGTException] --- ....java => APIMCertificateMGTException.java} | 12 +++++----- .../AuthenticationHandler.java | 2 +- .../utils/Utils.java | 24 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/{APIMCertificateMGTExcepton.java => APIMCertificateMGTException.java} (77%) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTExcepton.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTException.java similarity index 77% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTExcepton.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTException.java index 9b11ab7faf..527a0b866d 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTExcepton.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTException.java @@ -19,7 +19,7 @@ package org.wso2.carbon.apimgt.handlers; -public class APIMCertificateMGTExcepton extends Exception{ +public class APIMCertificateMGTException extends Exception{ private static final long serialVersionUID = -37676242646464497L; @@ -33,26 +33,26 @@ public class APIMCertificateMGTExcepton extends Exception{ this.errorMessage = errorMessage; } - public APIMCertificateMGTExcepton(String msg, Exception nestedEx) { + public APIMCertificateMGTException(String msg, Exception nestedEx) { super(msg, nestedEx); setErrorMessage(msg); } - public APIMCertificateMGTExcepton(String message, Throwable cause) { + public APIMCertificateMGTException(String message, Throwable cause) { super(message, cause); setErrorMessage(message); } - public APIMCertificateMGTExcepton(String msg) { + public APIMCertificateMGTException(String msg) { super(msg); setErrorMessage(msg); } - public APIMCertificateMGTExcepton() { + public APIMCertificateMGTException() { super(); } - public APIMCertificateMGTExcepton(Throwable cause) { + public APIMCertificateMGTException(Throwable cause) { super(cause); } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java index 1d4282f1a5..47b7a1e981 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java @@ -167,7 +167,7 @@ public class AuthenticationHandler extends AbstractHandler { } catch (URISyntaxException e) { log.error("Error while processing certificate.", e); return false; - } catch (APIMCertificateMGTExcepton e) { + } catch (APIMCertificateMGTException e) { log.error("Error while processing certificate.", e); return false; } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java index 416ae306ae..6e189756de 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java @@ -26,7 +26,7 @@ import org.apache.ws.security.util.Base64; import org.json.JSONException; import org.json.JSONObject; import org.w3c.dom.Document; -import org.wso2.carbon.apimgt.handlers.APIMCertificateMGTExcepton; +import org.wso2.carbon.apimgt.handlers.APIMCertificateMGTException; import org.wso2.carbon.apimgt.handlers.beans.DCR; import org.wso2.carbon.apimgt.handlers.config.IOTServerConfiguration; import org.wso2.carbon.apimgt.handlers.invoker.RESTInvoker; @@ -65,13 +65,13 @@ public class Utils { Unmarshaller unmarshaller = fileContext.createUnmarshaller(); return (IOTServerConfiguration) unmarshaller.unmarshal(doc); - } catch (JAXBException | APIMCertificateMGTExcepton e) { + } catch (JAXBException | APIMCertificateMGTException e) { log.error("Error occurred while initializing Data Source config", e); return null; } } - public static Document convertToDocument(File file) throws APIMCertificateMGTExcepton { + public static Document convertToDocument(File file) throws APIMCertificateMGTException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { @@ -79,13 +79,13 @@ public class Utils { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); return docBuilder.parse(file); } catch (Exception e) { - throw new APIMCertificateMGTExcepton("Error occurred while parsing file, while converting " + + throw new APIMCertificateMGTException("Error occurred while parsing file, while converting " + "to a org.w3c.dom.Document", e); } } public static String getAccessToken(IOTServerConfiguration iotServerConfiguration) - throws APIMCertificateMGTExcepton { + throws APIMCertificateMGTException { try { if (clientId == null || clientSecret == null) { getClientSecretes(iotServerConfiguration); @@ -109,16 +109,16 @@ public class Utils { return accessToken; } catch (URISyntaxException e) { - throw new APIMCertificateMGTExcepton("Error occurred while trying to call oauth token endpoint", e); + throw new APIMCertificateMGTException("Error occurred while trying to call oauth token endpoint", e); } catch (JSONException e) { - throw new APIMCertificateMGTExcepton("Error occurred while converting the json to object", e); + throw new APIMCertificateMGTException("Error occurred while converting the json to object", e); } catch (IOException e) { - throw new APIMCertificateMGTExcepton("Error occurred while trying to call oauth token endpoint", e); + throw new APIMCertificateMGTException("Error occurred while trying to call oauth token endpoint", e); } } private static void getClientSecretes(IOTServerConfiguration iotServerConfiguration) - throws APIMCertificateMGTExcepton { + throws APIMCertificateMGTException { try { DCR dcr = new DCR(); dcr.setOwner(iotServerConfiguration.getUsername()); @@ -141,11 +141,11 @@ public class Utils { clientId = jsonResponse.getString("client_id"); clientSecret = jsonResponse.getString("client_secret"); } catch (JSONException e) { - throw new APIMCertificateMGTExcepton("Error occurred while converting the json to object", e); + throw new APIMCertificateMGTException("Error occurred while converting the json to object", e); } catch (IOException e) { - throw new APIMCertificateMGTExcepton("Error occurred while trying to call DCR endpoint", e); + throw new APIMCertificateMGTException("Error occurred while trying to call DCR endpoint", e); } catch (URISyntaxException e) { - throw new APIMCertificateMGTExcepton("Error occurred while trying to call DCR endpoint", e); + throw new APIMCertificateMGTException("Error occurred while trying to call DCR endpoint", e); } } From 08ab946e88d9a6f60bbac4740e3ddf7a5cc41706 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Sat, 7 Jan 2017 10:28:25 +0530 Subject: [PATCH 42/47] Added doc comments --- .../org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java | 3 +++ .../main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java index 47b7a1e981..5587d081e8 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java @@ -39,6 +39,9 @@ import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; +/** + * Synapse gateway handler for API authentication + */ public class AuthenticationHandler extends AbstractHandler { private static final Log log = LogFactory.getLog(AuthenticationHandler.class); private static HandlerDescription EMPTY_HANDLER_METADATA = new HandlerDescription("API Security Handler"); diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java index 6e189756de..4381243834 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java @@ -46,6 +46,9 @@ import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; +/** + * Contains util methods for synapse gateway authentication handler + */ public class Utils { private static final Log log = LogFactory.getLog(Utils.class); From 2881079b27b6de5245b5ed93b69501734ec47262 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Sat, 7 Jan 2017 11:06:48 +0530 Subject: [PATCH 43/47] Removing two unnecessary classes from the project and adding java documentation to class --- .../APIMCertificateMGTException.java | 3 + .../AuthenticationHandler.java | 7 +- .../beans/Certificate.java | 6 + .../beans/DCR.java | 7 + .../beans/ValidationResponce.java | 3 + .../config/IOTServerConfiguration.java | 4 + .../invoker/RESTConstants.java | 26 --- .../invoker/RESTInvoker.java | 73 +------- .../utils/AuthConstants.java | 27 +-- .../utils/CoreUtils.java | 156 ------------------ .../utils/Utils.java | 21 +++ 11 files changed, 66 insertions(+), 267 deletions(-) delete mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTConstants.java delete mode 100644 components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTException.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTException.java index 527a0b866d..7c7b317537 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTException.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTException.java @@ -19,6 +19,9 @@ package org.wso2.carbon.apimgt.handlers; +/** + * Error handling class for the apimgt handler. + */ public class APIMCertificateMGTException extends Exception{ private static final long serialVersionUID = -37676242646464497L; diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java index 5587d081e8..087adce638 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java @@ -40,7 +40,7 @@ import java.util.HashMap; import java.util.Map; /** - * Synapse gateway handler for API authentication + * Synapse gateway handler for API authentication. */ public class AuthenticationHandler extends AbstractHandler { private static final Log log = LogFactory.getLog(AuthenticationHandler.class); @@ -60,6 +60,11 @@ public class AuthenticationHandler extends AbstractHandler { this.iotServerConfiguration = Utils.initConfig(); } + /** + * Handling the message and checking the security. + * @param messageContext + * @return + */ @Override public boolean handleRequest(org.apache.synapse.MessageContext messageContext) { org.apache.axis2.context.MessageContext axisMC = ((Axis2MessageContext) messageContext).getAxis2MessageContext(); diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/Certificate.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/Certificate.java index 3f0b65f0ae..b3389a82c5 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/Certificate.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/Certificate.java @@ -19,10 +19,16 @@ package org.wso2.carbon.apimgt.handlers.beans; +/** + * This class keeps the certificate data. + */ public class Certificate { + // public key of the certificate private String pem; + // Tenant id private int tenantId; + // Serial of the certificate. private String serial; public String getPem() { diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/DCR.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/DCR.java index 88ae6de8ce..4091afcb9e 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/DCR.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/DCR.java @@ -19,11 +19,18 @@ package org.wso2.carbon.apimgt.handlers.beans; +/** + * This class holds the DCR endpoints data to create an application. + */ public class DCR { + // Owner of the application private String owner; + // Client name private String clientName; + // Oauth Grant type private String grantType; + // Scope of the token private String tokenScope; public String getOwner() { diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/ValidationResponce.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/ValidationResponce.java index 5d698fb5a3..b9b385e2f3 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/ValidationResponce.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/ValidationResponce.java @@ -19,6 +19,9 @@ package org.wso2.carbon.apimgt.handlers.beans; +/** + * This class holds the data returned from the backend after the certificate was authenticated. + */ public class ValidationResponce { private String JWTToken; // X-JWT-Assertion diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/config/IOTServerConfiguration.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/config/IOTServerConfiguration.java index 71b430ff40..3beecf11f0 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/config/IOTServerConfiguration.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/config/IOTServerConfiguration.java @@ -25,6 +25,10 @@ import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlValue; import java.util.List; +/** + * This class initialize the iot-api-config.xml and hold the values, in order to be read from the relevant classes. This + * get initialized at the start of the server when apis get loaded. + */ @XmlRootElement(name = "ServerConfiguration") public class IOTServerConfiguration { diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTConstants.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTConstants.java deleted file mode 100644 index 122f4cfda2..0000000000 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTConstants.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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 org.wso2.carbon.apimgt.handlers.invoker; - -public class RESTConstants { - static String REST_CLIENT_CONFIG_ELEMENT = "restClientConfiguration"; - static String REST_CLIENT_MAX_TOTAL_CONNECTIONS = "maxTotalConnections"; - static String REST_CLIENT_MAX_CONNECTIONS_PER_ROUTE = "maxConnectionsPerRoute"; - static String REST_CLIENT_CONNECTION_TIMEOUT = "connectionTimeout"; - static String REST_CLIENT_SOCKET_TIMEOUT = "socketTimeout"; -} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTInvoker.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTInvoker.java index 95b4fdecca..107d754ff4 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTInvoker.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTInvoker.java @@ -17,10 +17,7 @@ */ package org.wso2.carbon.apimgt.handlers.invoker; -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.util.AXIOMUtil; import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -32,17 +29,10 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.util.EntityUtils; -import org.wso2.carbon.apimgt.handlers.utils.AuthConstants; -import org.wso2.carbon.apimgt.handlers.utils.CoreUtils; -import org.wso2.carbon.utils.CarbonUtils; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import java.io.File; import java.io.IOException; import java.net.URI; import java.nio.charset.StandardCharsets; -import java.util.Iterator; import java.util.Map; public class RESTInvoker { @@ -61,65 +51,8 @@ public class RESTInvoker { configureHttpClient(); } -// private void parseConfiguration() { -// String carbonConfigDirPath = CarbonUtils.getCarbonConfigDirPath(); -// String apiFilterConfigPath = carbonConfigDirPath + File.separator + -// AuthConstants.AUTH_CONFIGURATION_FILE_NAME; -// File configFile = new File(apiFilterConfigPath); -// -// try { -// String configContent = FileUtils.readFileToString(configFile); -// OMElement configElement = AXIOMUtil.stringToOM(configContent); -// Iterator beans = configElement.getChildrenWithName( -// new QName("http://www.springframework.org/schema/beans", "bean")); -// -// while (beans.hasNext()) { -// OMElement bean = (OMElement) beans.next(); -// String beanId = bean.getAttributeValue(new QName(null, "id")); -// if (beanId.equals(RESTConstants.REST_CLIENT_CONFIG_ELEMENT)) { -// Iterator beanProps = bean.getChildrenWithName( -// new QName("http://www.springframework.org/schema/beans", "property")); -// -// while (beanProps.hasNext()) { -// OMElement beanProp = (OMElement) beanProps.next(); -// String beanName = beanProp.getAttributeValue(new QName(null, "name")); -// if (RESTConstants.REST_CLIENT_MAX_TOTAL_CONNECTIONS.equals(beanName)) { -// String value = beanProp.getAttributeValue(new QName(null, "value")); -// if (value != null && !value.trim().equals("")) { -// maxTotalConnections = Integer.parseInt(value); -// } -// CoreUtils.debugLog(log, "Max total http connections ", maxTotalConnections); -// } else if (RESTConstants.REST_CLIENT_MAX_CONNECTIONS_PER_ROUTE.equals(beanName)) { -// String value = beanProp.getAttributeValue(new QName(null, "value")); -// if (value != null && !value.trim().equals("")) { -// maxTotalConnectionsPerRoute = Integer.parseInt(value); -// } -// CoreUtils.debugLog(log, "Max total client connections per route ", maxTotalConnectionsPerRoute); -// } else if (RESTConstants.REST_CLEINT_CONNECTION_TIMEOUT.equals(beanName)) { -// String value = beanProp.getAttributeValue(new QName(null, "value")); -// if (value != null && !value.trim().equals("")) { -// connectionTimeout = Integer.parseInt(value); -// } -// } else if (RESTConstants.REST_CLEINT_SOCKET_TIMEOUT.equals(beanName)) { -// String value = beanProp.getAttributeValue(new QName(null, "value")); -// if (value != null && !value.trim().equals("")) { -// socketTimeout = Integer.parseInt(value); -// } -// } -// } -// } -// } -// } catch (XMLStreamException e) { -// log.error("Error in processing http connection settings, using default settings", e); -// } catch (IOException e) { -// log.error("Error in processing http connection settings, using default settings", e); -// } -// } - private void configureHttpClient() { -// parseConfiguration(); - RequestConfig defaultRequestConfig = RequestConfig.custom() .setExpectContinueEnabled(true) .setConnectTimeout(connectionTimeout) @@ -140,11 +73,7 @@ public class RESTInvoker { "maxConnectionsPerRoute = " + maxTotalConnectionsPerRoute + "connectionTimeout = " + connectionTimeout); } -// -// CoreUtils.debugLog(log, "REST client initialized with ", -// "maxTotalConnection = ", maxTotalConnections, -// "maxConnectionsPerRoute = ", maxTotalConnectionsPerRoute, -// "connectionTimeout = ", connectionTimeout); + } public void closeHttpClient() { diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java index 03a8780efc..531c7c11d5 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java @@ -17,19 +17,22 @@ */ package org.wso2.carbon.apimgt.handlers.utils; +/** + * This initializes the constance. + */ public class AuthConstants { - public static final String SEC_FAULT = "SECURITY_VALIDATION_FAILURE"; - public static final String HTTPS = "https"; - public static final String WSSE = "wsse"; - public static final String AUTH_CONFIGURATION_FILE_NAME = "api-filter-config.xml"; - public static final String API_FILTER_CONFIG_ELEMENT = "apiFilterConfig"; - public static final String API_LIST_PROPERTY = "apiList"; - public static final String HOST = "host"; - public static final String HTTPS_PORT = "httpsPort"; - public static final String USERNAME = "username"; - public static final String PASSWORD = "password"; - public static final String IOS_VERIFY_ENDPOINT = "ios-verify-endpoint"; - public static final String ANDROID_VERIFY_ENDPOINT = "android-verify-endpoint"; +// public static final String SEC_FAULT = "SECURITY_VALIDATION_FAILURE"; +// public static final String HTTPS = "https"; +// public static final String WSSE = "wsse"; +// public static final String AUTH_CONFIGURATION_FILE_NAME = "api-filter-config.xml"; +// public static final String API_FILTER_CONFIG_ELEMENT = "apiFilterConfig"; +// public static final String API_LIST_PROPERTY = "apiList"; +// public static final String HOST = "host"; +// public static final String HTTPS_PORT = "httpsPort"; +// public static final String USERNAME = "username"; +// public static final String PASSWORD = "password"; +// public static final String IOS_VERIFY_ENDPOINT = "ios-verify-endpoint"; +// public static final String ANDROID_VERIFY_ENDPOINT = "android-verify-endpoint"; public static final String MDM_SIGNATURE = "mdm-signature"; public static final String PROXY_MUTUAL_AUTH_HEADER = "proxy-mutual-auth-header"; public static final String ENCODED_PEM = "encoded-pem"; diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java deleted file mode 100644 index 605ad801e6..0000000000 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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 org.wso2.carbon.apimgt.handlers.utils; - -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.util.AXIOMUtil; -import org.apache.commons.io.FileUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.utils.CarbonUtils; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; - -public class CoreUtils { - private static final Log log = LogFactory.getLog(CoreUtils.class); - private static String host = "localhost"; - private static int httpsPort = 9443; - private static String username = "admin"; - private static String password = "admin"; - private static String iosVerifyEndpoint = "/api/certificate-mgt/v1.0/admin/certificates/verify/ios"; - private static String androidVerifyEndpoint = "/api/certificate-mgt/v1.0/admin/certificates/verify/android"; - -// /** -// * Reading configurations from api-filter-config.xml file -// * -// * @return ArrayList of api contexts -// */ -// public static ArrayList readApiFilterList() { -// ArrayList apiList = new ArrayList(); -// String carbonConfigDirPath = CarbonUtils.getCarbonConfigDirPath(); -// String apiFilterConfigPath = carbonConfigDirPath + File.separator + -// AuthConstants.AUTH_CONFIGURATION_FILE_NAME; -// File configFile = new File(apiFilterConfigPath); -// -// try { -// String configContent = FileUtils.readFileToString(configFile); -// OMElement configElement = AXIOMUtil.stringToOM(configContent); -// Iterator beans = configElement.getChildrenWithName( -// new QName("http://www.springframework.org/schema/beans", "bean")); -// -// while (beans.hasNext()) { -// OMElement bean = (OMElement) beans.next(); -// String beanId = bean.getAttributeValue(new QName(null, "id")); -// if (beanId.equals(AuthConstants.API_FILTER_CONFIG_ELEMENT)) { -// Iterator beanProps = bean.getChildrenWithName( -// new QName("http://www.springframework.org/schema/beans", "property")); -// -// while (beanProps.hasNext()) { -// OMElement beanProp = (OMElement) beanProps.next(); -// String beanName = beanProp.getAttributeValue(new QName(null, "name")); -// if (AuthConstants.API_LIST_PROPERTY.equals(beanName)) { -// Iterator apiListSet = ((OMElement) beanProp.getChildrenWithLocalName("set").next()) -// .getChildrenWithLocalName("value"); -// while (apiListSet.hasNext()) { -// String apiContext = ((OMElement) apiListSet.next()).getText(); -// apiList.add(apiContext); -// CoreUtils.debugLog(log, "Adding security to api: ", apiContext); -// } -// } else if (AuthConstants.HOST.equals(beanName)) { -// String value = beanProp.getAttributeValue(new QName(null, "value")); -// host = value; -// } else if (AuthConstants.HTTPS_PORT.equals(beanName)) { -// String value = beanProp.getAttributeValue(new QName(null, "value")); -// if (value != null && !value.trim().equals("")) { -// httpsPort = Integer.parseInt(value); -// } -// } else if (AuthConstants.USERNAME.equals(beanName)) { -// String value = beanProp.getAttributeValue(new QName(null, "value")); -// username = value; -// } else if (AuthConstants.PASSWORD.equals(beanName)) { -// String value = beanProp.getAttributeValue(new QName(null, "value")); -// password = value; -// } else if (AuthConstants.IOS_VERIFY_ENDPOINT.equals(beanName)) { -// String value = beanProp.getAttributeValue(new QName(null, "value")); -// iosVerifyEndpoint = value; -// } else if (AuthConstants.ANDROID_VERIFY_ENDPOINT.equals(beanName)) { -// String value = beanProp.getAttributeValue(new QName(null, "value")); -// androidVerifyEndpoint = value; -// } -// } -// } -// } -// } catch (IOException e) { -// log.error("Error in reading api filter settings", e); -// } catch (XMLStreamException e) { -// log.error("Error in reading api filter settings", e); -// } -// return apiList; -// } -// -// /** -// * Universal debug log function -// * -// * @param logger Log object specific to the class -// * @param message initial debug log message -// * @param vars optional strings to be appended for the log -// */ -// public static void debugLog(Log logger, String message, Object ... vars) { -// if(logger.isDebugEnabled()) { -// if (vars.length < 1) { -// logger.debug(message); -// return; -// } -// StringBuilder stringBuilder = new StringBuilder(); -// stringBuilder.append(message); -// for (Object var : vars) { -// stringBuilder.append(var.toString()); -// } -// logger.debug(stringBuilder.toString()); -// } -// } - - public static String getHost() { - return host; - } - - public static int getHttpsPort() { - return httpsPort; - } - - public static String getUsername() { - return username; - } - - public static String getPassword() { - return password; - } - - public static String getIosVerifyEndpoint() { - return iosVerifyEndpoint; - } - - public static String getAndroidVerifyEndpoint() { - return androidVerifyEndpoint; - } -} diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java index 4381243834..3e66ed7edd 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java @@ -56,6 +56,10 @@ public class Utils { private static String clientId; private static String clientSecret; + /** + * This method initializes the iot-api-config.xml file. + * @return + */ public static IOTServerConfiguration initConfig() { try { @@ -74,6 +78,12 @@ public class Utils { } } + /** + * This class build the iot-api-config.xml file. + * @param file + * @return + * @throws APIMCertificateMGTException + */ public static Document convertToDocument(File file) throws APIMCertificateMGTException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); @@ -87,6 +97,12 @@ public class Utils { } } + /** + * This class get the access token from the key manager. + * @param iotServerConfiguration + * @return + * @throws APIMCertificateMGTException + */ public static String getAccessToken(IOTServerConfiguration iotServerConfiguration) throws APIMCertificateMGTException { try { @@ -120,6 +136,11 @@ public class Utils { } } + /** + * This method register an application to get the client key and secret. + * @param iotServerConfiguration + * @throws APIMCertificateMGTException + */ private static void getClientSecretes(IOTServerConfiguration iotServerConfiguration) throws APIMCertificateMGTException { try { From 1f5de41ffaaf568944da78e161d90e1d52e382ca Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Sat, 7 Jan 2017 11:07:38 +0530 Subject: [PATCH 44/47] Fixing maven-javadoc-plugin issue [org.wso2.carbon.apimgt.handlers/] should be [org/wso2/carbon/apimgt/handlers/] --- .../wso2/carbon/apimgt/handlers}/APIMCertificateMGTException.java | 0 .../wso2/carbon/apimgt/handlers}/AuthenticationHandler.java | 0 .../wso2/carbon/apimgt/handlers}/beans/Certificate.java | 0 .../wso2/carbon/apimgt/handlers}/beans/DCR.java | 0 .../wso2/carbon/apimgt/handlers}/beans/ValidationResponce.java | 0 .../carbon/apimgt/handlers}/config/IOTServerConfiguration.java | 0 .../wso2/carbon/apimgt/handlers}/invoker/RESTConstants.java | 0 .../wso2/carbon/apimgt/handlers}/invoker/RESTInvoker.java | 0 .../wso2/carbon/apimgt/handlers}/invoker/RESTResponse.java | 0 .../wso2/carbon/apimgt/handlers}/utils/AuthConstants.java | 0 .../wso2/carbon/apimgt/handlers}/utils/CoreUtils.java | 0 .../wso2/carbon/apimgt/handlers}/utils/Utils.java | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/APIMCertificateMGTException.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/AuthenticationHandler.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/beans/Certificate.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/beans/DCR.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/beans/ValidationResponce.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/config/IOTServerConfiguration.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/invoker/RESTConstants.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/invoker/RESTInvoker.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/invoker/RESTResponse.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/utils/AuthConstants.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/utils/CoreUtils.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/utils/Utils.java (100%) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTException.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/APIMCertificateMGTException.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTException.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/APIMCertificateMGTException.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandler.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandler.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/Certificate.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/beans/Certificate.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/Certificate.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/beans/Certificate.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/DCR.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/beans/DCR.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/DCR.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/beans/DCR.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/ValidationResponce.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/beans/ValidationResponce.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/ValidationResponce.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/beans/ValidationResponce.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/config/IOTServerConfiguration.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/config/IOTServerConfiguration.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/config/IOTServerConfiguration.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/config/IOTServerConfiguration.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTConstants.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/invoker/RESTConstants.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTConstants.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/invoker/RESTConstants.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTInvoker.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/invoker/RESTInvoker.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTInvoker.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/invoker/RESTInvoker.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTResponse.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/invoker/RESTResponse.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTResponse.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/invoker/RESTResponse.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/AuthConstants.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/AuthConstants.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/CoreUtils.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/CoreUtils.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/CoreUtils.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/Utils.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/Utils.java From 7059ad1243cf1eb4901b71868bc2d60584e2f993 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Sat, 7 Jan 2017 11:21:50 +0530 Subject: [PATCH 45/47] Changing the package name --- .../wso2/carbon/apimgt/handlers}/APIMCertificateMGTException.java | 0 .../wso2/carbon/apimgt/handlers}/AuthenticationHandler.java | 0 .../wso2/carbon/apimgt/handlers}/beans/Certificate.java | 0 .../wso2/carbon/apimgt/handlers}/beans/DCR.java | 0 .../wso2/carbon/apimgt/handlers}/beans/ValidationResponce.java | 0 .../carbon/apimgt/handlers}/config/IOTServerConfiguration.java | 0 .../wso2/carbon/apimgt/handlers}/invoker/RESTInvoker.java | 0 .../wso2/carbon/apimgt/handlers}/invoker/RESTResponse.java | 0 .../wso2/carbon/apimgt/handlers}/utils/AuthConstants.java | 0 .../wso2/carbon/apimgt/handlers}/utils/Utils.java | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/APIMCertificateMGTException.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/AuthenticationHandler.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/beans/Certificate.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/beans/DCR.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/beans/ValidationResponce.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/config/IOTServerConfiguration.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/invoker/RESTInvoker.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/invoker/RESTResponse.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/utils/AuthConstants.java (100%) rename components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/{org.wso2.carbon.apimgt.handlers => org/wso2/carbon/apimgt/handlers}/utils/Utils.java (100%) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTException.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/APIMCertificateMGTException.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/APIMCertificateMGTException.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/APIMCertificateMGTException.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandler.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/AuthenticationHandler.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/AuthenticationHandler.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/Certificate.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/beans/Certificate.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/Certificate.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/beans/Certificate.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/DCR.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/beans/DCR.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/DCR.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/beans/DCR.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/ValidationResponce.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/beans/ValidationResponce.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/beans/ValidationResponce.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/beans/ValidationResponce.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/config/IOTServerConfiguration.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/config/IOTServerConfiguration.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/config/IOTServerConfiguration.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/config/IOTServerConfiguration.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTInvoker.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/invoker/RESTInvoker.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTInvoker.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/invoker/RESTInvoker.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTResponse.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/invoker/RESTResponse.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/invoker/RESTResponse.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/invoker/RESTResponse.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/AuthConstants.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/AuthConstants.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/AuthConstants.java diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/Utils.java similarity index 100% rename from components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org.wso2.carbon.apimgt.handlers/utils/Utils.java rename to components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/src/main/java/org/wso2/carbon/apimgt/handlers/utils/Utils.java From 3ea83b925a35f72cf0f61cc4186b621568ea3876 Mon Sep 17 00:00:00 2001 From: WSO2 Builder Date: Sat, 7 Jan 2017 07:33:45 +0000 Subject: [PATCH 46/47] [maven-release-plugin] prepare release v2.0.6 --- .../org.wso2.carbon.apimgt.annotations/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../org.wso2.carbon.apimgt.application.extension/pom.xml | 4 ++-- .../org.wso2.carbon.apimgt.handlers/pom.xml | 8 +++----- .../org.wso2.carbon.apimgt.webapp.publisher/pom.xml | 4 ++-- components/apimgt-extensions/pom.xml | 4 ++-- .../org.wso2.carbon.certificate.mgt.api/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.certificate.mgt.core/pom.xml | 4 ++-- components/certificate-mgt/pom.xml | 4 ++-- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/device-mgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../device-mgt/org.wso2.carbon.device.mgt.api/pom.xml | 2 +- .../device-mgt/org.wso2.carbon.device.mgt.common/pom.xml | 2 +- .../device-mgt/org.wso2.carbon.device.mgt.core/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.extensions/pom.xml | 2 +- .../device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.url.printer/pom.xml | 2 +- components/device-mgt/pom.xml | 2 +- .../org.wso2.carbon.email.sender.core/pom.xml | 2 +- components/email-sender/pom.xml | 2 +- .../dynamic-client-web-proxy/pom.xml | 2 +- .../dynamic-client-web/pom.xml | 2 +- .../org.wso2.carbon.dynamic.client.registration/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../dynamic-client-registration/pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.oauth.extensions/pom.xml | 4 ++-- .../pom.xml | 2 +- .../org.wso2.carbon.identity.jwt.client.extension/pom.xml | 2 +- components/identity-extensions/pom.xml | 2 +- .../org.wso2.carbon.complex.policy.decision.point/pom.xml | 4 ++-- .../org.wso2.carbon.policy.decision.point/pom.xml | 4 ++-- .../org.wso2.carbon.policy.information.point/pom.xml | 4 ++-- .../policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml | 4 ++-- .../policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml | 4 ++-- components/policy-mgt/pom.xml | 4 ++-- .../pom.xml | 7 +++---- components/webapp-authenticator-framework/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../org.wso2.carbon.apimgt.handler.server.feature/pom.xml | 4 ++-- .../pom.xml | 4 ++-- features/apimgt-extensions/pom.xml | 4 ++-- .../org.wso2.carbon.certificate.mgt.api.feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 4 ++-- features/certificate-mgt/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- features/device-mgt-extensions/pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.api.feature/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.extensions.feature/pom.xml | 4 ++-- .../device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.server.feature/pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.ui.feature/pom.xml | 2 +- features/device-mgt/pom.xml | 2 +- .../pom.xml | 4 ++-- features/dynamic-client-registration/pom.xml | 4 ++-- .../org.wso2.carbon.email.sender.feature/pom.xml | 4 ++-- features/email-sender/pom.xml | 4 ++-- .../pom.xml | 4 ++-- features/jwt-client/pom.xml | 4 ++-- .../pom.xml | 4 ++-- features/oauth-extensions/pom.xml | 4 ++-- .../org.wso2.carbon.policy.mgt.server.feature/pom.xml | 4 ++-- features/policy-mgt/pom.xml | 4 ++-- .../pom.xml | 4 ++-- features/webapp-authenticator-framework/pom.xml | 4 ++-- pom.xml | 6 +++--- 77 files changed, 127 insertions(+), 130 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml index e2213aee9a..8515ad6fe4 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.apimgt.annotations - 2.0.6-SNAPSHOT + 2.0.6 bundle WSO2 Carbon - API Management Annotations WSO2 Carbon - API Management Custom Annotation Module diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml index 5faf10c78c..f95c675fbe 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml @@ -21,12 +21,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 - 2.0.6-SNAPSHOT + 2.0.6 org.wso2.carbon.apimgt.application.extension.api war WSO2 Carbon - API Application Management API diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml index d21f4f2094..f6a3be4e11 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml @@ -22,12 +22,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 - 2.0.6-SNAPSHOT + 2.0.6 org.wso2.carbon.apimgt.application.extension bundle WSO2 Carbon - API Application Management diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml index e707cbc5f3..098f24b622 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml @@ -17,19 +17,17 @@ ~ under the License. --> - + apimgt-extensions org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handlers - 2.0.6-SNAPSHOT + 2.0.6 bundle WSO2 Carbon - API Security Handler Component WSO2 Carbon - API Management Security Handler Module 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 a76baa3d88..1696e39ec6 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 @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher - 2.0.6-SNAPSHOT + 2.0.6 bundle WSO2 Carbon - API Management Webapp Publisher WSO2 Carbon - API Management Webapp Publisher diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index b0ef6f0a7b..0abe1a3b21 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml 4.0.0 apimgt-extensions - 2.0.6-SNAPSHOT + 2.0.6 pom WSO2 Carbon - API Management Extensions Component http://wso2.org diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml index c5694a53fb..d4b64bd64f 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml index 4c572152a9..b4ed7ec7af 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml index ff4d481e49..80f087e4a9 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml @@ -21,13 +21,13 @@ org.wso2.carbon.devicemgt certificate-mgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.core - 2.0.6-SNAPSHOT + 2.0.6 bundle WSO2 Carbon - Certificate Management Core WSO2 Carbon - Certificate Management Core diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index 8b33754ea4..09cd73b3e1 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt - 2.0.6-SNAPSHOT + 2.0.6 pom WSO2 Carbon - Certificate Management Component http://wso2.org diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml index 7a12b14cca..d4c9c22893 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm/pom.xml index 575df963d7..8b9e186de5 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 3790a86283..3337b87221 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index 5844654123..2098416613 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index c179254254..2201946859 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml index 7f7ae68e73..234cd71b99 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.devicemgt device-mgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml index 0fa4b4af48..e9fe9a3bf3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml index 752fe82878..b9b05c2a9d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml index a5a0668e46..6c86a59c3f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml @@ -21,7 +21,7 @@ device-mgt org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml index 432dc99b04..ecec8211e7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml index e81d2eb6c0..95aa91b3c9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml index 18e51b934e..0d86e17f4f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml index 28fa84cd99..400c07d0ce 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml @@ -23,7 +23,7 @@ device-mgt org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index eb64dd33ab..dc350724a2 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml diff --git a/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml b/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml index f0f04107a1..1ed8809cf0 100644 --- a/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml +++ b/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt email-sender - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/email-sender/pom.xml b/components/email-sender/pom.xml index 6a3f4ad6c6..ef63511f44 100644 --- a/components/email-sender/pom.xml +++ b/components/email-sender/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml index 190b7ee1ac..88c9b585b4 100644 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml @@ -21,7 +21,7 @@ dynamic-client-registration org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml index fea8826017..f028d1bf21 100644 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml @@ -21,7 +21,7 @@ dynamic-client-registration org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml index 06ba283548..b73c277246 100644 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml @@ -21,13 +21,13 @@ dynamic-client-registration org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.dynamic.client.registration - 2.0.6-SNAPSHOT + 2.0.6 bundle WSO2 Carbon - Dynamic client registration service WSO2 Carbon - Dynamic Client Registration Service diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml index 1ef883b6b3..d7b84ffc1a 100644 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml @@ -21,13 +21,13 @@ dynamic-client-registration org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.dynamic.client.web.app.registration - 2.0.6-SNAPSHOT + 2.0.6 bundle WSO2 Carbon - Dynamic client web app registration WSO2 Carbon - Dynamic Client Web-app Registration Service diff --git a/components/identity-extensions/dynamic-client-registration/pom.xml b/components/identity-extensions/dynamic-client-registration/pom.xml index 5f86af9fe7..891bd55a98 100644 --- a/components/identity-extensions/dynamic-client-registration/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt identity-extensions - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.devicemgt dynamic-client-registration - 2.0.6-SNAPSHOT + 2.0.6 pom WSO2 Carbon - Dynamic client registration http://wso2.org diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml index 5b2b41ea75..92b4210f54 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt identity-extensions - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions - 2.0.6-SNAPSHOT + 2.0.6 bundle WSO2 Carbon - OAuth Extensions http://wso2.org diff --git a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml index a85e106cff..6632bf52d4 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml @@ -21,7 +21,7 @@ identity-extensions org.wso2.carbon.devicemgt - 2.0.6-SNAPSHOT + 2.0.6 4.0.0 diff --git a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml index e706f0855d..ebdcd06e51 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt identity-extensions - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index e57c66b933..d05d7e04e1 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml diff --git a/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml index acadad1c1e..69fd6cb308 100644 --- a/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.complex.policy.decision.point - 2.0.6-SNAPSHOT + 2.0.6 bundle WSO2 Carbon - Policy Decision Point WSO2 Carbon - Policy Decision Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml index 9e4b872c58..239e28c8ba 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml @@ -3,14 +3,14 @@ org.wso2.carbon.devicemgt policy-mgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.decision.point - 2.0.6-SNAPSHOT + 2.0.6 bundle WSO2 Carbon - Policy Decision Point WSO2 Carbon - Policy Decision Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml index cb47259419..3631862026 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.devicemgt policy-mgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml @@ -11,7 +11,7 @@ 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.information.point - 2.0.6-SNAPSHOT + 2.0.6 bundle WSO2 Carbon - Policy Information Point WSO2 Carbon - Policy Information Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml index b34da48311..a5dd44f08b 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.common - 2.0.6-SNAPSHOT + 2.0.6 bundle WSO2 Carbon - Policy Management Common WSO2 Carbon - Policy Management Common diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml index 10d2b6f582..53679ba2fc 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.core - 2.0.6-SNAPSHOT + 2.0.6 bundle WSO2 Carbon - Policy Management Core WSO2 Carbon - Policy Management Core diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index 6fa7ee7d96..d542d7a845 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml 4.0.0 policy-mgt - 2.0.6-SNAPSHOT + 2.0.6 pom WSO2 Carbon - Policy Management Component http://wso2.org diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml index 4d3056bf11..fe7ee64d74 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml @@ -17,19 +17,18 @@ ~ under the License. --> - + org.wso2.carbon.devicemgt webapp-authenticator-framework - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.webapp.authenticator.framework - 2.0.6-SNAPSHOT + 2.0.6 bundle WSO2 Carbon - Web Application Authenticator Framework Bundle WSO2 Carbon - Web Application Authenticator Framework Bundle diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml index 69234fe0b9..79724cc520 100644 --- a/components/webapp-authenticator-framework/pom.xml +++ b/components/webapp-authenticator-framework/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework - 2.0.6-SNAPSHOT + 2.0.6 pom WSO2 Carbon - Webapp Authenticator Framework http://wso2.org diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml index ad7a5d30dc..c4eadaec2a 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.apimgt.application.extension.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - API Management Application Extension Feature http://wso2.org This feature contains an implementation of a api application registration, which takes care of subscription diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml index fceb11b4e1..0167030716 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handler.server.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - Device Management - APIM handler Server Feature http://wso2.org This feature contains the handler for the api authentications 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 41949ab360..942f1d7ff3 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 @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - API Management Webapp Publisher Feature http://wso2.org This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index b3d333709f..b8379e67e7 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt apimgt-extensions-feature - 2.0.6-SNAPSHOT + 2.0.6 pom WSO2 Carbon - API Management Extensions Feature http://wso2.org diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml index 9072e46113..f62219399c 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml index 84a8e422c7..a08024cc2b 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml index 065d8ce628..993d3b5c1b 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.server.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - Certificate Management Server Feature http://wso2.org This feature contains the core bundles required for back-end Certificate Management functionality diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml index c716c83f5f..3ef03a45ee 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt-feature - 2.0.6-SNAPSHOT + 2.0.6 pom WSO2 Carbon - Certificate Management Feature http://wso2.org diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml index af57c72366..07f71e7ac5 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - Device Type Deployer Feature http://wso2.org WSO2 Carbon - Device Type Deployer Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.feature/pom.xml index 9663256166..227a2d19e7 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - GCM Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index 6dbfef8902..b64bb316a6 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - MQTT Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml index 9799943435..390279025c 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - XMPP Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - XMPP Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml index 09badc3b8b..46c5b626ce 100644 --- a/features/device-mgt-extensions/pom.xml +++ b/features/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml index d17b661a7f..08696c2fe0 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml @@ -3,13 +3,13 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.analytics.dashboard.feature - 2.0.6-SNAPSHOT + 2.0.6 pom WSO2 Carbon - Device Management Dashboard Analytics Feature WSO2 Carbon - Device Management Dashboard Analytics Feature diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml index 39adc92b95..8c33892f51 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.analytics.data.publisher.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - Device Management Server Feature http://wso2.org This feature contains bundles related to device analytics data publisher diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml index a3a9fbe88c..6c2c33e50b 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml index 6b9ecf2710..718fda41f2 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml @@ -4,14 +4,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - Device Management Extensions Feature http://wso2.org This feature contains common extensions used by key device management functionalities diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml index 079daba653..b882cd9c1a 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml index 70f3860850..5fdc505ea8 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.server.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - Device Management Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml index 9a9b22c3ca..e9c8e88ed4 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 5d7aaf5509..1a6b462106 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml diff --git a/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml b/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml index 336303d3bb..0bf2d7340e 100644 --- a/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml +++ b/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt dynamic-client-registration-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.dynamic.client.registration.server.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - Dynamic Client Registration Server Feature http://wso2.org This feature contains dynamic client registration features diff --git a/features/dynamic-client-registration/pom.xml b/features/dynamic-client-registration/pom.xml index befc73b0df..94327e4ffb 100644 --- a/features/dynamic-client-registration/pom.xml +++ b/features/dynamic-client-registration/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt dynamic-client-registration-feature - 2.0.6-SNAPSHOT + 2.0.6 pom WSO2 Carbon - Dynamic Client Registration Feature http://wso2.org diff --git a/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml b/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml index 9cedfd95a7..5b8638e958 100644 --- a/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml +++ b/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt email-sender-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.email.sender.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - Email Sender Feature http://wso2.org This feature contains the core bundles required for email sender related functionality diff --git a/features/email-sender/pom.xml b/features/email-sender/pom.xml index 98c76014e2..940e9ec3b8 100644 --- a/features/email-sender/pom.xml +++ b/features/email-sender/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt email-sender-feature - 2.0.6-SNAPSHOT + 2.0.6 pom WSO2 Carbon - Email Sender Feature http://wso2.org diff --git a/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml index 5980cdab26..ce23027f78 100644 --- a/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml +++ b/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt jwt-client-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.identity.jwt.client.extension.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - JWT Client Feature http://wso2.org This feature contains jwt client implementation from which we can get a access token using the jwt diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml index 90a0bde13c..f40a502bfc 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml 4.0.0 jwt-client-feature - 2.0.6-SNAPSHOT + 2.0.6 pom WSO2 Carbon - Dynamic Client Registration Feature http://wso2.org diff --git a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml index 6d19f436ef..8faac94f58 100644 --- a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml +++ b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt oauth-extensions-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - Device Mgt OAuth Extensions Feature http://wso2.org This feature contains devicemgt related OAuth extensions diff --git a/features/oauth-extensions/pom.xml b/features/oauth-extensions/pom.xml index 45bc5cc987..216b3e4d66 100644 --- a/features/oauth-extensions/pom.xml +++ b/features/oauth-extensions/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt oauth-extensions-feature - 2.0.6-SNAPSHOT + 2.0.6 pom WSO2 Carbon - Device Management OAuth Extensions Feature http://wso2.org diff --git a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml index 9851283ca8..d6e4dca54b 100644 --- a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt policy-mgt-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.policy.mgt.server.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - Policy Management Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml index 4e3f70a39c..1c0451b765 100644 --- a/features/policy-mgt/pom.xml +++ b/features/policy-mgt/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt policy-mgt-feature - 2.0.6-SNAPSHOT + 2.0.6 pom WSO2 Carbon - Policy Management Feature http://wso2.org diff --git a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml index c354aa3cec..50a698e27a 100644 --- a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml +++ b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt webapp-authenticator-framework-feature - 2.0.6-SNAPSHOT + 2.0.6 ../pom.xml 4.0.0 org.wso2.carbon.webapp.authenticator.framework.server.feature pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - Webapp Authenticator Framework Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml index 61c6eaea59..43c6076b48 100644 --- a/features/webapp-authenticator-framework/pom.xml +++ b/features/webapp-authenticator-framework/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6-SNAPSHOT + 2.0.6 ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework-feature - 2.0.6-SNAPSHOT + 2.0.6 pom WSO2 Carbon - Webapp Authenticator Framework Feature http://wso2.org diff --git a/pom.xml b/pom.xml index e48e296762..63c52f3575 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt pom - 2.0.6-SNAPSHOT + 2.0.6 WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components @@ -1671,7 +1671,7 @@ https://github.com/wso2/carbon-device-mgt.git scm:git:https://github.com/wso2/carbon-device-mgt.git scm:git:https://github.com/wso2/carbon-device-mgt.git - HEAD + v2.0.6 @@ -1952,7 +1952,7 @@ 1.2.11.wso2v10 - 2.0.6-SNAPSHOT + 2.0.6 4.4.8 From 5411d93103bef2184e8634dbc4ea8aadeb939c7a Mon Sep 17 00:00:00 2001 From: WSO2 Builder Date: Sat, 7 Jan 2017 07:48:36 +0000 Subject: [PATCH 47/47] [maven-release-plugin] prepare for next development iteration --- .../org.wso2.carbon.apimgt.annotations/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../org.wso2.carbon.apimgt.application.extension/pom.xml | 4 ++-- .../org.wso2.carbon.apimgt.handlers/pom.xml | 4 ++-- .../org.wso2.carbon.apimgt.webapp.publisher/pom.xml | 4 ++-- components/apimgt-extensions/pom.xml | 4 ++-- .../org.wso2.carbon.certificate.mgt.api/pom.xml | 2 +- .../org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml | 2 +- .../org.wso2.carbon.certificate.mgt.core/pom.xml | 4 ++-- components/certificate-mgt/pom.xml | 4 ++-- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/device-mgt-extensions/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml | 2 +- .../pom.xml | 2 +- .../device-mgt/org.wso2.carbon.device.mgt.api/pom.xml | 2 +- .../device-mgt/org.wso2.carbon.device.mgt.common/pom.xml | 2 +- .../device-mgt/org.wso2.carbon.device.mgt.core/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.extensions/pom.xml | 2 +- components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.url.printer/pom.xml | 2 +- components/device-mgt/pom.xml | 2 +- .../email-sender/org.wso2.carbon.email.sender.core/pom.xml | 2 +- components/email-sender/pom.xml | 2 +- .../dynamic-client-web-proxy/pom.xml | 2 +- .../dynamic-client-registration/dynamic-client-web/pom.xml | 2 +- .../org.wso2.carbon.dynamic.client.registration/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../identity-extensions/dynamic-client-registration/pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.oauth.extensions/pom.xml | 4 ++-- .../pom.xml | 2 +- .../org.wso2.carbon.identity.jwt.client.extension/pom.xml | 2 +- components/identity-extensions/pom.xml | 2 +- .../org.wso2.carbon.complex.policy.decision.point/pom.xml | 4 ++-- .../org.wso2.carbon.policy.decision.point/pom.xml | 4 ++-- .../org.wso2.carbon.policy.information.point/pom.xml | 4 ++-- .../policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml | 4 ++-- .../policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml | 4 ++-- components/policy-mgt/pom.xml | 4 ++-- .../org.wso2.carbon.webapp.authenticator.framework/pom.xml | 4 ++-- components/webapp-authenticator-framework/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../org.wso2.carbon.apimgt.handler.server.feature/pom.xml | 4 ++-- .../org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml | 4 ++-- features/apimgt-extensions/pom.xml | 4 ++-- .../org.wso2.carbon.certificate.mgt.api.feature/pom.xml | 2 +- .../pom.xml | 2 +- .../org.wso2.carbon.certificate.mgt.server.feature/pom.xml | 4 ++-- features/certificate-mgt/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- features/device-mgt-extensions/pom.xml | 2 +- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.api.feature/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.extensions.feature/pom.xml | 4 ++-- .../device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml | 2 +- .../org.wso2.carbon.device.mgt.server.feature/pom.xml | 4 ++-- .../org.wso2.carbon.device.mgt.ui.feature/pom.xml | 2 +- features/device-mgt/pom.xml | 2 +- .../pom.xml | 4 ++-- features/dynamic-client-registration/pom.xml | 4 ++-- .../org.wso2.carbon.email.sender.feature/pom.xml | 4 ++-- features/email-sender/pom.xml | 4 ++-- .../pom.xml | 4 ++-- features/jwt-client/pom.xml | 4 ++-- .../pom.xml | 4 ++-- features/oauth-extensions/pom.xml | 4 ++-- .../org.wso2.carbon.policy.mgt.server.feature/pom.xml | 4 ++-- features/policy-mgt/pom.xml | 4 ++-- .../pom.xml | 4 ++-- features/webapp-authenticator-framework/pom.xml | 4 ++-- pom.xml | 6 +++--- 77 files changed, 125 insertions(+), 125 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml index 8515ad6fe4..c3b257f504 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.annotations - 2.0.6 + 2.0.7-SNAPSHOT bundle WSO2 Carbon - API Management Annotations WSO2 Carbon - API Management Custom Annotation Module diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml index f95c675fbe..a48a6ef2e8 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml @@ -21,12 +21,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 - 2.0.6 + 2.0.7-SNAPSHOT org.wso2.carbon.apimgt.application.extension.api war WSO2 Carbon - API Application Management API diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml index f6a3be4e11..0b3e9061a1 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml @@ -22,12 +22,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 - 2.0.6 + 2.0.7-SNAPSHOT org.wso2.carbon.apimgt.application.extension bundle WSO2 Carbon - API Application Management diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml index 098f24b622..451e5ed293 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml @@ -21,13 +21,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handlers - 2.0.6 + 2.0.7-SNAPSHOT bundle WSO2 Carbon - API Security Handler Component WSO2 Carbon - API Management Security Handler Module 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 1696e39ec6..aee804b2e5 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 @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher - 2.0.6 + 2.0.7-SNAPSHOT bundle WSO2 Carbon - API Management Webapp Publisher WSO2 Carbon - API Management Webapp Publisher diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index 0abe1a3b21..0a0d21aaa5 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml 4.0.0 apimgt-extensions - 2.0.6 + 2.0.7-SNAPSHOT pom WSO2 Carbon - API Management Extensions Component http://wso2.org diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml index d4b64bd64f..d0b957e510 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml index b4ed7ec7af..a6dbbaa957 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml index 80f087e4a9..1dd5a70d09 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml @@ -21,13 +21,13 @@ org.wso2.carbon.devicemgt certificate-mgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.core - 2.0.6 + 2.0.7-SNAPSHOT bundle WSO2 Carbon - Certificate Management Core WSO2 Carbon - Certificate Management Core diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index 09cd73b3e1..2412934b90 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt - 2.0.6 + 2.0.7-SNAPSHOT pom WSO2 Carbon - Certificate Management Component http://wso2.org diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml index d4c9c22893..7770831210 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm/pom.xml index 8b9e186de5..48621fc0c8 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 3337b87221..20fac79e86 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index 2098416613..e947af9b54 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index 2201946859..7a162c59ce 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml index 234cd71b99..7a503f37b7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.devicemgt device-mgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml index e9fe9a3bf3..a64fae321a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml index b9b05c2a9d..27b01bd554 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml index 6c86a59c3f..32a3f61424 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml @@ -21,7 +21,7 @@ device-mgt org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml index ecec8211e7..141027ac8f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml index 95aa91b3c9..c126e47943 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml index 0d86e17f4f..9545736da9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml index 400c07d0ce..83c552cb52 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.url.printer/pom.xml @@ -23,7 +23,7 @@ device-mgt org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index dc350724a2..fdb4d4fbad 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml diff --git a/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml b/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml index 1ed8809cf0..f6bbf47f07 100644 --- a/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml +++ b/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt email-sender - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/email-sender/pom.xml b/components/email-sender/pom.xml index ef63511f44..fc743d96c2 100644 --- a/components/email-sender/pom.xml +++ b/components/email-sender/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml index 88c9b585b4..23d8f7b3f5 100644 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml @@ -21,7 +21,7 @@ dynamic-client-registration org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml index f028d1bf21..0113694c2f 100644 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml @@ -21,7 +21,7 @@ dynamic-client-registration org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml index b73c277246..58d9bf059c 100644 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml @@ -21,13 +21,13 @@ dynamic-client-registration org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.dynamic.client.registration - 2.0.6 + 2.0.7-SNAPSHOT bundle WSO2 Carbon - Dynamic client registration service WSO2 Carbon - Dynamic Client Registration Service diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml index d7b84ffc1a..05ab159fe9 100644 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml @@ -21,13 +21,13 @@ dynamic-client-registration org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.dynamic.client.web.app.registration - 2.0.6 + 2.0.7-SNAPSHOT bundle WSO2 Carbon - Dynamic client web app registration WSO2 Carbon - Dynamic Client Web-app Registration Service diff --git a/components/identity-extensions/dynamic-client-registration/pom.xml b/components/identity-extensions/dynamic-client-registration/pom.xml index 891bd55a98..58aef32920 100644 --- a/components/identity-extensions/dynamic-client-registration/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt identity-extensions - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt dynamic-client-registration - 2.0.6 + 2.0.7-SNAPSHOT pom WSO2 Carbon - Dynamic client registration http://wso2.org diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml index 92b4210f54..b4d7a023bb 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt identity-extensions - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions - 2.0.6 + 2.0.7-SNAPSHOT bundle WSO2 Carbon - OAuth Extensions http://wso2.org diff --git a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml index 6632bf52d4..7c56e3b5a1 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml @@ -21,7 +21,7 @@ identity-extensions org.wso2.carbon.devicemgt - 2.0.6 + 2.0.7-SNAPSHOT 4.0.0 diff --git a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml index ebdcd06e51..3e83e9a10f 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt identity-extensions - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index d05d7e04e1..e26b2c7580 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml diff --git a/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml index 69fd6cb308..79ba6d653c 100644 --- a/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.complex.policy.decision.point - 2.0.6 + 2.0.7-SNAPSHOT bundle WSO2 Carbon - Policy Decision Point WSO2 Carbon - Policy Decision Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml index 239e28c8ba..c5918d2e05 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml @@ -3,14 +3,14 @@ org.wso2.carbon.devicemgt policy-mgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.decision.point - 2.0.6 + 2.0.7-SNAPSHOT bundle WSO2 Carbon - Policy Decision Point WSO2 Carbon - Policy Decision Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml index 3631862026..d696a6e229 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.devicemgt policy-mgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml @@ -11,7 +11,7 @@ 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.information.point - 2.0.6 + 2.0.7-SNAPSHOT bundle WSO2 Carbon - Policy Information Point WSO2 Carbon - Policy Information Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml index a5dd44f08b..da24980da3 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.common - 2.0.6 + 2.0.7-SNAPSHOT bundle WSO2 Carbon - Policy Management Common WSO2 Carbon - Policy Management Common diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml index 53679ba2fc..645fd271b9 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.core - 2.0.6 + 2.0.7-SNAPSHOT bundle WSO2 Carbon - Policy Management Core WSO2 Carbon - Policy Management Core diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index d542d7a845..387697b8fa 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml 4.0.0 policy-mgt - 2.0.6 + 2.0.7-SNAPSHOT pom WSO2 Carbon - Policy Management Component http://wso2.org diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml index fe7ee64d74..fb3c86bc70 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt webapp-authenticator-framework - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.webapp.authenticator.framework - 2.0.6 + 2.0.7-SNAPSHOT bundle WSO2 Carbon - Web Application Authenticator Framework Bundle WSO2 Carbon - Web Application Authenticator Framework Bundle diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml index 79724cc520..84dbee75fa 100644 --- a/components/webapp-authenticator-framework/pom.xml +++ b/components/webapp-authenticator-framework/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework - 2.0.6 + 2.0.7-SNAPSHOT pom WSO2 Carbon - Webapp Authenticator Framework http://wso2.org diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml index c4eadaec2a..489bacc2fd 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.application.extension.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - API Management Application Extension Feature http://wso2.org This feature contains an implementation of a api application registration, which takes care of subscription diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml index 0167030716..5380c31999 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handler.server.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - Device Management - APIM handler Server Feature http://wso2.org This feature contains the handler for the api authentications 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 942f1d7ff3..0cc36fe99e 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 @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - API Management Webapp Publisher Feature http://wso2.org This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index b8379e67e7..51efa1550b 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt apimgt-extensions-feature - 2.0.6 + 2.0.7-SNAPSHOT pom WSO2 Carbon - API Management Extensions Feature http://wso2.org diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml index f62219399c..8dd575de20 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml index a08024cc2b..13bb9cb452 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml index 993d3b5c1b..aafde9de63 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.server.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - Certificate Management Server Feature http://wso2.org This feature contains the core bundles required for back-end Certificate Management functionality diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml index 3ef03a45ee..b3c7ba4b80 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt-feature - 2.0.6 + 2.0.7-SNAPSHOT pom WSO2 Carbon - Certificate Management Feature http://wso2.org diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml index 07f71e7ac5..dbe5b35f59 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - Device Type Deployer Feature http://wso2.org WSO2 Carbon - Device Type Deployer Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.feature/pom.xml index 227a2d19e7..8a44fa463b 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - GCM Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index b64bb316a6..4bd768b686 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - MQTT Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml index 390279025c..52976cea41 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - XMPP Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - XMPP Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml index 46c5b626ce..0db4d04d52 100644 --- a/features/device-mgt-extensions/pom.xml +++ b/features/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml index 08696c2fe0..f2dca661e2 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml @@ -3,13 +3,13 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.analytics.dashboard.feature - 2.0.6 + 2.0.7-SNAPSHOT pom WSO2 Carbon - Device Management Dashboard Analytics Feature WSO2 Carbon - Device Management Dashboard Analytics Feature diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml index 8c33892f51..52fd3b446f 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.analytics.data.publisher.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - Device Management Server Feature http://wso2.org This feature contains bundles related to device analytics data publisher diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml index 6c2c33e50b..b263a9ba86 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml index 718fda41f2..0e55a7d75c 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml @@ -4,14 +4,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - Device Management Extensions Feature http://wso2.org This feature contains common extensions used by key device management functionalities diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml index b882cd9c1a..3ba32fa1bc 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml index 5fdc505ea8..ba37ab67c8 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.server.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - Device Management Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml index e9c8e88ed4..9d9a5d4ec0 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 1a6b462106..208d2233fb 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml diff --git a/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml b/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml index 0bf2d7340e..f22704046d 100644 --- a/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml +++ b/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt dynamic-client-registration-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.dynamic.client.registration.server.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - Dynamic Client Registration Server Feature http://wso2.org This feature contains dynamic client registration features diff --git a/features/dynamic-client-registration/pom.xml b/features/dynamic-client-registration/pom.xml index 94327e4ffb..b666224d1e 100644 --- a/features/dynamic-client-registration/pom.xml +++ b/features/dynamic-client-registration/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt dynamic-client-registration-feature - 2.0.6 + 2.0.7-SNAPSHOT pom WSO2 Carbon - Dynamic Client Registration Feature http://wso2.org diff --git a/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml b/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml index 5b8638e958..95f81b3ae8 100644 --- a/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml +++ b/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt email-sender-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.email.sender.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - Email Sender Feature http://wso2.org This feature contains the core bundles required for email sender related functionality diff --git a/features/email-sender/pom.xml b/features/email-sender/pom.xml index 940e9ec3b8..77e24557ba 100644 --- a/features/email-sender/pom.xml +++ b/features/email-sender/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt email-sender-feature - 2.0.6 + 2.0.7-SNAPSHOT pom WSO2 Carbon - Email Sender Feature http://wso2.org diff --git a/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml index ce23027f78..f65bd61439 100644 --- a/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml +++ b/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt jwt-client-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.identity.jwt.client.extension.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - JWT Client Feature http://wso2.org This feature contains jwt client implementation from which we can get a access token using the jwt diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml index f40a502bfc..67ab40e27c 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml 4.0.0 jwt-client-feature - 2.0.6 + 2.0.7-SNAPSHOT pom WSO2 Carbon - Dynamic Client Registration Feature http://wso2.org diff --git a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml index 8faac94f58..910267f1f3 100644 --- a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml +++ b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt oauth-extensions-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - Device Mgt OAuth Extensions Feature http://wso2.org This feature contains devicemgt related OAuth extensions diff --git a/features/oauth-extensions/pom.xml b/features/oauth-extensions/pom.xml index 216b3e4d66..cfce762238 100644 --- a/features/oauth-extensions/pom.xml +++ b/features/oauth-extensions/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt oauth-extensions-feature - 2.0.6 + 2.0.7-SNAPSHOT pom WSO2 Carbon - Device Management OAuth Extensions Feature http://wso2.org diff --git a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml index d6e4dca54b..b06d902695 100644 --- a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt policy-mgt-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.policy.mgt.server.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - Policy Management Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml index 1c0451b765..94c9dc45b2 100644 --- a/features/policy-mgt/pom.xml +++ b/features/policy-mgt/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt policy-mgt-feature - 2.0.6 + 2.0.7-SNAPSHOT pom WSO2 Carbon - Policy Management Feature http://wso2.org diff --git a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml index 50a698e27a..c450cb7e0b 100644 --- a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml +++ b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt webapp-authenticator-framework-feature - 2.0.6 + 2.0.7-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.webapp.authenticator.framework.server.feature pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - Webapp Authenticator Framework Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml index 43c6076b48..243d23c60f 100644 --- a/features/webapp-authenticator-framework/pom.xml +++ b/features/webapp-authenticator-framework/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.6 + 2.0.7-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework-feature - 2.0.6 + 2.0.7-SNAPSHOT pom WSO2 Carbon - Webapp Authenticator Framework Feature http://wso2.org diff --git a/pom.xml b/pom.xml index 63c52f3575..e9339f6644 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt pom - 2.0.6 + 2.0.7-SNAPSHOT WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components @@ -1671,7 +1671,7 @@ https://github.com/wso2/carbon-device-mgt.git scm:git:https://github.com/wso2/carbon-device-mgt.git scm:git:https://github.com/wso2/carbon-device-mgt.git - v2.0.6 + HEAD @@ -1952,7 +1952,7 @@ 1.2.11.wso2v10 - 2.0.6 + 2.0.7-SNAPSHOT 4.4.8