KEYCLOAK-13940 remove duplicated urlsafe decoding

This commit is contained in:
spurreiter 2020-04-28 14:53:34 +02:00 committed by Stian Thorgersen
parent 44c49d69a7
commit 6332ed42c0

View file

@ -18,9 +18,9 @@
(function(root, factory) {
if ( typeof exports === 'object' ) {
if ( typeof module === 'object' ) {
module.exports = factory( require("js-sha256"), require("base64-js") );
module.exports = factory( require("js-sha256"), require("base64-js") );
} else {
exports["keycloak"] = factory( require("js-sha256"), require("base64-js") );
exports["keycloak"] = factory( require("js-sha256"), require("base64-js") );
}
} else {
/**
@ -36,7 +36,7 @@
/**
* [base64-js]{@link https://github.com/beatgammit/base64-js}
*
* @version v1.3.0
* @version v1.3.0
* @author Kirill, Fomichev
* @copyright Kirill, Fomichev 2014
* @license MIT
@ -46,7 +46,7 @@
/**
* [promise-polyfill]{@link https://github.com/taylorhakes/promise-polyfill}
*
* @version v8.1.3
* @version v8.1.3
* @author Hakes, Taylor
* @copyright Hakes, Taylor 2014
* @license MIT
@ -56,7 +56,7 @@
var Keycloak = factory( root["sha256"], root["base64js"] );
root["Keycloak"] = Keycloak;
if ( typeof define === "function" && define.amd ) {
if ( typeof define === "function" && define.amd ) {
define( "keycloak", [], function () { return Keycloak; } );
}
}
@ -92,7 +92,7 @@
var promise = this.then(function handleSuccess(value) {
callback(value);
});
return toKeycloakPromise(promise);
};
@ -132,7 +132,7 @@
var useNonce = true;
var logInfo = createLogger(console.info);
var logWarn = createLogger(console.warn);
kc.init = function (initOptions) {
kc.authenticated = false;
@ -1037,8 +1037,7 @@
str = str.replace('/-/g', '+');
str = str.replace('/_/g', '/');
switch (str.length % 4)
{
switch (str.length % 4) {
case 0:
break;
case 2:
@ -1051,9 +1050,6 @@
throw 'Invalid token';
}
str = (str + '===').slice(0, str.length + (str.length % 4));
str = str.replace(/-/g, '+').replace(/_/g, '/');
str = decodeURIComponent(escape(atob(str)));
str = JSON.parse(str);