Java class for Authenticator complex type. + * + *
The following schema fragment specifies the expected content contained within this class. + * + *
+ * <complexType name="Authenticator"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Properties" type="{}Properties"/> + * </sequence> + * <attribute name="class" type="{http://www.w3.org/2001/XMLSchema}string" /> + * </restriction> + * </complexContent> + * </complexType> + *+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Authenticator", propOrder = { + "properties" +}) +public class Authenticator { + + @XmlElement(name = "Properties", required = true) + protected Properties properties; + @XmlAttribute(name = "class") + protected String clazz; + + /** + * Gets the value of the properties property. + * + * @return + * possible object is + * {@link Properties } + * + */ + public Properties getProperties() { + return properties; + } + + /** + * Sets the value of the properties property. + * + * @param value + * allowed object is + * {@link Properties } + * + */ + public void setProperties(Properties value) { + this.properties = value; + } + + /** + * Gets the value of the clazz property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getClazz() { + return clazz; + } + + /** + * Sets the value of the clazz property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setClazz(String value) { + this.clazz = value; + } + +} diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/config/Authorizer.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/config/Authorizer.java new file mode 100644 index 000000000..5f3de1345 --- /dev/null +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/config/Authorizer.java @@ -0,0 +1,90 @@ + +package org.wso2.carbon.device.mgt.iot.output.adapter.ui.config; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *
Java class for Authorizer complex type. + * + *
The following schema fragment specifies the expected content contained within this class. + * + *
+ * <complexType name="Authorizer"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Properties" type="{}Properties"/> + * </sequence> + * <attribute name="class" type="{http://www.w3.org/2001/XMLSchema}string" /> + * </restriction> + * </complexContent> + * </complexType> + *+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Authorizer", propOrder = { + "properties" +}) +public class Authorizer { + + @XmlElement(name = "Properties", required = true) + protected Properties properties; + @XmlAttribute(name = "class") + protected String clazz; + + /** + * Gets the value of the properties property. + * + * @return + * possible object is + * {@link Properties } + * + */ + public Properties getProperties() { + return properties; + } + + /** + * Sets the value of the properties property. + * + * @param value + * allowed object is + * {@link Properties } + * + */ + public void setProperties(Properties value) { + this.properties = value; + } + + /** + * Gets the value of the clazz property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getClazz() { + return clazz; + } + + /** + * Sets the value of the clazz property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setClazz(String value) { + this.clazz = value; + } + +} diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/config/Properties.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/config/Properties.java new file mode 100644 index 000000000..e383da5cd --- /dev/null +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/config/Properties.java @@ -0,0 +1,69 @@ + +package org.wso2.carbon.device.mgt.iot.output.adapter.ui.config; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; +import java.util.ArrayList; +import java.util.List; + + +/** + *
Java class for Properties complex type. + * + *
The following schema fragment specifies the expected content contained within this class. + * + *
+ * <complexType name="Properties"> + * <complexContent> + * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> + * <sequence> + * <element name="Property" type="{}Property" maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * </restriction> + * </complexContent> + * </complexType> + *+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Properties", propOrder = { + "property" +}) +public class Properties { + + @XmlElement(name = "Property") + protected List
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a set
method for the property property.
+ *
+ *
+ * For example, to add a new item, do as follows: + *
+ * getProperty().add(newItem); + *+ * + * + *
+ * Objects of the following type(s) are allowed in the list
+ * {@link Property }
+ *
+ *
+ */
+ public List Java class for Property complex type.
+ *
+ * The following schema fragment specifies the expected content contained within this class.
+ *
+ * Java class for WebsocketValidationConfigs complex type.
+ *
+ * The following schema fragment specifies the expected content contained within this class.
+ *
+ *
+ * <complexType name="Property">
+ * <simpleContent>
+ * <extension base="<http://www.w3.org/2001/XMLSchema>string">
+ * <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "Property", propOrder = {
+ "value"
+})
+public class Property {
+
+ @XmlValue
+ protected String value;
+ @XmlAttribute(name = "name")
+ protected String name;
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+}
diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/config/WebsocketConfig.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/config/WebsocketConfig.java
new file mode 100644
index 000000000..faf2d789b
--- /dev/null
+++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/config/WebsocketConfig.java
@@ -0,0 +1,57 @@
+
+package org.wso2.carbon.device.mgt.iot.output.adapter.ui.config;
+
+import org.w3c.dom.Document;
+import org.wso2.carbon.device.mgt.iot.output.adapter.ui.util.WebsocketUtils;
+import org.wso2.carbon.utils.CarbonUtils;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import java.io.File;
+
+/**
+ * This class represents the configuration that are needed for scopes to permission map.
+ */
+public class WebsocketConfig {
+
+ private static WebsocketConfig config = new WebsocketConfig();
+ private WebsocketValidationConfigs websocketValidationConfigs;
+
+ private static final String WEBSOCKET_VALIDATION_CONFIG_PATH =
+ CarbonUtils.getEtcCarbonConfigDirPath() + File.separator + "websocket-validation.xml";
+
+ private WebsocketConfig() {
+ }
+
+ public static WebsocketConfig getInstance() {
+ return config;
+ }
+
+ public void init() throws WebsocketValidationConfigurationFailedException {
+ try {
+ File deviceMgtConfig = new File(WEBSOCKET_VALIDATION_CONFIG_PATH);
+ Document doc = WebsocketUtils.convertToDocument(deviceMgtConfig);
+
+ /* Un-marshaling DeviceMGtScope configuration */
+ JAXBContext ctx = JAXBContext.newInstance(WebsocketValidationConfigs.class);
+ Unmarshaller unmarshaller = ctx.createUnmarshaller();
+ //unmarshaller.setSchema(getSchema());
+ websocketValidationConfigs = (WebsocketValidationConfigs) unmarshaller.unmarshal(doc);
+ if (websocketValidationConfigs != null) {
+
+ }
+ } catch (JAXBException e) {
+ throw new WebsocketValidationConfigurationFailedException("Error occurred while un-marshalling Websocket" +
+ " Config", e);
+ }
+ }
+
+ public WebsocketValidationConfigs getWebsocketValidationConfigs() {
+ return websocketValidationConfigs;
+ }
+
+ public void setWebsocketValidationConfigs(WebsocketValidationConfigs websocketValidationConfigs) {
+ websocketValidationConfigs = websocketValidationConfigs;
+ }
+}
diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/config/WebsocketValidationConfigs.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/config/WebsocketValidationConfigs.java
new file mode 100644
index 000000000..08bdab872
--- /dev/null
+++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/config/WebsocketValidationConfigs.java
@@ -0,0 +1,90 @@
+
+package org.wso2.carbon.device.mgt.iot.output.adapter.ui.config;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ *
+ * <complexType name="WebsocketValidationConfigs">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="Authenticator" type="{}Authenticator"/>
+ * <element name="Authorizer" type="{}Authorizer"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "WebsocketValidationConfigs", propOrder = {
+ "authenticator",
+ "authorizer"
+})
+public class WebsocketValidationConfigs {
+
+ @XmlElement(name = "Authenticator", required = true)
+ protected Authenticator authenticator;
+ @XmlElement(name = "Authorizer", required = true)
+ protected Authorizer authorizer;
+
+ /**
+ * Gets the value of the authenticator property.
+ *
+ * @return
+ * possible object is
+ * {@link Authenticator }
+ *
+ */
+ public Authenticator getAuthenticator() {
+ return authenticator;
+ }
+
+ /**
+ * Sets the value of the authenticator property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Authenticator }
+ *
+ */
+ public void setAuthenticator(Authenticator value) {
+ this.authenticator = value;
+ }
+
+ /**
+ * Gets the value of the authorizer property.
+ *
+ * @return
+ * possible object is
+ * {@link Authorizer }
+ *
+ */
+ public Authorizer getAuthorizer() {
+ return authorizer;
+ }
+
+ /**
+ * Sets the value of the authorizer property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Authorizer }
+ *
+ */
+ public void setAuthorizer(Authorizer value) {
+ this.authorizer = value;
+ }
+
+}
diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/config/WebsocketValidationConfigurationFailedException.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/config/WebsocketValidationConfigurationFailedException.java
new file mode 100644
index 000000000..766eea3ee
--- /dev/null
+++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/config/WebsocketValidationConfigurationFailedException.java
@@ -0,0 +1,44 @@
+/*
+ * 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.device.mgt.iot.output.adapter.ui.config;
+
+public class WebsocketValidationConfigurationFailedException extends Exception {
+
+ private static final long serialVersionUID = -3151279329290703928L;
+
+ public WebsocketValidationConfigurationFailedException(String msg, Exception nestedEx) {
+ super(msg, nestedEx);
+ }
+
+ public WebsocketValidationConfigurationFailedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public WebsocketValidationConfigurationFailedException(String msg) {
+ super(msg);
+ }
+
+ public WebsocketValidationConfigurationFailedException() {
+ super();
+ }
+
+ public WebsocketValidationConfigurationFailedException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/constants/WebsocketConstants.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/constants/WebsocketConstants.java
new file mode 100644
index 000000000..9242e28f7
--- /dev/null
+++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/constants/WebsocketConstants.java
@@ -0,0 +1,36 @@
+/*
+ *
+ * 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.device.mgt.iot.output.adapter.ui.constants;
+
+/**
+ * This holds the constants related to this feature
+ */
+public class WebsocketConstants {
+
+ private WebsocketConstants() {
+ }
+
+ public static final String SCOPE_IDENTIFIER = "scopes";
+ public static final String MAXIMUM_TOTAL_HTTP_CONNECTION = "maximumTotalHttpConnection";
+ public static final String MAXIMUM_HTTP_CONNECTION_PER_HOST = "maximumHttpConnectionPerHost";
+ public static final String TOKEN_VALIDATION_ENDPOINT_URL = "tokenValidationEndpoint";
+ public static final String USERNAME = "username";
+ public static final String PASSWORD = "password";
+}
diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/internal/UILocalEventAdapterServiceComponent.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/internal/UILocalEventAdapterServiceComponent.java
index 341d4b377..71897510e 100644
--- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/internal/UILocalEventAdapterServiceComponent.java
+++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/internal/UILocalEventAdapterServiceComponent.java
@@ -24,6 +24,12 @@ import org.apache.commons.logging.LogFactory;
import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.device.mgt.iot.output.adapter.ui.UIEventAdapterFactory;
import org.wso2.carbon.device.mgt.iot.output.adapter.ui.UIOutputCallbackControllerServiceImpl;
+import org.wso2.carbon.device.mgt.iot.output.adapter.ui.authentication.Authenticator;
+import org.wso2.carbon.device.mgt.iot.output.adapter.ui.authorization.Authorizer;
+import org.wso2.carbon.device.mgt.iot.output.adapter.ui.config.WebsocketConfig;
+import org.wso2.carbon.device.mgt.iot.output.adapter.ui.config.WebsocketValidationConfigurationFailedException;
+import org.wso2.carbon.device.mgt.iot.output.adapter.ui.service.WebsocketValidationService;
+import org.wso2.carbon.device.mgt.iot.output.adapter.ui.service.WebsocketValidationServiceImpl;
import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterFactory;
import org.wso2.carbon.device.mgt.iot.output.adapter.ui.UIOutputCallbackControllerService;
import org.wso2.carbon.event.stream.core.EventStreamService;
@@ -58,6 +64,32 @@ public class UILocalEventAdapterServiceComponent {
if (log.isDebugEnabled()) {
log.debug("Successfully deployed the output ui adapter service");
}
+ try {
+ WebsocketConfig.getInstance().init();
+ WebsocketValidationServiceImpl websocketValidationService = new WebsocketValidationServiceImpl();
+ String authenticatorClassName = WebsocketConfig.getInstance().getWebsocketValidationConfigs()
+ .getAuthenticator().getClazz();
+ String authorizerClassName = WebsocketConfig.getInstance().getWebsocketValidationConfigs()
+ .getAuthorizer().getClazz();
+ if (authenticatorClassName != null && !authenticatorClassName.isEmpty()) {
+ Class extends Authenticator> authenticatorClass = Class.forName(authenticatorClassName)
+ .asSubclass(Authenticator.class);
+ Authenticator authenticator = authenticatorClass.newInstance();
+ websocketValidationService.setAuthenticator(authenticator);
+ }
+ if (authorizerClassName != null && !authorizerClassName.isEmpty()) {
+ Class extends Authorizer> authorizerClass = Class.forName(authorizerClassName)
+ .asSubclass(Authorizer.class);
+ Authorizer authorizer = authorizerClass.newInstance();
+ websocketValidationService.setAuthorizer(authorizer);
+ }
+ context.getBundleContext().registerService(
+ WebsocketValidationService.class.getName(), websocketValidationService, null);
+ } catch (WebsocketValidationConfigurationFailedException e) {
+ log.error("Failed to initialize configuration for websocket.", e);
+ } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
} catch (RuntimeException e) {
log.error("Can not create the output ui adapter service ", e);
}
diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/service/WebsocketValidationService.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/service/WebsocketValidationService.java
new file mode 100644
index 000000000..927c34515
--- /dev/null
+++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/service/WebsocketValidationService.java
@@ -0,0 +1,15 @@
+package org.wso2.carbon.device.mgt.iot.output.adapter.ui.service;
+
+import org.wso2.carbon.device.mgt.iot.output.adapter.ui.authentication.Authenticator;
+import org.wso2.carbon.device.mgt.iot.output.adapter.ui.authorization.Authorizer;
+
+/**
+ * This returns the configured authenticator and authorizer for websocket.
+ */
+public interface WebsocketValidationService {
+
+ Authenticator getAuthenticator();
+
+ Authorizer getAuthorizer();
+
+}
diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/service/WebsocketValidationServiceImpl.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/service/WebsocketValidationServiceImpl.java
new file mode 100644
index 000000000..b459b6851
--- /dev/null
+++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/service/WebsocketValidationServiceImpl.java
@@ -0,0 +1,30 @@
+package org.wso2.carbon.device.mgt.iot.output.adapter.ui.service;
+
+import org.wso2.carbon.device.mgt.iot.output.adapter.ui.authentication.Authenticator;
+import org.wso2.carbon.device.mgt.iot.output.adapter.ui.authorization.Authorizer;
+
+/**
+ * This returns the configured authenticator and authorizer for websocket.
+ */
+public class WebsocketValidationServiceImpl implements WebsocketValidationService{
+ private Authenticator authenticator;
+ private Authorizer authorizer;
+
+ @Override
+ public Authenticator getAuthenticator() {
+ return authenticator;
+ }
+
+ @Override
+ public Authorizer getAuthorizer() {
+ return authorizer;
+ }
+
+ public void setAuthenticator(Authenticator authenticator) {
+ this.authenticator = authenticator;
+ }
+
+ public void setAuthorizer(Authorizer authorizer) {
+ this.authorizer = authorizer;
+ }
+}
diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/util/WebSocketSessionUtil.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/util/WebSocketSessionRequest.java
similarity index 94%
rename from components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/util/WebSocketSessionUtil.java
rename to components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/util/WebSocketSessionRequest.java
index 7c083f8f0..f6966835a 100644
--- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/util/WebSocketSessionUtil.java
+++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/util/WebSocketSessionRequest.java
@@ -13,15 +13,15 @@ import java.util.Map;
* of the Session object derived from processing some of the (default) existing attributes.
* Ex: Query-String's [Key:Value] Map derived from the queryString attribute of the original class.
*/
-public class WebSocketSessionUtil {
- private static final Log log = LogFactory.getLog(WebSocketSessionUtil.class);
+public class WebSocketSessionRequest {
+ private static final Log log = LogFactory.getLog(WebSocketSessionRequest.class);
private static final String QUERY_STRING_SEPERATOR = "&";
private static final String QUERY_KEY_VALUE_SEPERATOR = "=";
private Map