keycloak-js
Advanced tools
Comparing version 4.3.0 to 4.4.0
{ | ||
"name": "keycloak", | ||
"version": "4.3.0", | ||
"version": "4.4.0", | ||
"main": "dist/keycloak.js", | ||
@@ -5,0 +5,0 @@ "ignore": [ |
@@ -6,3 +6,2 @@ (function(q,p){var h=function(k,h){var f=this;this.rpt=null;this.init=function(){var a=new XMLHttpRequest;a.open("GET",k.authServerUrl+"/realms/"+k.realm+"/.well-known/uma2-configuration");a.onreadystatechange=function(){4==a.readyState&&(200==a.status?f.config=JSON.parse(a.responseText):console.error("Could not obtain configuration from server."))};a.send(null)};this.authorize=function(a){this.then=function(e,h,m){if(a&&a.ticket){var d=new XMLHttpRequest;d.open("POST",f.config.token_endpoint,!0); | ||
k.clientId;e.claimToken&&(b+="\x26claim_token\x3d"+e.claimToken,e.claimTokenFormat&&(b+="\x26claim_token_format\x3d"+e.claimTokenFormat));var b=b+("\x26audience\x3d"+a),g=e.permissions;g||(g=[]);for(i=0;i<g.length;i++){var n=g[i],l=n.id;if(n.scopes&&0<n.scopes.length)for(l+="#",j=0;j<n.scopes.length;j++){var p=n.scopes[j];l.indexOf("#")!=l.length-1&&(l+=",");l+=p}b+="\x26permission\x3d"+l}if(g=e.metadata)g.responseIncludeResourceName&&(b+="\x26response_include_resource_name\x3d"+g.responseIncludeResourceName), | ||
g.responsePermissionsLimit&&(b+="\x26response_permissions_limit\x3d"+g.responsePermissionsLimit);f.rpt&&(b+="\x26rpt\x3d"+f.rpt);c.send(b)};return this};this.init(this);return this};"object"===typeof module&&module&&"object"===typeof module.exports?module.exports=h:(q.KeycloakAuthorization=h,"function"===typeof define&&define.amd&&define("keycloak-authorization",[],function(){return h}))})(window); | ||
//# sourceMappingURL=keycloak-authz.min.js.map | ||
g.responsePermissionsLimit&&(b+="\x26response_permissions_limit\x3d"+g.responsePermissionsLimit);f.rpt&&(b+="\x26rpt\x3d"+f.rpt);c.send(b)};return this};this.init(this);return this};"object"===typeof module&&module&&"object"===typeof module.exports?module.exports=h:(q.KeycloakAuthorization=h,"function"===typeof define&&define.amd&&define("keycloak-authorization",[],function(){return h}))})(window); |
@@ -219,2 +219,12 @@ /* | ||
interface KeycloakTokenParsed { | ||
exp?: number; | ||
iat?: number; | ||
nonce?: string; | ||
sub?: string; | ||
session_state?: string; | ||
realm_access?: { roles: string[] }; | ||
resource_access?: string[]; | ||
} | ||
// export interface KeycloakUserInfo {} | ||
@@ -273,11 +283,3 @@ | ||
*/ | ||
tokenParsed?: { | ||
exp?: number; | ||
iat?: number; | ||
nonce?: string; | ||
sub?: string; | ||
session_state?: string; | ||
realm_access?: { roles: string[] }; | ||
resource_access?: string[]; | ||
}; | ||
tokenParsed?: KeycloakTokenParsed; | ||
@@ -292,3 +294,3 @@ /** | ||
*/ | ||
refreshTokenParsed?: { nonce?: string }; | ||
refreshTokenParsed?: KeycloakTokenParsed; | ||
@@ -303,3 +305,3 @@ /** | ||
*/ | ||
idTokenParsed?: { nonce?: string }; | ||
idTokenParsed?: KeycloakTokenParsed; | ||
@@ -306,0 +308,0 @@ /** |
@@ -913,3 +913,3 @@ /* | ||
case 'implicit': | ||
supportedParams = ['access_token', 'id_token', 'state', 'session_state']; | ||
supportedParams = ['access_token', 'token_type', 'id_token', 'state', 'session_state', 'expires_in']; | ||
break; | ||
@@ -916,0 +916,0 @@ case 'hybrid': |
@@ -12,12 +12,12 @@ (function(h,I){var y=function(m){function p(){return"undefined"!==typeof b.authServerUrl?"/"==b.authServerUrl.charAt(b.authServerUrl.length-1)?b.authServerUrl+"realms/"+encodeURIComponent(b.realm):b.authServerUrl+"/realms/"+encodeURIComponent(b.realm):I}function v(a,c){function d(g,f,d,e){z=(z+(new Date).getTime())/2;w(g,f,d,z);C&&(b.tokenParsed&&b.tokenParsed.nonce!=a.storedNonce||b.refreshTokenParsed&&b.refreshTokenParsed.nonce!=a.storedNonce||b.idTokenParsed&&b.idTokenParsed.nonce!=a.storedNonce)? | ||
break;case 3:a+="\x3d";break;default:throw"Invalid token";}a=(a+"\x3d\x3d\x3d").slice(0,a.length+a.length%4);a=a.replace(/-/g,"+").replace(/_/g,"/");a=decodeURIComponent(escape(atob(a)));return a=JSON.parse(a)}function J(){for(var a=[],b=0;36>b;b++)a[b]="0123456789abcdef".substr(Math.floor(16*Math.random()),1);a[14]="4";a[19]="0123456789abcdef".substr(a[19]&3|8,1);a[8]=a[13]=a[18]=a[23]="-";return a.join("")}function x(a){a:{var c;switch(b.flow){case "standard":c=["code","state","session_state"]; | ||
break;case "implicit":c=["access_token","id_token","state","session_state"];break;case "hybrid":c=["access_token","id_token","code","state","session_state"]}c.push("error");c.push("error_description");c.push("error_uri");var d=a.indexOf("?"),e=a.indexOf("#"),f,g;"query"===b.responseMode&&-1!==d?(f=a.substring(0,d),g=K(a.substring(d+1,-1!==e?e:a.length),c),""!==g.paramsString&&(f+="?"+g.paramsString),-1!==e&&(f+=a.substring(e))):"fragment"===b.responseMode&&-1!==e&&(f=a.substring(0,e),g=K(a.substring(e+ | ||
1),c),""!==g.paramsString&&(f+="#"+g.paramsString));if(g&&g.oauthParams)if("standard"===b.flow||"hybrid"===b.flow){if((g.oauthParams.code||g.oauthParams.error)&&g.oauthParams.state){g.oauthParams.newUrl=f;a=g.oauthParams;break a}}else if("implicit"===b.flow&&(g.oauthParams.access_token||g.oauthParams.error)&&g.oauthParams.state){g.oauthParams.newUrl=f;a=g.oauthParams;break a}a=void 0}if(a){if(c=A.get(a.state))a.valid=!0,a.redirectUri=c.redirectUri,a.storedNonce=c.nonce,a.prompt=c.prompt;return a}} | ||
function K(a,b){a=a.split("\x26");for(var c={paramsString:"",oauthParams:{}},e=0;e<a.length;e++){var f=a[e].split("\x3d");-1!==b.indexOf(f[0])?c.oauthParams[f[0]]=f[1]:(""!==c.paramsString&&(c.paramsString+="\x26"),c.paramsString+=a[e])}return c}function l(){return"function"===typeof Promise?M():N()}function M(){var a={setSuccess:function(b){a.success=!0;a.resolve(b)},setError:function(b){a.success=!1;a.reject(b)}};a.promise=new Promise(function(b,d){a.resolve=b;a.reject=d});a.promise.success=function(b){a.promise.then(b); | ||
return a.promise};a.promise.error=function(b){a.promise.catch(b);return a.promise};return a}function N(){var a={setSuccess:function(b){a.success=!0;a.result=b;a.successCallback&&a.successCallback(b)},setError:function(b){a.error=!0;a.result=b;a.errorCallback&&a.errorCallback(b)},promise:{success:function(b){a.success?b(a.result):a.error||(a.successCallback=b);return a.promise},error:function(b){a.error?b(a.result):a.success||(a.errorCallback=b);return a.promise}}};return a}function E(){var a=l(); | ||
if(!k.enable||k.iframe)return a.setSuccess(),a.promise;var c=document.createElement("iframe");k.iframe=c;c.onload=function(){var c=b.endpoints.authorize();"/"===c.charAt(0)?(c=h.location.origin?h.location.origin:h.location.protocol+"//"+h.location.hostname+(h.location.port?":"+h.location.port:""),k.iframeOrigin=c):k.iframeOrigin=c.substring(0,c.indexOf("/",8));a.setSuccess();setTimeout(e,1E3*k.interval)};var d=b.endpoints.checkSessionIframe();c.setAttribute("src",d);c.setAttribute("title","keycloak-session-iframe"); | ||
c.style.display="none";document.body.appendChild(c);h.addEventListener("message",function(a){if(a.origin===k.iframeOrigin&&k.iframe.contentWindow===a.source&&("unchanged"==a.data||"changed"==a.data||"error"==a.data)){"unchanged"!=a.data&&b.clearToken();for(var c=k.callbackList.splice(0,k.callbackList.length),e=c.length-1;0<=e;--e){var d=c[e];"unchanged"==a.data?d.setSuccess():d.setError()}}},!1);var e=function(){B();b.token&&setTimeout(e,1E3*k.interval)};return a.promise}function B(){var a=l();if(k.iframe&& | ||
k.iframeOrigin){var c=b.clientId+" "+b.sessionId;k.callbackList.push(a);var d=k.iframeOrigin;1==k.callbackList.length&&k.iframe.contentWindow.postMessage(c,d)}else a.setSuccess();return a.promise}function F(a){if(!a||"default"==a)return{login:function(a){h.location.href=b.createLoginUrl(a);return l().promise},logout:function(a){h.location.href=b.createLogoutUrl(a);return l().promise},register:function(a){h.location.href=b.createRegisterUrl(a);return l().promise},accountManagement:function(){var a= | ||
b.createAccountUrl();if("undefined"!==typeof a)h.location.href=a;else throw"Not supported by the OIDC server";return l().promise},redirectUri:function(a,c){1==arguments.length&&(c=!0);return a&&a.redirectUri?a.redirectUri:b.redirectUri?b.redirectUri:location.href}};if("cordova"==a){k.enable=!1;var c=function(a,b,c){return h.cordova&&h.cordova.InAppBrowser?h.cordova.InAppBrowser.open(a,b,c):h.open(a,b,c)},d=function(a){return a&&a.cordovaOptions?Object.keys(a.cordovaOptions).reduce(function(b,c){b[c]= | ||
a.cordovaOptions[c];return b},{}):{}},e=function(a){return Object.keys(a).reduce(function(b,c){b.push(c+"\x3d"+a[c]);return b},[]).join(",")},f=function(a){var b=d(a);b.location="no";a&&"none"==a.prompt&&(b.hidden="yes");return e(b)};return{login:function(a){var g=l(),e=f(a);a=b.createLoginUrl(a);var d=c(a,"_blank",e),h=!1,k=!1;d.addEventListener("loadstart",function(a){0==a.url.indexOf("http://localhost")&&(a=x(a.url),v(a,g),k=!0,d.close(),h=!0)});d.addEventListener("loaderror",function(a){h||(0== | ||
a.url.indexOf("http://localhost")?(a=x(a.url),v(a,g),k=!0,d.close(),h=!0):(g.setError(),k=!0,d.close()))});d.addEventListener("exit",function(a){k||g.setError({reason:"closed_by_user"})});return g.promise},logout:function(a){var g=l();a=b.createLogoutUrl(a);var d=c(a,"_blank","location\x3dno,hidden\x3dyes"),e;d.addEventListener("loadstart",function(a){0==a.url.indexOf("http://localhost")&&d.close()});d.addEventListener("loaderror",function(a){0!=a.url.indexOf("http://localhost")&&(e=!0);d.close()}); | ||
break;case "implicit":c="access_token token_type id_token state session_state expires_in".split(" ");break;case "hybrid":c=["access_token","id_token","code","state","session_state"]}c.push("error");c.push("error_description");c.push("error_uri");var d=a.indexOf("?"),e=a.indexOf("#"),f,g;"query"===b.responseMode&&-1!==d?(f=a.substring(0,d),g=K(a.substring(d+1,-1!==e?e:a.length),c),""!==g.paramsString&&(f+="?"+g.paramsString),-1!==e&&(f+=a.substring(e))):"fragment"===b.responseMode&&-1!==e&&(f=a.substring(0, | ||
e),g=K(a.substring(e+1),c),""!==g.paramsString&&(f+="#"+g.paramsString));if(g&&g.oauthParams)if("standard"===b.flow||"hybrid"===b.flow){if((g.oauthParams.code||g.oauthParams.error)&&g.oauthParams.state){g.oauthParams.newUrl=f;a=g.oauthParams;break a}}else if("implicit"===b.flow&&(g.oauthParams.access_token||g.oauthParams.error)&&g.oauthParams.state){g.oauthParams.newUrl=f;a=g.oauthParams;break a}a=void 0}if(a){if(c=A.get(a.state))a.valid=!0,a.redirectUri=c.redirectUri,a.storedNonce=c.nonce,a.prompt= | ||
c.prompt;return a}}function K(a,b){a=a.split("\x26");for(var c={paramsString:"",oauthParams:{}},e=0;e<a.length;e++){var f=a[e].split("\x3d");-1!==b.indexOf(f[0])?c.oauthParams[f[0]]=f[1]:(""!==c.paramsString&&(c.paramsString+="\x26"),c.paramsString+=a[e])}return c}function l(){return"function"===typeof Promise?M():N()}function M(){var a={setSuccess:function(b){a.success=!0;a.resolve(b)},setError:function(b){a.success=!1;a.reject(b)}};a.promise=new Promise(function(b,d){a.resolve=b;a.reject=d});a.promise.success= | ||
function(b){a.promise.then(b);return a.promise};a.promise.error=function(b){a.promise.catch(b);return a.promise};return a}function N(){var a={setSuccess:function(b){a.success=!0;a.result=b;a.successCallback&&a.successCallback(b)},setError:function(b){a.error=!0;a.result=b;a.errorCallback&&a.errorCallback(b)},promise:{success:function(b){a.success?b(a.result):a.error||(a.successCallback=b);return a.promise},error:function(b){a.error?b(a.result):a.success||(a.errorCallback=b);return a.promise}}};return a} | ||
function E(){var a=l();if(!k.enable||k.iframe)return a.setSuccess(),a.promise;var c=document.createElement("iframe");k.iframe=c;c.onload=function(){var c=b.endpoints.authorize();"/"===c.charAt(0)?(c=h.location.origin?h.location.origin:h.location.protocol+"//"+h.location.hostname+(h.location.port?":"+h.location.port:""),k.iframeOrigin=c):k.iframeOrigin=c.substring(0,c.indexOf("/",8));a.setSuccess();setTimeout(e,1E3*k.interval)};var d=b.endpoints.checkSessionIframe();c.setAttribute("src",d);c.setAttribute("title", | ||
"keycloak-session-iframe");c.style.display="none";document.body.appendChild(c);h.addEventListener("message",function(a){if(a.origin===k.iframeOrigin&&k.iframe.contentWindow===a.source&&("unchanged"==a.data||"changed"==a.data||"error"==a.data)){"unchanged"!=a.data&&b.clearToken();for(var c=k.callbackList.splice(0,k.callbackList.length),e=c.length-1;0<=e;--e){var d=c[e];"unchanged"==a.data?d.setSuccess():d.setError()}}},!1);var e=function(){B();b.token&&setTimeout(e,1E3*k.interval)};return a.promise} | ||
function B(){var a=l();if(k.iframe&&k.iframeOrigin){var c=b.clientId+" "+b.sessionId;k.callbackList.push(a);var d=k.iframeOrigin;1==k.callbackList.length&&k.iframe.contentWindow.postMessage(c,d)}else a.setSuccess();return a.promise}function F(a){if(!a||"default"==a)return{login:function(a){h.location.href=b.createLoginUrl(a);return l().promise},logout:function(a){h.location.href=b.createLogoutUrl(a);return l().promise},register:function(a){h.location.href=b.createRegisterUrl(a);return l().promise}, | ||
accountManagement:function(){var a=b.createAccountUrl();if("undefined"!==typeof a)h.location.href=a;else throw"Not supported by the OIDC server";return l().promise},redirectUri:function(a,c){1==arguments.length&&(c=!0);return a&&a.redirectUri?a.redirectUri:b.redirectUri?b.redirectUri:location.href}};if("cordova"==a){k.enable=!1;var c=function(a,b,c){return h.cordova&&h.cordova.InAppBrowser?h.cordova.InAppBrowser.open(a,b,c):h.open(a,b,c)},d=function(a){return a&&a.cordovaOptions?Object.keys(a.cordovaOptions).reduce(function(b, | ||
c){b[c]=a.cordovaOptions[c];return b},{}):{}},e=function(a){return Object.keys(a).reduce(function(b,c){b.push(c+"\x3d"+a[c]);return b},[]).join(",")},f=function(a){var b=d(a);b.location="no";a&&"none"==a.prompt&&(b.hidden="yes");return e(b)};return{login:function(a){var g=l(),e=f(a);a=b.createLoginUrl(a);var d=c(a,"_blank",e),h=!1,k=!1;d.addEventListener("loadstart",function(a){0==a.url.indexOf("http://localhost")&&(a=x(a.url),v(a,g),k=!0,d.close(),h=!0)});d.addEventListener("loaderror",function(a){h|| | ||
(0==a.url.indexOf("http://localhost")?(a=x(a.url),v(a,g),k=!0,d.close(),h=!0):(g.setError(),k=!0,d.close()))});d.addEventListener("exit",function(a){k||g.setError({reason:"closed_by_user"})});return g.promise},logout:function(a){var g=l();a=b.createLogoutUrl(a);var d=c(a,"_blank","location\x3dno,hidden\x3dyes"),e;d.addEventListener("loadstart",function(a){0==a.url.indexOf("http://localhost")&&d.close()});d.addEventListener("loaderror",function(a){0!=a.url.indexOf("http://localhost")&&(e=!0);d.close()}); | ||
d.addEventListener("exit",function(a){e?g.setError():(b.clearToken(),g.setSuccess())});return g.promise},register:function(){var a=b.createRegisterUrl(),d=f(options),e=c(a,"_blank",d);e.addEventListener("loadstart",function(a){0==a.url.indexOf("http://localhost")&&e.close()})},accountManagement:function(){var a=b.createAccountUrl();if("undefined"!==typeof a){var d=c(a,"_blank","location\x3dno");d.addEventListener("loadstart",function(a){0==a.url.indexOf("http://localhost")&&d.close()})}else throw"Not supported by the OIDC server"; | ||
@@ -42,3 +42,2 @@ },redirectUri:function(a){return"http://localhost"}}}if("cordova-native"==a)return k.enable=!1,{login:function(a){var c=l();a=b.createLoginUrl(a);universalLinks.subscribe("keycloak",function(a){universalLinks.unsubscribe("keycloak");h.cordova.plugins.browsertab.close();a=x(a.url);v(a,c)});h.cordova.plugins.browsertab.openUrl(a);return c.promise},logout:function(a){var c=l();a=b.createLogoutUrl(a);universalLinks.subscribe("keycloak",function(a){universalLinks.unsubscribe("keycloak");h.cordova.plugins.browsertab.close(); | ||
c&&(localStorage.removeItem(b),c=JSON.parse(c));a();return c}};this.add=function(b){a();var c="kc-callback-"+b.state;b.expires=(new Date).getTime()+36E5;localStorage.setItem(c,JSON.stringify(b))}},H=function(){if(!(this instanceof H))return new H;this.get=function(c){if(c){var d;a:{d="kc-callback-"+c+"\x3d";for(var f=document.cookie.split(";"),g=0;g<f.length;g++){for(var h=f[g];" "==h.charAt(0);)h=h.substring(1);if(0==h.indexOf(d)){d=h.substring(d.length,h.length);break a}}d=""}b("kc-callback-"+c, | ||
"",a(-100));if(d)return JSON.parse(d)}};this.add=function(c){b("kc-callback-"+c.state,JSON.stringify(c),a(60))};this.removeItem=function(c){b(c,"",a(-100))};var a=function(a){var b=new Date;b.setTime(b.getTime()+6E4*a);return b},b=function(a,b,c){a=a+"\x3d"+b+"; expires\x3d"+c.toUTCString()+"; ";document.cookie=a}}};"object"===typeof module&&module&&"object"===typeof module.exports?module.exports=y:(h.Keycloak=y,"function"===typeof define&&define.amd&&define("keycloak",[],function(){return y}))})(window); | ||
//# sourceMappingURL=keycloak.min.js.map | ||
"",a(-100));if(d)return JSON.parse(d)}};this.add=function(c){b("kc-callback-"+c.state,JSON.stringify(c),a(60))};this.removeItem=function(c){b(c,"",a(-100))};var a=function(a){var b=new Date;b.setTime(b.getTime()+6E4*a);return b},b=function(a,b,c){a=a+"\x3d"+b+"; expires\x3d"+c.toUTCString()+"; ";document.cookie=a}}};"object"===typeof module&&module&&"object"===typeof module.exports?module.exports=y:(h.Keycloak=y,"function"===typeof define&&define.amd&&define("keycloak",[],function(){return y}))})(window); |
{ | ||
"name": "keycloak-js", | ||
"version": "4.3.0", | ||
"version": "4.4.0", | ||
"description": "Keycloak Adapter", | ||
@@ -5,0 +5,0 @@ "main": "dist/keycloak.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
250002
2191