fixing windows enrollment flow

revert-dabc3590
Hasunie 8 years ago
parent 0fd317d027
commit 35ba0b2a9b

@ -28,17 +28,17 @@
<baseDirectory>${basedir}/src</baseDirectory> <baseDirectory>${basedir}/src</baseDirectory>
<fileSets> <fileSets>
<fileSet> <fileSet>
<directory>${basedir}/src/main/resources/jaggeryapps/devicemgt</directory> <directory>${basedir}/src/main/resources/jaggeryapps/windows-web-agent</directory>
<outputDirectory>/devicemgt</outputDirectory> <outputDirectory>/windows-web-agent</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes> <useDefaultExcludes>true</useDefaultExcludes>
</fileSet> </fileSet>
<fileSet> <fileSet>
<directory>${basedir}/src/main/resources/jaggeryapps/uuf-template-app</directory> <directory>${basedir}/src/main/resources/jaggeryapps/devicemgt</directory>
<outputDirectory>/windows-web-agent</outputDirectory> <outputDirectory>/devicemgt</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes> <useDefaultExcludes>true</useDefaultExcludes>
</fileSet> </fileSet>
<fileSet> <fileSet>
<directory>${basedir}/src/main/resources/jaggeryapps/windows-web-agent</directory> <directory>${basedir}/src/main/resources/jaggeryapps/uuf-template-app</directory>
<outputDirectory>/windows-web-agent</outputDirectory> <outputDirectory>/windows-web-agent</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes> <useDefaultExcludes>true</useDefaultExcludes>
</fileSet> </fileSet>

@ -312,7 +312,7 @@ deviceModule = function () {
var url; var url;
var license; var license;
if (deviceType == "windows") { if (deviceType == "windows") {
url = devicemgtProps["httpURL"] + "/mdm-windows-agent/services/device/license"; url = devicemgtProps["httpURL"] + "/api/device-mgt/windows/v1.0/services/configuration/license";
} else if (deviceType == "ios") { } else if (deviceType == "ios") {
url = devicemgtProps["httpsURL"] + "/ios-enrollment/license/"; url = devicemgtProps["httpsURL"] + "/ios-enrollment/license/";
} }

@ -63,7 +63,7 @@ if (platform != "Windows Phone") {
var status = restAPIResponse["status"]; var status = restAPIResponse["status"];
if (status == 200) { if (status == 200) {
session.put("authenticatedUser", username); session.put("authenticatedUser", username);
session.put("windowsBinaryToken", parse(xmlHttpRequest["responseText"]).UserToken); session.put("windowsBinaryToken", parse(restAPIResponse["responseText"]).UserToken);
response.sendRedirect(mdmProps["appContext"] + "enrollments/windows/license-agent"); response.sendRedirect(mdmProps["appContext"] + "enrollments/windows/license-agent");
} else if (status == 403) { } else if (status == 403) {
response.sendRedirect(mdmProps["appContext"] + "enrollments/windows/login-agent?error=auth-failed"); response.sendRedirect(mdmProps["appContext"] + "enrollments/windows/login-agent?error=auth-failed");

@ -36,10 +36,10 @@ if (platform != "Windows Phone") {
if (!authenticatedUser) { if (!authenticatedUser) {
response.sendRedirect(mdmProps["appContext"] + "enrollments/error/unintentional-request"); response.sendRedirect(mdmProps["appContext"] + "enrollments/error/unintentional-request");
} else { } else {
var enrollmentUtils = require("/modules/enrollments/util/utils.js")["methods"]; var enrollmentUtils = require("/app/modules/enrollments/util/utils.js")["methods"];
var Handlebars = require("/lib/handlebars-v2.0.0.js")["Handlebars"]; var Handlebars = require("/lib/modules/handlebars/handlebars-v2.0.0.js")["Handlebars"];
var template = Handlebars.compile(enrollmentUtils. var template = Handlebars.compile(enrollmentUtils.
getResource("/modules/enrollments/windows/config/workplace-switch-request-template.hbs")); getResource("/app/modules/enrollments/windows/config/workplace-switch-request-template.hbs"));
var windowsWorkplaceAppID = session.get("windowsWorkplaceAppID"); var windowsWorkplaceAppID = session.get("windowsWorkplaceAppID");
var windowsBinaryToken = session.get("windowsBinaryToken"); var windowsBinaryToken = session.get("windowsBinaryToken");

@ -142,6 +142,7 @@ var handlers = function () {
"client credentials to session context as the server is unable to obtain " + "client credentials to session context as the server is unable to obtain " +
"dynamic client credentials - setUpEncodedTenantBasedClientAppCredentials(x)"); "dynamic client credentials - setUpEncodedTenantBasedClientAppCredentials(x)");
} else { } else {
if (devicemgtProps["apimgt-gateway"]) {
var jwtToken = tokenUtil.getAccessTokenByJWTGrantType(dynamicClientAppCredentials); var jwtToken = tokenUtil.getAccessTokenByJWTGrantType(dynamicClientAppCredentials);
if (!jwtToken) { if (!jwtToken) {
throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " + throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " +
@ -163,6 +164,14 @@ var handlers = function () {
encodedTenantBasedClientAppCredentials); encodedTenantBasedClientAppCredentials);
} }
} }
} else {
var encodedTenantBasedClientAppCredentials =
tokenUtil.encode(dynamicClientAppCredentials["clientId"] + ":" +
dynamicClientAppCredentials["clientSecret"]);
// setting up encoded tenant based client credentials to session context.
session.put(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"],
encodedTenantBasedClientAppCredentials);
}
} }
} }
}; };

