From c992e68ec7bcc30b72a688b1bbe337a9271cbdf0 Mon Sep 17 00:00:00 2001 From: sinthuja Date: Wed, 2 Nov 2016 13:15:34 +0530 Subject: [PATCH] Revert: removing MB references from IOTserver pack (1fe9a801028d518c26afcc76b762b44e6da8f6d9) --- modules/distribution/src/assembly/bin.xml | 26 +++++++++---------- .../pom.xml | 1 - .../DeviceAccessBasedMQTTAuthorizer.java | 8 ------ modules/p2-profile-gen/pom.xml | 23 ++++++++++++++++ pom.xml | 5 ++++ 5 files changed, 41 insertions(+), 22 deletions(-) diff --git a/modules/distribution/src/assembly/bin.xml b/modules/distribution/src/assembly/bin.xml index f936ceed..53cd5216 100644 --- a/modules/distribution/src/assembly/bin.xml +++ b/modules/distribution/src/assembly/bin.xml @@ -216,7 +216,7 @@ **/api-manager.xml **/sso-idp-config.xml **/application-authentication.xml - + **/broker.xml **/log4j.properties **/nhttp.properties **/passthru-http.properties @@ -574,7 +574,7 @@ 644 - + - + - + @@ -856,12 +856,12 @@ 644 - + @@ -937,11 +937,11 @@ 644 - + ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/tomcat/webapp-classloading.xml @@ -994,11 +994,11 @@ ${pom.artifactId}-${pom.version}/repository/database/ 644 - + diff --git a/modules/iot-extensions/components/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml b/modules/iot-extensions/components/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml index 6bea07b3..61a8ba37 100644 --- a/modules/iot-extensions/components/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml +++ b/modules/iot-extensions/components/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml @@ -45,7 +45,6 @@ org.wso2.andes.wso2 andes - 3.1.2 org.wso2.carbon diff --git a/modules/iot-extensions/components/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/mqtt/authorization/DeviceAccessBasedMQTTAuthorizer.java b/modules/iot-extensions/components/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/mqtt/authorization/DeviceAccessBasedMQTTAuthorizer.java index bd122392..3e0adfaf 100644 --- a/modules/iot-extensions/components/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/mqtt/authorization/DeviceAccessBasedMQTTAuthorizer.java +++ b/modules/iot-extensions/components/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/mqtt/authorization/DeviceAccessBasedMQTTAuthorizer.java @@ -53,19 +53,15 @@ public class DeviceAccessBasedMQTTAuthorizer implements IAuthorizer { @Override public boolean isAuthorizedForTopic(MQTTAuthorizationSubject authorizationSubject, String topic, MQTTAuthoriztionPermissionLevel permissionLevel) { - if (isUserAuthorized(authorizationSubject, ADMIN_PERMISSION, UI_EXECUTE)) { - System.out.println("isAuthorizedForTopic - user is auth success !"); return true; } String topics[] = topic.split("/"); if (topics.length < 3) { - System.out.println("isAuthorizedForTopic topic name invalid"); return false; } String tenantIdFromTopic = topics[0]; if (!tenantIdFromTopic.equals(authorizationSubject.getTenantDomain())) { - System.out.println("isAuthorizedForTopic tenantID invalid"); return false; } String deviceType = topics[1]; @@ -82,12 +78,10 @@ public class DeviceAccessBasedMQTTAuthorizer implements IAuthorizer { + permissionScope; for (String scope : scopes) { if (requiredScope.equals(scope)) { - System.out.println("isAuthorizedForTopic - Pass"); return true; } } } - System.out.println("isAuthorizedForTopic - Failed"); return false; } @@ -119,12 +113,10 @@ public class DeviceAccessBasedMQTTAuthorizer implements IAuthorizer { if (userRealm != null && userRealm.getAuthorizationManager() != null) { return userRealm.getAuthorizationManager().isUserAuthorized(username, permission, action); } - System.out.println("isUserAuthorized failse"); return false; } catch (UserStoreException e) { String errorMsg = String.format("Unable to authorize the user : %s", username); logger.error(errorMsg, e); - System.out.println("isUserAuthorized failed"); return false; } finally { PrivilegedCarbonContext.endTenantFlow(); diff --git a/modules/p2-profile-gen/pom.xml b/modules/p2-profile-gen/pom.xml index 032519fc..3de7933a 100644 --- a/modules/p2-profile-gen/pom.xml +++ b/modules/p2-profile-gen/pom.xml @@ -695,6 +695,9 @@ + + org.wso2.carbon.messaging:org.wso2.carbon.andes.server.feature:${carbon.messaging.version} + org.wso2.carbon.metrics:org.wso2.carbon.metrics.feature:${carbon.metrics.version} @@ -828,6 +831,10 @@ org.wso2.iot.styles.feature.group ${carbon.iot.device.mgt.version} + + org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature.group + ${carbon.iot.device.mgt.version} + @@ -1524,6 +1531,10 @@ + + org.wso2.carbon.andes.server.feature.group + ${carbon.messaging.version} + org.wso2.carbon.metrics.feature.group ${carbon.metrics.version} @@ -1566,11 +1577,23 @@ org.wso2.iot.styles.feature.group ${carbon.iot.device.mgt.version} + + org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature.group + ${carbon.iot.device.mgt.version} + org.wso2.carbon.logging.mgt.feature.group ${carbon.commons.version} + + org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature.group + ${carbon.iot.device.mgt.version} + + + org.wso2.carbon.andes.server.feature.group + ${carbon.messaging.version} + org.wso2.carbon.metrics.feature.group ${carbon.metrics.version} diff --git a/pom.xml b/pom.xml index 999fbebf..61767d8c 100644 --- a/pom.xml +++ b/pom.xml @@ -1015,6 +1015,11 @@ org.eclipse.paho.client.mqttv3 ${eclipse.paho.version} + + org.wso2.andes.wso2 + andes + ${carbon.messaging.version} +