revert-70aa11f8
GPrathap 9 years ago
parent 37b6161bc6
commit 55a95cca86

@ -20,13 +20,19 @@ var onSuccess;
var onFail;
(function () {
var log = new Log("api/user-api.jag");
var log = new Log("/app/modules/login.js");
var constants = require("/app/modules/constants.js");
onSuccess = function (context) {
var properties;
var utility = require("/app/modules/utility.js").utility;
var apiWrapperUtil = require("/app/modules/api-wrapper-util.js").apiWrapperUtil;
var properties = {username: context.input.username, password: context.input.password};
apiWrapperUtil.setupAccessTokenPair("password", properties);
if(context.input.samlToken){
properties = {samlToken: context.input.samlToken};
apiWrapperUtil.setupAccessTokenPair(constants.GRANT_TYPE_SAML, properties);
}else{
properties = {username: context.input.username, password: context.input.password};
apiWrapperUtil.setupAccessTokenPair(constants.GRANT_TYPE_PASSWORD, properties);
}
};
onFail = function (error) {

@ -17,6 +17,7 @@
*/
var util = function () {
var log = new Log("/app/modules/util.js");
var module = {};
var Base64 = Packages.org.apache.commons.codec.binary.Base64;
var String = Packages.java.lang.String;

@ -534,7 +534,7 @@ var module = {};
ssoSessions[ssoSession.sessionId] = ssoSession;
var carbonUser = (require("carbon")).server.tenantUser(ssoSession.loggedInUser);
utils.setCurrentUser(carbonUser.username, carbonUser.domain, carbonUser.tenantId);
var scriptArgument = {input: {}, user: module.getCurrentUser()};
var scriptArgument = {input: {samlToken: ssoSession.samlToken}, user: module.getCurrentUser()};
handleEvent(OPERATION_LOGIN, EVENT_SUCCESS, scriptArgument);
} else {
var msg = "Cannot decode SAML login response.";

Loading…
Cancel
Save