|
|
@ -24,10 +24,8 @@ var util = function () {
|
|
|
|
|
|
|
|
|
|
|
|
var Base64 = Packages.org.apache.commons.codec.binary.Base64;
|
|
|
|
var Base64 = Packages.org.apache.commons.codec.binary.Base64;
|
|
|
|
var String = Packages.java.lang.String;
|
|
|
|
var String = Packages.java.lang.String;
|
|
|
|
var deviceMgtProps = require("/app/conf/reader/main.js")["conf"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var adminUser = deviceMgtProps["adminUser"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var deviceMgtProps = require("/app/conf/reader/main.js")["conf"];
|
|
|
|
var constants = require("/app/modules/constants.js");
|
|
|
|
var constants = require("/app/modules/constants.js");
|
|
|
|
var carbon = require("carbon");
|
|
|
|
var carbon = require("carbon");
|
|
|
|
|
|
|
|
|
|
|
@ -225,7 +223,7 @@ var util = function () {
|
|
|
|
"username - getTenantBasedClientAppCredentials(x, y)");
|
|
|
|
"username - getTenantBasedClientAppCredentials(x, y)");
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
var cachedTenantBasedClientAppCredentials = publicMethods.
|
|
|
|
var cachedTenantBasedClientAppCredentials = privateMethods.
|
|
|
|
getCachedTenantBasedClientAppCredentials(tenantDomain);
|
|
|
|
getCachedTenantBasedClientAppCredentials(tenantDomain);
|
|
|
|
if (cachedTenantBasedClientAppCredentials) {
|
|
|
|
if (cachedTenantBasedClientAppCredentials) {
|
|
|
|
return cachedTenantBasedClientAppCredentials;
|
|
|
|
return cachedTenantBasedClientAppCredentials;
|
|
|
@ -247,7 +245,7 @@ var util = function () {
|
|
|
|
var tenantBasedClientAppCredentials = {};
|
|
|
|
var tenantBasedClientAppCredentials = {};
|
|
|
|
tenantBasedClientAppCredentials["clientId"] = responsePayload["client_id"];
|
|
|
|
tenantBasedClientAppCredentials["clientId"] = responsePayload["client_id"];
|
|
|
|
tenantBasedClientAppCredentials["clientSecret"] = responsePayload["client_secret"];
|
|
|
|
tenantBasedClientAppCredentials["clientSecret"] = responsePayload["client_secret"];
|
|
|
|
publicMethods.
|
|
|
|
privateMethods.
|
|
|
|
setCachedTenantBasedClientAppCredentials(tenantDomain, tenantBasedClientAppCredentials);
|
|
|
|
setCachedTenantBasedClientAppCredentials(tenantDomain, tenantBasedClientAppCredentials);
|
|
|
|
return tenantBasedClientAppCredentials;
|
|
|
|
return tenantBasedClientAppCredentials;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -260,7 +258,7 @@ var util = function () {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
publicMethods.setCachedTenantBasedClientAppCredentials = function (tenantDomain, clientCredentials) {
|
|
|
|
privateMethods.setCachedTenantBasedClientAppCredentials = function (tenantDomain, clientCredentials) {
|
|
|
|
var cachedTenantBasedClientAppCredentialsMap = application.get(constants["CACHED_CREDENTIALS"]);
|
|
|
|
var cachedTenantBasedClientAppCredentialsMap = application.get(constants["CACHED_CREDENTIALS"]);
|
|
|
|
if (!cachedTenantBasedClientAppCredentialsMap) {
|
|
|
|
if (!cachedTenantBasedClientAppCredentialsMap) {
|
|
|
|
cachedTenantBasedClientAppCredentialsMap = {};
|
|
|
|
cachedTenantBasedClientAppCredentialsMap = {};
|
|
|
@ -271,7 +269,7 @@ var util = function () {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
publicMethods.getCachedTenantBasedClientAppCredentials = function (tenantDomain) {
|
|
|
|
privateMethods.getCachedTenantBasedClientAppCredentials = function (tenantDomain) {
|
|
|
|
var cachedTenantBasedClientAppCredentialsMap = application.get(constants["CACHED_CREDENTIALS"]);
|
|
|
|
var cachedTenantBasedClientAppCredentialsMap = application.get(constants["CACHED_CREDENTIALS"]);
|
|
|
|
if (!cachedTenantBasedClientAppCredentialsMap ||
|
|
|
|
if (!cachedTenantBasedClientAppCredentialsMap ||
|
|
|
|
!cachedTenantBasedClientAppCredentialsMap[tenantDomain]) {
|
|
|
|
!cachedTenantBasedClientAppCredentialsMap[tenantDomain]) {
|
|
|
|