|
|
@ -41,25 +41,24 @@ var utils = function () {
|
|
|
|
return String(Base64.decodeBase64(String(payload).getBytes()));
|
|
|
|
return String(Base64.decodeBase64(String(payload).getBytes()));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
publicMethods["getDynamicClientAppCredentials"] = function () {
|
|
|
|
publicMethods["getDynamicClientAppCredentials"] = function (username, password) {
|
|
|
|
// setting up dynamic client application properties
|
|
|
|
// setting up dynamic client application properties
|
|
|
|
var dcAppProperties = {
|
|
|
|
var dcAppProperties = {
|
|
|
|
"applicationType": deviceMgtProps["oauthProvider"]["appRegistration"]["appType"],
|
|
|
|
"applicationName": deviceMgtProps["oauthProvider"]["appRegistration"]["applicationName"],
|
|
|
|
"clientName": deviceMgtProps["oauthProvider"]["appRegistration"]["clientName"],
|
|
|
|
"tags": deviceMgtProps["oauthProvider"]["appRegistration"]["tags"],
|
|
|
|
"owner": deviceMgtProps["oauthProvider"]["appRegistration"]["owner"],
|
|
|
|
"isAllowedToAllDomains": deviceMgtProps["oauthProvider"]["appRegistration"]["isAllowedToAllDomains"],
|
|
|
|
"tokenScope": deviceMgtProps["oauthProvider"]["appRegistration"]["tokenScope"],
|
|
|
|
"isMappingAnExistingOAuthApp": deviceMgtProps["oauthProvider"]["appRegistration"]["isMappingAnExistingOAuthApp"]
|
|
|
|
"grantType": deviceMgtProps["oauthProvider"]["appRegistration"]["grantType"],
|
|
|
|
|
|
|
|
"callbackUrl": deviceMgtProps["oauthProvider"]["appRegistration"]["callbackUrl"],
|
|
|
|
|
|
|
|
"saasApp" : true
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// calling dynamic client app registration service endpoint
|
|
|
|
// calling dynamic client app registration service endpoint
|
|
|
|
var requestURL = deviceMgtProps["oauthProvider"]["appRegistration"]
|
|
|
|
var requestURL = deviceMgtProps["oauthProvider"]["appRegistration"]
|
|
|
|
["dynamicClientAppRegistrationServiceURL"];
|
|
|
|
["dynamicClientAppRegistrationServiceURL"];
|
|
|
|
var requestPayload = dcAppProperties;
|
|
|
|
var requestPayload = dcAppProperties;
|
|
|
|
|
|
|
|
var encodedBasicOauth = publicMethods.encode(username + ":" + password);
|
|
|
|
|
|
|
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
xhr.open("POST", requestURL, false);
|
|
|
|
xhr.open("POST", requestURL, false);
|
|
|
|
xhr.setRequestHeader("Content-Type", "application/json");
|
|
|
|
xhr.setRequestHeader("Content-Type", "application/json");
|
|
|
|
|
|
|
|
xhr.setRequestHeader("Authorization","Basic "+ encodedBasicOauth);
|
|
|
|
xhr.send(stringify(requestPayload));
|
|
|
|
xhr.send(stringify(requestPayload));
|
|
|
|
|
|
|
|
|
|
|
|
var dynamicClientAppCredentials = {};
|
|
|
|
var dynamicClientAppCredentials = {};
|
|
|
|