@ -30,7 +30,7 @@
</jndiConfig> </jndiConfig>
<definition type="RDBMS"> <definition type="RDBMS">
<configuration> <configuration>
<url>jdbc:h2:repository/database/WindowsDM_DB;DB_CLOSE_ON_EXIT=FALSE <url>jdbc:h2:repository/database/WSO2MobileWindows_DB;DB_CLOSE_ON_EXIT=FALSE
</url> </url>
<username>wso2carbon</username> <username>wso2carbon</username>
<password>wso2carbon</password> <password>wso2carbon</password>

@ -19,6 +19,8 @@
--> -->
<DeviceTypeConfiguration name="windows"> <DeviceTypeConfiguration name="windows">
<DeviceDetails table-id="WIN_DEVICE"/>
<License> <License>
<Language>en_US</Language> <Language>en_US</Language>
<Version>1.0.0</Version> <Version>1.0.0</Version>
@ -37,7 +39,6 @@
<Table name="WIN_DEVICE"> <Table name="WIN_DEVICE">
<PrimaryKey>DEVICE_ID</PrimaryKey> <PrimaryKey>DEVICE_ID</PrimaryKey>
<Attributes> <Attributes>
<Attribute>DEVICE_ID</Attribute>
<Attribute>CHANNEL_URI</Attribute> <Attribute>CHANNEL_URI</Attribute>
<Attribute>DEVICE_INFO</Attribute> <Attribute>DEVICE_INFO</Attribute>
<Attribute>IMEI</Attribute> <Attribute>IMEI</Attribute>
@ -50,25 +51,64 @@
<Attribute>SERIAL</Attribute> <Attribute>SERIAL</Attribute>
<Attribute>MAC_ADDRESS</Attribute> <Attribute>MAC_ADDRESS</Attribute>
<Attribute>DEVICE_NAME</Attribute> <Attribute>DEVICE_NAME</Attribute>
<Attribute>OS_BUILD_DATE</Attribute>
</Attributes> </Attributes>
</Table> </Table>
</tableConfig> </tableConfig>
</DataSource> </DataSource>
<Features> <Features>
<Feature code="abc"> <Feature code="DEVICE_LOCK">
<Name>abc</Name> <Name>Device Lock</Name>
<Description>this is a feature</Description> <Description>Lock the device</Description>
<Operation context="/bulb/{state}" method="PUT"> <Operation context="windows/lock-devices" method="POST">
<QueryParameters> </Operation>
<Parameter>deviceId</Parameter> </Feature>
</QueryParameters> <Feature code="DISENROLL">
<FormParameters> <Name>Device Lock</Name>
<Parameter>test</Parameter> <Description>Lock the device</Description>
</FormParameters> <Operation context="windows/disenroll-devices" method="POST">
</Operation>
</Feature>
<Feature code="WIPE_DATA">
<Name>Device Lock</Name>
<Description>Lock the device</Description>
<Operation context="windows/wipe-devices" method="POST">
</Operation>
</Feature>
<Feature code="DEVICE_RING">
<Name>Device Lock</Name>
<Description>Lock the device</Description>
<Operation context="windows/ring-devices" method="POST">
</Operation>
</Feature>
<Feature code="LOCK_RESET">
<Name>Device Lock</Name>
<Description>Lock the device</Description>
<Operation context="windows/lock-reset-devices" method="POST">
</Operation>
</Feature>
<Feature code="PASSCODE_POLICY">
<Name>Password Policy</Name>
<Description>Set passcode policy</Description>
<Operation context="" method="POST">
</Operation>
</Feature>
<Feature code="CAMERA">
<Name>Camera Enable/Disable</Name>
<Description>Enable/Disable camera</Description>
<Operation context="" method="POST">
</Operation>
</Feature>
<Feature code="ENCRYPT_STORAGE">
<Name>Encrypt Storage</Name>
<Description>Encrypt the device storage</Description>
<Operation context="" method="POST">
</Operation> </Operation>
</Feature> </Feature>
</Features> </Features>
<DeviceAuthorizationConfig>
<authorizationRequired>false</authorizationRequired>
</DeviceAuthorizationConfig>
</DeviceTypeConfiguration> </DeviceTypeConfiguration>

@ -18,7 +18,12 @@ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../dep
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.qr-modal);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-mod);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../dbscripts/cdm/plugins/windows);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../dbscripts/cdm/plugins/windows);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../database/WSO2MobileWindows_DB.h2.db);\ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../database/WSO2MobileWindows_DB.h2.db);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../. org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../.

Loading…
Cancel
Save