|
|
@ -152,11 +152,11 @@ var utils = function () {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
publicMethods["getTokenPairByPasswordGrantType"] = function (username, password, encodedClientAppCredentials, scopes) {
|
|
|
|
publicMethods["getTokenPairAndScopesByPasswordGrantType"] = function (username, password, encodedClientAppCredentials, scopes) {
|
|
|
|
if (!username || !password || !encodedClientAppCredentials || !scopes) {
|
|
|
|
if (!username || !password || !encodedClientAppCredentials || !scopes) {
|
|
|
|
log.error("{/app/modules/oauth/token-handler-utils.js} Error in retrieving access token by password " +
|
|
|
|
log.error("{/app/modules/oauth/token-handler-utils.js} Error in retrieving access token by password " +
|
|
|
|
"grant type. No username, password, encoded client app credentials or scopes are " +
|
|
|
|
"grant type. No username, password, encoded client app credentials or scopes are " +
|
|
|
|
"found - getTokenPairByPasswordGrantType(a, b, c, d)");
|
|
|
|
"found - getTokenPairAndScopesByPasswordGrantType(a, b, c, d)");
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// calling oauth provider token service endpoint
|
|
|
|
// calling oauth provider token service endpoint
|
|
|
@ -179,17 +179,17 @@ var utils = function () {
|
|
|
|
return tokenData;
|
|
|
|
return tokenData;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
log.error("{/app/modules/oauth/token-handler-utils.js} Error in retrieving access token " +
|
|
|
|
log.error("{/app/modules/oauth/token-handler-utils.js} Error in retrieving access token " +
|
|
|
|
"by password grant type - getTokenPairByPasswordGrantType(a, b, c, d)");
|
|
|
|
"by password grant type - getTokenPairAndScopesByPasswordGrantType(a, b, c, d)");
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
publicMethods["getTokenPairBySAMLGrantType"] = function (assertion, encodedClientAppCredentials, scopes) {
|
|
|
|
publicMethods["getTokenPairAndScopesBySAMLGrantType"] = function (assertion, encodedClientAppCredentials, scopes) {
|
|
|
|
if (!assertion || !encodedClientAppCredentials || !scopes) {
|
|
|
|
if (!assertion || !encodedClientAppCredentials || !scopes) {
|
|
|
|
log.error("{/app/modules/oauth/token-handler-utils.js} Error in retrieving access token by saml " +
|
|
|
|
log.error("{/app/modules/oauth/token-handler-utils.js} Error in retrieving access token by saml " +
|
|
|
|
"grant type. No assertion, encoded client app credentials or scopes are " +
|
|
|
|
"grant type. No assertion, encoded client app credentials or scopes are " +
|
|
|
|
"found - getTokenPairBySAMLGrantType(x, y, z)");
|
|
|
|
"found - getTokenPairAndScopesBySAMLGrantType(x, y, z)");
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
var assertionXML = publicMethods.decode(assertion);
|
|
|
|
var assertionXML = publicMethods.decode(assertion);
|
|
|
@ -205,7 +205,7 @@ var utils = function () {
|
|
|
|
var extractedAssertion;
|
|
|
|
var extractedAssertion;
|
|
|
|
if (assertionStartIndex == -1 || assertionEndIndex == -1) {
|
|
|
|
if (assertionStartIndex == -1 || assertionEndIndex == -1) {
|
|
|
|
log.error("{/app/modules/oauth/token-handler-utils.js} Error in retrieving access " +
|
|
|
|
log.error("{/app/modules/oauth/token-handler-utils.js} Error in retrieving access " +
|
|
|
|
"token by saml grant type. Issue in assertion format - getTokenPairBySAMLGrantType(x, y, z)");
|
|
|
|
"token by saml grant type. Issue in assertion format - getTokenPairAndScopesBySAMLGrantType(x, y, z)");
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
extractedAssertion = assertionXML.
|
|
|
|
extractedAssertion = assertionXML.
|
|
|
@ -232,7 +232,7 @@ var utils = function () {
|
|
|
|
return tokenData;
|
|
|
|
return tokenData;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
log.error("{/app/modules/oauth/token-handler-utils.js} Error in retrieving access token " +
|
|
|
|
log.error("{/app/modules/oauth/token-handler-utils.js} Error in retrieving access token " +
|
|
|
|
"by password grant type - getTokenPairBySAMLGrantType(x, y, z)");
|
|
|
|
"by password grant type - getTokenPairAndScopesBySAMLGrantType(x, y, z)");
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|