forked from community/device-mgt-core
parent
9200adebed
commit
44c7383b15
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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<ContextPath> 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<ContextPath> getApis() {
|
||||
return apis;
|
||||
}
|
||||
|
||||
public void setApis(List<ContextPath> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<String, String> tokenHeaders = new HashMap<String, String>();
|
||||
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<String, String> drcHeaders = new HashMap<String, String>();
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,24 +0,0 @@
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean id="restClientConfiguration">
|
||||
<property name="maxTotalConnections" value="200"/>
|
||||
<property name="maxConnectionsPerRoute" value="200"/>
|
||||
</bean>
|
||||
|
||||
<bean id="apiFilterConfig">
|
||||
<property name="apiList">
|
||||
<set>
|
||||
<value>/services/echo</value>
|
||||
<value>/abc</value>
|
||||
</set>
|
||||
</property>
|
||||
<property name="host" value="localhost"/>
|
||||
<property name="httpsPort" value="9443"/>
|
||||
<property name="username" value="admin"/>
|
||||
<property name="password" value="admin"/>
|
||||
<property name="ios-verify-endpoint" value="/api/certificate-mgt/v1.0/admin/certificates/verify/ios"/>
|
||||
<property name="android-verify-endpoint" value="/api/certificate-mgt/v1.0/admin/certificates/verify/android"/>
|
||||
</bean>
|
||||
</beans>
|
@ -1,138 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<api xmlns="http://ws.apache.org/ns/synapse"
|
||||
name="ios-synapse-config"
|
||||
context="/ios-enrollment"
|
||||
host="localhost">
|
||||
<resource methods="GET" uri-template="/ca">
|
||||
<inSequence>
|
||||
<send>
|
||||
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="HTTPEndpoint">
|
||||
<http uri-template="https://localhost:9443/ios-enrollment/ca" method="GET"/>
|
||||
</endpoint>
|
||||
</send>
|
||||
</inSequence>
|
||||
<outSequence>
|
||||
<send/>
|
||||
</outSequence>
|
||||
</resource>
|
||||
<resource methods="POST" uri-template="/authenticate">
|
||||
<inSequence>
|
||||
<property name="messageType" expression="$trp:Content-Type" scope="axis2"/>
|
||||
<property name="ContentType" expression="$trp:Content-Type" scope="axis2"/>
|
||||
<send>
|
||||
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="HTTPEndpoint">
|
||||
<http uri-template="https://localhost:9443/ios-enrollment/authenticate" method="POST"/>
|
||||
</endpoint>
|
||||
</send>
|
||||
</inSequence>
|
||||
<outSequence>
|
||||
<send/>
|
||||
</outSequence>
|
||||
</resource>
|
||||
<resource methods="POST" uri-template="/enroll">
|
||||
<inSequence>
|
||||
<property name="messageType" expression="$trp:Content-Type" scope="axis2"/>
|
||||
<property name="ContentType" expression="$trp:Content-Type" scope="axis2"/>
|
||||
<send>
|
||||
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="HTTPEndpoint">
|
||||
<http uri-template="https://localhost:9443/ios-enrollment/enroll" method="POST"/>
|
||||
</endpoint>
|
||||
</send>
|
||||
</inSequence>
|
||||
<outSequence>
|
||||
<send/>
|
||||
</outSequence>
|
||||
</resource>
|
||||
<resource methods="GET" uri-template="/enrolled?deviceid={id}">
|
||||
<inSequence>
|
||||
<send>
|
||||
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="HTTPEndpoint">
|
||||
<http uri-template="https://localhost:9443/ios-enrollment/enrolled?deviceid={$url:deviceid}" method="GET"/>
|
||||
</endpoint>
|
||||
</send>
|
||||
</inSequence>
|
||||
<outSequence>
|
||||
<send/>
|
||||
</outSequence>
|
||||
</resource>
|
||||
<resource methods="POST" uri-template="/profile">
|
||||
<inSequence>
|
||||
<property name="messageType" expression="$trp:Content-Type" scope="axis2"/>
|
||||
<property name="ContentType" expression="$trp:Content-Type" scope="axis2"/>
|
||||
<send>
|
||||
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="HTTPEndpoint">
|
||||
<http uri-template="https://localhost:9443/ios-enrollment/profile" method="POST"/>
|
||||
</endpoint>
|
||||
</send>
|
||||
</inSequence>
|
||||
<outSequence>
|
||||
<send/>
|
||||
</outSequence>
|
||||
</resource>
|
||||
<resource methods="GET" uri-template="/scep?operation={op}&message={msg}">
|
||||
<inSequence>
|
||||
<send>
|
||||
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="HTTPEndpoint">
|
||||
<http uri-template="https://localhost:9443/ios-enrollment/scep?operation={$url:operation}&message={$url:message}" method="GET"/>
|
||||
</endpoint>
|
||||
</send>
|
||||
</inSequence>
|
||||
<outSequence>
|
||||
<send/>
|
||||
</outSequence>
|
||||
</resource>
|
||||
<resource methods="POST" uri-template="/scep?operation={op}">
|
||||
<inSequence>
|
||||
<property name="messageType" expression="$trp:Content-Type" scope="axis2"/>
|
||||
<property name="ContentType" expression="$trp:Content-Type" scope="axis2"/>
|
||||
<send>
|
||||
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="HTTPEndpoint">
|
||||
<http uri-template="https://localhost:9443/ios-enrollment/scep?operation={$url:operation}" method="POST"/>
|
||||
</endpoint>
|
||||
</send>
|
||||
</inSequence>
|
||||
<outSequence>
|
||||
<send/>
|
||||
</outSequence>
|
||||
</resource>
|
||||
<resource methods="PUT" uri-template="/checkin">
|
||||
<inSequence>
|
||||
<property name="messageType" expression="$trp:Content-Type" scope="axis2"/>
|
||||
<property name="ContentType" expression="$trp:Content-Type" scope="axis2"/>
|
||||
<send>
|
||||
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="HTTPEndpoint">
|
||||
<http uri-template="https://localhost:9443/ios-enrollment/checkin" method="PUT"/>
|
||||
</endpoint>
|
||||
</send>
|
||||
</inSequence>
|
||||
<outSequence>
|
||||
<send/>
|
||||
</outSequence>
|
||||
</resource>
|
||||
<resource methods="PUT" uri-template="/server">
|
||||
<inSequence>
|
||||
<property name="messageType" expression="$trp:Content-Type" scope="axis2"/>
|
||||
<property name="ContentType" expression="$trp:Content-Type" scope="axis2"/>
|
||||
<send>
|
||||
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="HTTPEndpoint">
|
||||
<http uri-template="https://localhost:9443/ios-enrollment/server" method="PUT"/>
|
||||
</endpoint>
|
||||
</send>
|
||||
</inSequence>
|
||||
<outSequence>
|
||||
<send/>
|
||||
</outSequence>
|
||||
</resource>
|
||||
<resource methods="GET" uri-template="/license">
|
||||
<inSequence>
|
||||
<send>
|
||||
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="HTTPEndpoint">
|
||||
<http uri-template="https://localhost:9443/ios-enrollment/license" method="GET"/>
|
||||
</endpoint>
|
||||
</send>
|
||||
</inSequence>
|
||||
<outSequence>
|
||||
<send/>
|
||||
</outSequence>
|
||||
</resource>
|
||||
</api>
|
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
~ Copyright (c) 2015, 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.
|
||||
-->
|
||||
|
||||
<ServerConfiguration>
|
||||
<!-- IoT server host name, this is referred from APIM gateway to call to IoT server for certificate validation-->
|
||||
<Hostname>https://localhost:9443/</Hostname>
|
||||
|
||||
<!--End point to verify the certificate-->
|
||||
<VerificationEndpoint>https://localhost:9443/api/certificate-mgt/v1.0/admin/certificates/verify/</VerificationEndpoint>
|
||||
|
||||
<!--Admin username/password - this is to use for oauth token generation-->
|
||||
<Username>admin</Username>
|
||||
<Password>admin</Password>
|
||||
|
||||
<!--Dynamic client registration endpoint-->
|
||||
<DynamicClientRegistrationEndpoint>https://localhost:9443/dynamic-client-web/register</DynamicClientRegistrationEndpoint>
|
||||
|
||||
<!--Oauth token endpoint-->
|
||||
<OauthTokenEndpoint>https://localhost:9443/oauth2/token</OauthTokenEndpoint>
|
||||
|
||||
<APIS>
|
||||
<ContextPath>/services/echo</ContextPath>
|
||||
<ContextPath>/abc</ContextPath>
|
||||
<ContextPath>/ca</ContextPath>
|
||||
<ContextPath>/authenticate</ContextPath>
|
||||
<ContextPath>/enroll</ContextPath>
|
||||
<ContextPath>/enrolled</ContextPath>
|
||||
<ContextPath>/license</ContextPath>
|
||||
<ContextPath>/checkin</ContextPath>
|
||||
<ContextPath>/server</ContextPath>
|
||||
</APIS>
|
||||
</ServerConfiguration>
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>apimgt-extensions-feature</artifactId>
|
||||
<version>2.0.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>org.wso2.carbon.apimgt.handler.server.feature</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>2.0.6-SNAPSHOT</version>
|
||||
<name>WSO2 Carbon - Device Management - APIM handler Server Feature</name>
|
||||
<url>http://wso2.org</url>
|
||||
<description>This feature contains the handler for the api authentications
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.apimgt.handlers</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>src/main/resources</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>resources</directory>
|
||||
<includes>
|
||||
<include>build.properties</include>
|
||||
<include>p2.inf</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.wso2.maven</groupId>
|
||||
<artifactId>carbon-p2-plugin</artifactId>
|
||||
<version>${carbon.p2.plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>p2-feature-generation</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>p2-feature-gen</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<id>org.wso2.carbon.apimgt.handler.server</id>
|
||||
<propertiesFile>../../../features/etc/feature.properties</propertiesFile>
|
||||
<adviceFile>
|
||||
<properties>
|
||||
<propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
|
||||
<propertyDef>org.eclipse.equinox.p2.type.group:false</propertyDef>
|
||||
</properties>
|
||||
</adviceFile>
|
||||
<bundles>
|
||||
<bundleDef>
|
||||
org.wso2.carbon.devicemgt:org.wso2.carbon.apimgt.handlers:${carbon.device.mgt.version}
|
||||
</bundleDef>
|
||||
<!--<bundleDef>-->
|
||||
<!--org.apache.ws.security.wso2:wss4j:${org.apache.ws.security.wso2.version}-->
|
||||
<!--</bundleDef>-->
|
||||
</bundles>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1 @@
|
||||
custom = true
|
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
~ Copyright (c) 2015, 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.
|
||||
-->
|
||||
|
||||
<ServerConfiguration>
|
||||
<!-- IoT server host name, this is referred from APIM gateway to call to IoT server for certificate validation-->
|
||||
<Hostname>https://localhost:9443/</Hostname>
|
||||
|
||||
<!--End point to verify the certificate-->
|
||||
<VerificationEndpoint>https://localhost:9443/api/certificate-mgt/v1.0/admin/certificates/verify/</VerificationEndpoint>
|
||||
|
||||
<!--Admin username/password - this is to use for oauth token generation-->
|
||||
<Username>admin</Username>
|
||||
<Password>admin</Password>
|
||||
|
||||
<!--Dynamic client registration endpoint-->
|
||||
<DynamicClientRegistrationEndpoint>https://localhost:9443/dynamic-client-web/register</DynamicClientRegistrationEndpoint>
|
||||
|
||||
<!--Oauth token endpoint-->
|
||||
<OauthTokenEndpoint>https://localhost:9443/oauth2/token</OauthTokenEndpoint>
|
||||
|
||||
<APIS>
|
||||
<ContextPath>/services</ContextPath>
|
||||
</APIS>
|
||||
</ServerConfiguration>
|
@ -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);\
|
Loading…
Reference in new issue