|
|
@ -26,14 +26,16 @@ var onFail;
|
|
|
|
var utility = require("/app/modules/utility.js").utility;
|
|
|
|
var utility = require("/app/modules/utility.js").utility;
|
|
|
|
var apiWrapperUtil = require("/app/modules/oauth/token-handlers.js")["handlers"];
|
|
|
|
var apiWrapperUtil = require("/app/modules/oauth/token-handlers.js")["handlers"];
|
|
|
|
if (context.input.samlToken) {
|
|
|
|
if (context.input.samlToken) {
|
|
|
|
apiWrapperUtil.setupTokenPairBySamlGrantType(context.user.username, context.input.samlToken);
|
|
|
|
apiWrapperUtil.setupTokenPairBySamlGrantType(context.user.username + '@' + context.user.domain, context.input.samlToken);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
apiWrapperUtil.setupTokenPairByPasswordGrantType(context.input.username, context.input.password);
|
|
|
|
apiWrapperUtil.setupTokenPairByPasswordGrantType(context.input.username, context.input.password);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
|
|
|
|
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
|
|
|
|
var carbonServer = require("carbon").server;
|
|
|
|
var carbonServer = require("carbon").server;
|
|
|
|
(new carbonServer.Server({url: devicemgtProps["adminService"]}))
|
|
|
|
if (!context.input.samlToken) {
|
|
|
|
.login(context.input.username, context.input.password);
|
|
|
|
(new carbonServer.Server({url: devicemgtProps["adminService"]}))
|
|
|
|
|
|
|
|
.login(context.input.username, context.input.password);
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
onFail = function (error) {
|
|
|
|
onFail = function (error) {
|
|
|
|