diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/agent-check.jag b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/agent-check.jag deleted file mode 100755 index 797fc44b4..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/agent-check.jag +++ /dev/null @@ -1,66 +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. - */ - -var log = new Log("/modules/enrollments/ios/agent-check.jag"); - -var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; -var UAParser = require("/app/modules/ua-parser.min.js")["UAParser"]; - -var tokenUtil = require("/app/modules/oauth/token-handlers.js")["handlers"]; -var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; - -var parser = new UAParser(); -var userAgent = request.getHeader("User-Agent"); -parser.setUA(userAgent); -parser.getResult(); -var os = parser.getOS(); -var platform = os.name; - -if (platform != "iOS") { - response.sendRedirect(mdmProps["appContext"] + "enrollments/error/unintentional-request"); -} else if (session.get("lastAccessedPage") != "license-agent") { - response.sendRedirect(mdmProps["appContext"] + "enrollments/error/unintentional-request"); -} else { - var enrolledUser = session.get("enrolledUser"); - if (!enrolledUser) { - response["status"] = 200; - response["content"] = {"deviceID" : null}; - } else { - var deviceCheckURL = mdmProps["iOSAPIRoot"] + "devices/udid"; - var challengeToken = session.get("iOSChallengeToken"); - var payload = {"challengeToken" : challengeToken}; - - serviceInvokers.XMLHttp.post( - deviceCheckURL, - stringify(payload), - function (restAPIResponse) { - var status = restAPIResponse["status"]; - if (status == 200) { - var responseContent = parse(restAPIResponse.responseText); - response["status"] = 200; - response["content"] = responseContent; - } else { - response["status"] = 200; - response["content"] = {"deviceID" : null}; - } - } - ); - } -} -%> \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/agent-controller.jag b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/agent-controller.jag deleted file mode 100755 index f6bafeacd..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/agent-controller.jag +++ /dev/null @@ -1,80 +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. - */ - -var log = new Log("/modules/enrollments/ios/agent-controller.jag"); - -var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; -var UAParser = require("/app/modules/ua-parser.min.js")["UAParser"]; -var tokenUtil = require("/app/modules/oauth/token-handlers.js")["handlers"]; -var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; -var constants = require("/app/modules/constants.js"); - -var parser = new UAParser(); -var userAgent = request.getHeader("User-Agent"); -parser.setUA(userAgent); -parser.getResult(); -var os = parser.getOS(); -var platform = os.name; - -if (platform != "iOS") { - response.sendRedirect(mdmProps["appContext"] + "enrollments/error/unintentional-request"); -} else if (session.get("lastAccessedPage") != "login-agent") { - response.sendRedirect(mdmProps["appContext"] + "enrollments/error/unintentional-request"); -} else { - var username = request.getParameter("username"); - var password = request.getParameter("password"); - var ownership = request.getParameter("ownership"); - var domain = request.getParameter("domain"); - if (!username || !password || !ownership) { - response.sendRedirect(mdmProps["appContext"] + "enrollments/error/unintentional-request"); - } else { - var fullyQualifiedUsername = username; - if(domain != null && domain != ''){ - fullyQualifiedUsername = username + "@" + domain; - } - tokenUtil.setupTokenPairByPasswordGrantType(fullyQualifiedUsername, password); - var authUrl = mdmProps["iOSConfigRoot"] + "authenticate"; - var payload = { - "username": username, "password": password, "ownership": ownership, - "tenantDomain": domain - }; - serviceInvokers.XMLHttp.post( - authUrl, - stringify(payload), - function (restAPIResponse) { - var status = restAPIResponse["status"]; - if (status == 200) { - var responseContent = parse(restAPIResponse.responseText); - session.put("authenticatedUser", username); - session.put("authenticatedUserPassword", password); - session.put("authenticatedUserDeviceOwnership", ownership); - session.put("authenticatedUserDomain", domain); - session.put("iOSChallengeToken", responseContent["challengeToken"]); - response.sendRedirect(mdmProps["appContext"] + "enrollments/ios/license-agent"); - } else if (status == 403) { - response.sendRedirect(mdmProps["appContext"] + "enrollments/ios/login-agent?error=auth-failed"); - } else { - // one visible possibility would be server sending 500 - response.sendRedirect(mdmProps["appContext"] + "enrollments/ios/login-agent?error=unexpected"); - } - } - ); - } -} -%> diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/agent-enroll.jag b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/agent-enroll.jag deleted file mode 100755 index eb3e3acbc..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/agent-enroll.jag +++ /dev/null @@ -1,85 +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. - */ - -var log = new Log("/app/modules/enrollments/ios/agent-enroll.jag"); - -var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; -var UAParser = require("/app/modules/ua-parser.min.js")["UAParser"]; - -var parser = new UAParser(); -var userAgent = request.getHeader("User-Agent"); -parser.setUA(userAgent); -parser.getResult(); -var os = parser.getOS(); -var platform = os.name; - -if (platform != "iOS") { - response.sendRedirect(mdmProps["appContext"] + "enrollments/error/unintentional-request"); -} else if (session.get("lastAccessedPage") != "license-agent") { - response.sendRedirect(mdmProps["appContext"] + "enrollments/error/unintentional-request"); -} else { - var authenticatedUser = session.get("authenticatedUser"); - if (!authenticatedUser) { - response.sendRedirect(mdmProps["appContext"] + "enrollments/error/unintentional-request"); - } else { - var HttpClient = Packages.org.apache.commons.httpclient.HttpClient; - var PostMethod = Packages.org.apache.commons.httpclient.methods.PostMethod; - var Header = Packages.org.apache.commons.httpclient.Header; - var StringRequestEntity = Packages.org.apache.commons.httpclient.methods.StringRequestEntity; - var ByteArrayInputStream = Packages.java.io.ByteArrayInputStream; - - var client = new HttpClient(); - var enrollUrl = mdmProps["iOSConfigRoot"] + "enroll"; - var method = new PostMethod(enrollUrl); - var header = new Header(); - - header.setName("Content-Type"); - header.setValue("application/json"); - method.addRequestHeader(header); - - var username = authenticatedUser; - var password = session.get("authenticatedUserPassword"); - var tenantDomain = session.get("authenticatedUserDomain"); - var challengeToken = session.get("iOSChallengeToken"); - - var inputs = {"username": username, "password": password, "challengeToken": challengeToken, "tenantDomain": tenantDomain}; - var stringRequestEntity = new StringRequestEntity(stringify(inputs)); - method.setRequestEntity(stringRequestEntity); - try { - client.executeMethod(method); - var status = method.getStatusCode(); - if (status == 200) { - session.put("enrolledUser", authenticatedUser); - var stream = method.getResponseBody(); - var byteArrayInputStream = new ByteArrayInputStream(stream); - response.contentType = "application/x-apple-aspen-config"; - print(new Stream(byteArrayInputStream)); - } else { - // two visible possibilities would be server sending 401 and 500 - response.sendRedirect(mdmProps["appContext"] + "enrollments/ios/login-agent?error=unexpected"); - } - } catch (e) { - log.error("Error occurred in enrolling ios device", e); - response.sendRedirect(mdmProps["appContext"] + "enrollments/ios/login-agent?error=unexpected"); - } finally { - method.releaseConnection(); - } - } -} -%> diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/agent.jag b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/agent.jag deleted file mode 100755 index 45a08c762..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/agent.jag +++ /dev/null @@ -1,47 +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. - */ - -var log = new Log("/app/modules/enrollments/ios/agent.jag"); - -var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; - -var userAgent = request.getHeader("User-Agent"); -var userAgentIsiPhone = (userAgent.indexOf("iPhone") > -1); -var userAgentIsiPad = (userAgent.indexOf("iPad") > -1); -var userAgentIsiPodTouch = (userAgent.indexOf("iPod Touch") > -1); - -if (!userAgentIsiPhone && !userAgentIsiPad && !userAgentIsiPodTouch) { - response.sendRedirect(mdmProps["appContext"] + "enrollments/error/unintentional-request"); -} else { - var enrollmentUtils = require("/app/modules/enrollments/util/utils.js")["methods"]; - var Handlebars = require("/lib/modules/handlebars/handlebars-v2.0.0.js")["Handlebars"]; - var template = Handlebars.compile(enrollmentUtils. - getResource("/app/modules/enrollments/ios/config/ios-manifest-template.hbs")); - - var iOSManifest = template({ - "url" : mdmProps["device"]["ios"]["location"], - "bundleID" : mdmProps["device"]["ios"]["bundleID"], - "bundleVersion" : mdmProps["device"]["ios"]["version"], - "appName" : mdmProps["device"]["ios"]["appName"] - }); - - response.contentType = "application/xml"; - response.content = iOSManifest; -} -%> \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/certificate.jag b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/certificate.jag deleted file mode 100755 index d3cb1c5d6..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/certificate.jag +++ /dev/null @@ -1,26 +0,0 @@ -<% -var HttpClient = Packages.org.apache.commons.httpclient.HttpClient; -var GetMethod = Packages.org.apache.commons.httpclient.methods.GetMethod; -var StringRequestEntity = Packages.org.apache.commons.httpclient.methods.StringRequestEntity; - -var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; -var caURL = mdmProps["iOSConfigRoot"] + 'ca'; -var client = new HttpClient(); -var method = new GetMethod(caURL); - -try { - client.executeMethod(method); - var status = method.getStatusCode(); - - if (status == 200) { - var stream = method.getResponseBody(); - response.contentType = "application/x-x509-ca-cert"; - var byteArrayInputStream = new Packages.java.io.ByteArrayInputStream(stream); - print(new Stream(byteArrayInputStream)); - } else { - response.sendRedirect("/errorpage"); - } -} catch (e) { - log.error("Error occurred when downloading CA " + e); -} -%> diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/config/ios-manifest-template.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/config/ios-manifest-template.hbs deleted file mode 100755 index 37deaf50c..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/app/modules/enrollments/ios/config/ios-manifest-template.hbs +++ /dev/null @@ -1,31 +0,0 @@ - - - - - items - - - assets - - - kind - software-package - url - {{url}} - - - metadata - - bundle-identifier - {{bundleID}} - bundle-version - {{bundleVersion}} - kind - software - title - {{appName}} - - - - - \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/jaggery.conf b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/jaggery.conf index 59caaa1ed..332c41fb8 100755 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/jaggery.conf +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/windows-web-agent/jaggery.conf @@ -15,26 +15,6 @@ "url": "/enrollment/windows/enroll", "path": "/app/modules/enrollments/windows/agent-enroll.jag" }, - { - "url": "/enrollment/ios/download-certificate", - "path": "/app/modules/enrollments/ios/certificate.jag" - }, - { - "url": "/enrollment/ios/download-agent", - "path": "/app/modules/enrollments/ios/agent.jag" - }, - { - "url": "/enrollment/ios/login", - "path": "/app/modules/enrollments/ios/agent-controller.jag" - }, - { - "url": "/enrollment/ios/enroll", - "path": "/app/modules/enrollments/ios/agent-enroll.jag" - }, - { - "url": "/enrollment/ios/check", - "path": "/app/modules/enrollments/ios/agent-check.jag" - }, { "url": "/api/invoker/*", "path": "/api/invoker-api.jag"