Updating token-handler-utils with suppressed warnings for java packg imports

revert-70aa11f8
dilanua 8 years ago
parent 303f16e747
commit bbff93adcc

@ -19,22 +19,26 @@
var utils = function () { var utils = function () {
var log = new Log("/app/modules/oauth/token-handler-utils.js"); var log = new Log("/app/modules/oauth/token-handler-utils.js");
var deviceMgtProps = require("/app/conf/reader/main.js")["conf"]; var deviceMgtProps = require("/app/modules/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");
//noinspection JSUnresolvedVariable
var Base64 = Packages.org.apache.commons.codec.binary.Base64; var Base64 = Packages.org.apache.commons.codec.binary.Base64;
//noinspection JSUnresolvedVariable
var String = Packages.java.lang.String; var String = Packages.java.lang.String;
var publicMethods = {}; var publicMethods = {};
var privateMethods = {}; var privateMethods = {};
publicMethods.encode = function (payload) { publicMethods.encode = function (payload) {
return new String(Base64.encodeBase64(new String(payload).getBytes())); //noinspection JSUnresolvedFunction
return String(Base64.encodeBase64(String(payload).getBytes()));
}; };
publicMethods.decode = function (payload) { publicMethods.decode = function (payload) {
return new String(Base64.decodeBase64(new String(payload).getBytes())); //noinspection JSUnresolvedFunction
return String(Base64.decodeBase64(String(payload).getBytes()));
}; };
publicMethods.getDynamicClientAppCredentials = function () { publicMethods.getDynamicClientAppCredentials = function () {
@ -117,8 +121,8 @@ var utils = function () {
} else { } else {
var assertionXML = publicMethods.decode(assertion); var assertionXML = publicMethods.decode(assertion);
/* /*
TODO: make assertion extraction with proper parsing. Since Jaggery XML parser seem TODO: make assertion extraction with proper parsing.
to add formatting which causes signature verification to fail. Since Jaggery XML parser seem to add formatting which causes signature verification to fail.
*/ */
var assertionStartMarker = "<saml2:Assertion"; var assertionStartMarker = "<saml2:Assertion";
var assertionEndMarker = "<\/saml2:Assertion>"; var assertionEndMarker = "<\/saml2:Assertion>";
@ -203,7 +207,9 @@ var utils = function () {
} else { } else {
var JWTClientManagerServicePackagePath = var JWTClientManagerServicePackagePath =
"org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService"; "org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService";
//noinspection JSUnresolvedFunction, JSUnresolvedVariable
var JWTClientManagerService = carbon.server.osgiService(JWTClientManagerServicePackagePath); var JWTClientManagerService = carbon.server.osgiService(JWTClientManagerServicePackagePath);
//noinspection JSUnresolvedFunction
var jwtClient = JWTClientManagerService.getJWTClient(); var jwtClient = JWTClientManagerService.getJWTClient();
// returning access token by JWT grant type // returning access token by JWT grant type
return jwtClient.getAccessToken(clientAppCredentials["clientId"], clientAppCredentials["clientSecret"], return jwtClient.getAccessToken(clientAppCredentials["clientId"], clientAppCredentials["clientSecret"],
@ -218,6 +224,7 @@ var utils = function () {
"as input - getTenantBasedClientAppCredentials(x, y)"); "as input - getTenantBasedClientAppCredentials(x, y)");
return null; return null;
} else { } else {
//noinspection JSUnresolvedFunction, JSUnresolvedVariable
var tenantDomain = carbon.server.tenantDomain({username: username}); var tenantDomain = carbon.server.tenantDomain({username: username});
if (!tenantDomain) { if (!tenantDomain) {
log.error("{/app/modules/oauth/token-handler-utils.js} Error in retrieving tenant " + log.error("{/app/modules/oauth/token-handler-utils.js} Error in retrieving tenant " +

Loading…
Cancel
Save