@ebrains/vue 0.0.1-alpha.1 → 0.2.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/arrow-diagonal-black-8f0494c3-CYl9yYTl.mjs +4 -0
- package/arrow-diagonal-black-8f0494c3-DqsB6ni-.js +1 -0
- package/arrow-right-9322ba8a-DBcxNU_p.js +3 -0
- package/arrow-right-9322ba8a-DHq-_PPe.mjs +6 -0
- package/bluesky-cc5edd2d-DaFQc-pr.js +12 -0
- package/bluesky-cc5edd2d-DfuDDO5h.mjs +15 -0
- package/chevron-down-6144c823-DWGlv9eV.mjs +13 -0
- package/chevron-down-6144c823-D_8976Ke.js +10 -0
- package/chevron-left-ca6c66e1-DANhLw_T.mjs +12 -0
- package/chevron-left-ca6c66e1-uCH5SUhm.js +9 -0
- package/chevron-right-b88ed2d4-C7dkTMvP.js +3 -0
- package/chevron-right-b88ed2d4-CgEZBvy7.mjs +6 -0
- package/chevron-up-c66bd477-ByW7R48t.js +10 -0
- package/chevron-up-c66bd477-CETJkshq.mjs +13 -0
- package/close-87fc0d63-Cbd-ScJr.js +3 -0
- package/close-87fc0d63-DtDU2HIU.mjs +6 -0
- package/color-0ba8ed56-BVeDdJAE.js +1 -0
- package/color-0ba8ed56-D-UJpBQL.mjs +207 -0
- package/color-primary-palette_6.entry-CfqMCd3g.mjs +300 -0
- package/color-primary-palette_6.entry-CoXWiKJ3.js +1 -0
- package/copy-03b72cb6-B_WCNQrG.mjs +6 -0
- package/copy-03b72cb6-CZAFAegx.js +3 -0
- package/correct-use-of-colors.entry-CfXsWbhB.js +1 -0
- package/correct-use-of-colors.entry-CotQESQa.mjs +59 -0
- package/eds-accordion.entry-BsT7Ved4.mjs +58 -0
- package/eds-accordion.entry-BvDNoDvv.js +4 -0
- package/eds-alert_28.entry-Ctl9tHqr.js +29465 -0
- package/eds-alert_28.entry-DbTB72ow.mjs +30921 -0
- package/eds-block-break.entry-B8gP4ig9.mjs +13 -0
- package/eds-block-break.entry-L9LG-PtO.js +1 -0
- package/eds-breadcrumb.entry-C6mAAYNs.js +1 -0
- package/eds-breadcrumb.entry-Dio_2hx4.mjs +114 -0
- package/eds-card-project.entry-CKYhNPPH.mjs +43 -0
- package/eds-card-project.entry-XK15egnP.js +1 -0
- package/eds-card-section.entry-B7jR75ty.js +1 -0
- package/eds-card-section.entry-x8CPk5NZ.mjs +33 -0
- package/eds-card-tags.entry-Bvn8dDXI.mjs +13 -0
- package/eds-card-tags.entry-CndclGXB.js +1 -0
- package/eds-card-tool.entry-DFuXjfhh.mjs +56 -0
- package/eds-card-tool.entry-DZqHML8u.js +1 -0
- package/eds-card-wrapper.entry-C_r0u0Fd.js +1 -0
- package/eds-card-wrapper.entry-DNnlCvMe.mjs +24 -0
- package/eds-code-block.entry-ClmjgThG.js +9 -0
- package/eds-code-block.entry-DwfHDe4j.mjs +1582 -0
- package/eds-components-section.entry-8sEheaoX.js +130 -0
- package/eds-components-section.entry-BSRNSdwF.mjs +244 -0
- package/eds-docs-palettes.entry-BlQEI2Bl.mjs +22 -0
- package/eds-docs-palettes.entry-Gi9kzOYC.js +1 -0
- package/eds-docs-tokens.entry-Bxzd9uSz.mjs +30 -0
- package/eds-docs-tokens.entry-G6O1zRxS.js +1 -0
- package/eds-footer.entry-9xXgg22T.mjs +29 -0
- package/eds-footer.entry-DqnRHQ32.js +1 -0
- package/eds-frame.entry-Bz-23eT7.js +1 -0
- package/eds-frame.entry-YVbNIAAz.mjs +74 -0
- package/eds-fullscreen-menu.entry-4kxB1p-j.mjs +74 -0
- package/eds-fullscreen-menu.entry-DwOubHgX.js +1 -0
- package/eds-icon-arrow-diagonal.entry-C06V6TIW.js +1 -0
- package/eds-icon-arrow-diagonal.entry-Ky6NoFbS.mjs +13 -0
- package/eds-icon-arrow-right.entry-BPHnm7pX.mjs +13 -0
- package/eds-icon-arrow-right.entry-Dv17zi29.js +1 -0
- package/eds-icon-bluesky.entry-7_AzEVLl.mjs +13 -0
- package/eds-icon-bluesky.entry-DQshm0EA.js +1 -0
- package/eds-icon-chevron-down.entry-BlnVbI1I.js +1 -0
- package/eds-icon-chevron-down.entry-DkcBkTRK.mjs +13 -0
- package/eds-icon-chevron-left.entry-BTxaVVnF.js +1 -0
- package/eds-icon-chevron-left.entry-BwhZiPKE.mjs +13 -0
- package/eds-icon-chevron-right.entry-BPKLFXW0.mjs +13 -0
- package/eds-icon-chevron-right.entry-c4irNhqS.js +1 -0
- package/eds-icon-chevron-up.entry-CFiZyc6u.js +1 -0
- package/eds-icon-chevron-up.entry-oja5yYhS.mjs +13 -0
- package/eds-icon-close.entry-5BdzrFmk.mjs +13 -0
- package/eds-icon-close.entry-DQD_dDo5.js +1 -0
- package/eds-icon-copy.entry-CQ237xrq.js +1 -0
- package/eds-icon-copy.entry-jpUaAQ7k.mjs +13 -0
- package/eds-icon-eu.entry-CjCnJWwP.js +1 -0
- package/eds-icon-eu.entry-gJ234Xni.mjs +13 -0
- package/eds-icon-facebook.entry-BHUSe9LK.js +1 -0
- package/eds-icon-facebook.entry-Ch94iA-s.mjs +13 -0
- package/eds-icon-gitlab.entry-B06LmNCU.mjs +13 -0
- package/eds-icon-gitlab.entry-j6RBYOBc.js +1 -0
- package/eds-icon-linkedin.entry-CMW1rKpG.mjs +13 -0
- package/eds-icon-linkedin.entry-DouHzclR.js +1 -0
- package/eds-icon-loader.entry-BlGbpEzt.js +1 -0
- package/eds-icon-loader.entry-Cx_ffiBq.mjs +13 -0
- package/eds-icon-mastodon.entry-C4ITVPfN.mjs +13 -0
- package/eds-icon-mastodon.entry-Cpl3lSng.js +1 -0
- package/eds-icon-menu.entry-BcPeEfV2.js +1 -0
- package/eds-icon-menu.entry-DvQARmJU.mjs +13 -0
- package/eds-icon-more.entry-BoAVOpyT.mjs +13 -0
- package/eds-icon-more.entry-m61loZHO.js +1 -0
- package/eds-icon-search.entry-BJMtVlnR.js +1 -0
- package/eds-icon-search.entry-D-nQvhug.mjs +13 -0
- package/eds-icon-success.entry-D8S7QlRm.mjs +13 -0
- package/eds-icon-success.entry-DvIchNgX.js +1 -0
- package/eds-icon-twitter.entry-CD1nT3iI.js +1 -0
- package/eds-icon-twitter.entry-DD48tnaV.mjs +13 -0
- package/eds-icon-user.entry-DDRH46_Z.js +1 -0
- package/eds-icon-user.entry-DSPBBAZa.mjs +13 -0
- package/eds-icon-youtube.entry-BRyOsCV-.mjs +13 -0
- package/eds-icon-youtube.entry-CfpQHgDF.js +1 -0
- package/eds-login.entry-CY0ZugpF.js +1 -0
- package/eds-login.entry-bC6f6bvF.mjs +46 -0
- package/eds-matomo-notice.entry-DGHq-ICP.mjs +91 -0
- package/eds-matomo-notice.entry-DanLI8VZ.js +1 -0
- package/eds-modal.entry-Bikh63fB.mjs +65 -0
- package/eds-modal.entry-TMxTmjgT.js +1 -0
- package/eds-navigator.entry-CUAf3hTM.js +1 -0
- package/eds-navigator.entry-D-fIKqub.mjs +33 -0
- package/eds-pagination.entry-C8g4pxcm.js +1 -0
- package/eds-pagination.entry-D6iJH84k.mjs +128 -0
- package/eds-rating.entry-B2lhi19L.mjs +40 -0
- package/eds-rating.entry-BdE-bKae.js +1 -0
- package/eds-section-core_2.entry-BRNJshCh.js +1 -0
- package/eds-section-core_2.entry-CqFyAWoq.mjs +39 -0
- package/eds-social-networks.entry-6VfWBLuR.js +1 -0
- package/eds-social-networks.entry-BgiRVGXx.mjs +50 -0
- package/eds-svg-repository.entry-BdZya_DA.js +192 -0
- package/eds-svg-repository.entry-qaL9fhLI.mjs +287 -0
- package/eds-tab.entry-BqqMdTQv.mjs +31 -0
- package/eds-tab.entry-C6q7naM_.js +1 -0
- package/eds-table.entry-BojRZdP2.mjs +112 -0
- package/eds-table.entry-ShWS4LWJ.js +1 -0
- package/eds-tabs-content.entry-D9b289Td.mjs +106 -0
- package/eds-tabs-content.entry-H__1SNbo.js +1 -0
- package/eds-tabs.entry-DGHlnSwh.js +1 -0
- package/eds-tabs.entry-KsWwc6xS.mjs +95 -0
- package/eds-tooltip.entry-BI1EvTiw.js +1 -0
- package/eds-tooltip.entry-ByxJjA_6.mjs +69 -0
- package/eu-9ddde93a-BFtIQw9B.js +28 -0
- package/eu-9ddde93a-ft4szvR5.mjs +31 -0
- package/facebook-9cb5c17f-BcUhbrj6.mjs +15 -0
- package/facebook-9cb5c17f-Y_gvQ682.js +12 -0
- package/generated/components.d.ts +0 -1
- package/incorrect-use-of-colors.entry-C7xABbpE.js +1 -0
- package/incorrect-use-of-colors.entry-DNOV6p4p.mjs +42 -0
- package/index-39c58238-BwYCDOHZ.mjs +44 -0
- package/index-39c58238-SQ-JC-LH.js +1 -0
- package/index-BGGkUjck.js +21 -0
- package/index-DQrtrXyM.mjs +3529 -0
- package/index.js +1 -21
- package/index.mjs +38 -2363
- package/keycloak-13893af6-BLzE1H6E.mjs +878 -0
- package/keycloak-13893af6-NiM3zoVg.js +9 -0
- package/linkedin-e8650abb-BkDrkjzY.js +26 -0
- package/linkedin-e8650abb-DYMdsale.mjs +29 -0
- package/loader-c9628637-ChpnbJkv.mjs +31 -0
- package/loader-c9628637-Vj8Wt1e8.js +28 -0
- package/logo-color-7f1fd803-CFgbXdt8.mjs +116 -0
- package/logo-color-7f1fd803-DRD3vZVn.js +113 -0
- package/logo-color-margins-ff8ce71b-B9nMsY9Q.mjs +119 -0
- package/logo-color-margins-ff8ce71b-Dk06zr1Z.js +116 -0
- package/logo-space.entry-DpgwdyOK.js +1 -0
- package/logo-space.entry-OauRHmO8.mjs +14 -0
- package/logo-variations-horizontal.entry-BG8fM5Bs.js +4 -0
- package/logo-variations-horizontal.entry-BicKkgRN.mjs +16 -0
- package/logo-variations-vertical.entry-CXVFf9-0.mjs +16 -0
- package/logo-variations-vertical.entry-DJ-IpAyZ.js +4 -0
- package/logo-white-no-bg-f382f86f-DXYn3NwV.js +1011 -0
- package/logo-white-no-bg-f382f86f-YhfmNmGG.mjs +1022 -0
- package/logo-wrong-usage.entry-7MfyIkPp.js +1 -0
- package/logo-wrong-usage.entry-CH7JMqbI.mjs +14 -0
- package/mastodon-3703ec61-C7iI4Hk0.mjs +15 -0
- package/mastodon-3703ec61-C9v6Olc-.js +12 -0
- package/menu-340ea948-BpnYX3gY.mjs +12 -0
- package/menu-340ea948-ZdelWVw3.js +9 -0
- package/mono-53f70232-DGi2XDlR.mjs +12 -0
- package/mono-53f70232-DgAsWvoQ.js +9 -0
- package/more-4449d549-D4HA1cRq.js +11 -0
- package/more-4449d549-rI9hOpEp.mjs +14 -0
- package/package.json +2 -2
- package/search-fbcd79c2-BMxCaeEk.js +10 -0
- package/search-fbcd79c2-rfV0PlHP.mjs +13 -0
- package/success-443809da-BD23vltm.mjs +19 -0
- package/success-443809da-BUEhLsAD.js +16 -0
- package/toastManager-d9eee791-CEYNwx25.mjs +30 -0
- package/toastManager-d9eee791-DvR_vUPI.js +1 -0
- package/token-list_3.entry-CVZDegic.js +1 -0
- package/token-list_3.entry-Ca9muGhp.mjs +247 -0
- package/token-ratios.entry-D3JWYlHy.mjs +25 -0
- package/token-ratios.entry-DGMJ2vJj.js +1 -0
- package/token-spacing.entry-CdrdqAOb.js +1 -0
- package/token-spacing.entry-CjITQ8pH.mjs +12 -0
- package/token-typography.entry-C8CdhyIM.js +2 -0
- package/token-typography.entry-DwUOTznz.mjs +213 -0
- package/twitter-ac21b505-CGWVGWM9.mjs +15 -0
- package/twitter-ac21b505-DDdHS4hB.js +12 -0
- package/user-71ebdc15-BBKQbcQD.js +14 -0
- package/user-71ebdc15-CoHlCtJg.mjs +17 -0
- package/youtube-efbfbdc4-BLTH1Jl9.js +12 -0
- package/youtube-efbfbdc4-BfySbfjR.mjs +15 -0
|
@@ -0,0 +1,878 @@
|
|
|
1
|
+
function Y(f) {
|
|
2
|
+
if (!(this instanceof Y))
|
|
3
|
+
throw new Error("The 'Keycloak' constructor must be invoked with 'new'.");
|
|
4
|
+
if (typeof f != "string" && !V(f))
|
|
5
|
+
throw new Error("The 'Keycloak' constructor must be provided with a configuration object, or a URL to a JSON configuration file.");
|
|
6
|
+
if (V(f)) {
|
|
7
|
+
const r = "oidcProvider" in f ? ["clientId"] : ["url", "realm", "clientId"];
|
|
8
|
+
for (const t of r)
|
|
9
|
+
if (!f[t])
|
|
10
|
+
throw new Error(`The configuration object is missing the required '${t}' property.`);
|
|
11
|
+
}
|
|
12
|
+
var e = this, h, v = [], U, p = {
|
|
13
|
+
enable: !0,
|
|
14
|
+
callbackList: [],
|
|
15
|
+
interval: 5
|
|
16
|
+
};
|
|
17
|
+
e.didInitialize = !1;
|
|
18
|
+
var A = !0, _ = J(console.info), L = J(console.warn);
|
|
19
|
+
globalThis.isSecureContext || L(
|
|
20
|
+
`[KEYCLOAK] Keycloak JS must be used in a 'secure context' to function properly as it relies on browser APIs that are otherwise not available.
|
|
21
|
+
Continuing to run your application insecurely will lead to unexpected behavior and breakage.
|
|
22
|
+
|
|
23
|
+
For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts`
|
|
24
|
+
), e.init = function(r) {
|
|
25
|
+
if (e.didInitialize)
|
|
26
|
+
throw new Error("A 'Keycloak' instance can only be initialized once.");
|
|
27
|
+
e.didInitialize = !0, e.authenticated = !1, U = ee();
|
|
28
|
+
var t = ["default", "cordova", "cordova-native"];
|
|
29
|
+
if (r && t.indexOf(r.adapter) > -1 ? h = P(r.adapter) : r && typeof r.adapter == "object" ? h = r.adapter : window.Cordova || window.cordova ? h = P("cordova") : h = P(), r) {
|
|
30
|
+
if (typeof r.useNonce < "u" && (A = r.useNonce), typeof r.checkLoginIframe < "u" && (p.enable = r.checkLoginIframe), r.checkLoginIframeInterval && (p.interval = r.checkLoginIframeInterval), r.onLoad === "login-required" && (e.loginRequired = !0), r.responseMode)
|
|
31
|
+
if (r.responseMode === "query" || r.responseMode === "fragment")
|
|
32
|
+
e.responseMode = r.responseMode;
|
|
33
|
+
else
|
|
34
|
+
throw "Invalid value for responseMode";
|
|
35
|
+
if (r.flow) {
|
|
36
|
+
switch (r.flow) {
|
|
37
|
+
case "standard":
|
|
38
|
+
e.responseType = "code";
|
|
39
|
+
break;
|
|
40
|
+
case "implicit":
|
|
41
|
+
e.responseType = "id_token token";
|
|
42
|
+
break;
|
|
43
|
+
case "hybrid":
|
|
44
|
+
e.responseType = "code id_token token";
|
|
45
|
+
break;
|
|
46
|
+
default:
|
|
47
|
+
throw "Invalid value for flow";
|
|
48
|
+
}
|
|
49
|
+
e.flow = r.flow;
|
|
50
|
+
}
|
|
51
|
+
if (r.timeSkew != null && (e.timeSkew = r.timeSkew), r.redirectUri && (e.redirectUri = r.redirectUri), r.silentCheckSsoRedirectUri && (e.silentCheckSsoRedirectUri = r.silentCheckSsoRedirectUri), typeof r.silentCheckSsoFallback == "boolean" ? e.silentCheckSsoFallback = r.silentCheckSsoFallback : e.silentCheckSsoFallback = !0, typeof r.pkceMethod < "u") {
|
|
52
|
+
if (r.pkceMethod !== "S256" && r.pkceMethod !== !1)
|
|
53
|
+
throw new TypeError(`Invalid value for pkceMethod', expected 'S256' or false but got ${r.pkceMethod}.`);
|
|
54
|
+
e.pkceMethod = r.pkceMethod;
|
|
55
|
+
} else
|
|
56
|
+
e.pkceMethod = "S256";
|
|
57
|
+
typeof r.enableLogging == "boolean" ? e.enableLogging = r.enableLogging : e.enableLogging = !1, r.logoutMethod === "POST" ? e.logoutMethod = "POST" : e.logoutMethod = "GET", typeof r.scope == "string" && (e.scope = r.scope), typeof r.acrValues == "string" && (e.acrValues = r.acrValues), typeof r.messageReceiveTimeout == "number" && r.messageReceiveTimeout > 0 ? e.messageReceiveTimeout = r.messageReceiveTimeout : e.messageReceiveTimeout = 1e4;
|
|
58
|
+
}
|
|
59
|
+
e.responseMode || (e.responseMode = "fragment"), e.responseType || (e.responseType = "code", e.flow = "standard");
|
|
60
|
+
var s = g(), i = g();
|
|
61
|
+
i.promise.then(function() {
|
|
62
|
+
e.onReady && e.onReady(e.authenticated), s.setSuccess(e.authenticated);
|
|
63
|
+
}).catch(function(o) {
|
|
64
|
+
s.setError(o);
|
|
65
|
+
});
|
|
66
|
+
var a = W();
|
|
67
|
+
function c() {
|
|
68
|
+
var o = function(d) {
|
|
69
|
+
d || (u.prompt = "none"), r && r.locale && (u.locale = r.locale), e.login(u).then(function() {
|
|
70
|
+
i.setSuccess();
|
|
71
|
+
}).catch(function(k) {
|
|
72
|
+
i.setError(k);
|
|
73
|
+
});
|
|
74
|
+
}, l = async function() {
|
|
75
|
+
var d = document.createElement("iframe"), k = await e.createLoginUrl({ prompt: "none", redirectUri: e.silentCheckSsoRedirectUri });
|
|
76
|
+
d.setAttribute("src", k), d.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin"), d.setAttribute("title", "keycloak-silent-check-sso"), d.style.display = "none", document.body.appendChild(d);
|
|
77
|
+
var y = function(S) {
|
|
78
|
+
if (!(S.origin !== window.location.origin || d.contentWindow !== S.source)) {
|
|
79
|
+
var w = T(S.data);
|
|
80
|
+
I(w, i), document.body.removeChild(d), window.removeEventListener("message", y);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
window.addEventListener("message", y);
|
|
84
|
+
}, u = {};
|
|
85
|
+
switch (r.onLoad) {
|
|
86
|
+
case "check-sso":
|
|
87
|
+
p.enable ? R().then(function() {
|
|
88
|
+
C().then(function(d) {
|
|
89
|
+
d ? i.setSuccess() : e.silentCheckSsoRedirectUri ? l() : o(!1);
|
|
90
|
+
}).catch(function(d) {
|
|
91
|
+
i.setError(d);
|
|
92
|
+
});
|
|
93
|
+
}) : e.silentCheckSsoRedirectUri ? l() : o(!1);
|
|
94
|
+
break;
|
|
95
|
+
case "login-required":
|
|
96
|
+
o(!0);
|
|
97
|
+
break;
|
|
98
|
+
default:
|
|
99
|
+
throw "Invalid value for onLoad";
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function n() {
|
|
103
|
+
var o = T(window.location.href);
|
|
104
|
+
if (o && window.history.replaceState(window.history.state, null, o.newUrl), o && o.valid)
|
|
105
|
+
return R().then(function() {
|
|
106
|
+
I(o, i);
|
|
107
|
+
}).catch(function(l) {
|
|
108
|
+
i.setError(l);
|
|
109
|
+
});
|
|
110
|
+
r ? r.token && r.refreshToken ? (E(r.token, r.refreshToken, r.idToken), p.enable ? R().then(function() {
|
|
111
|
+
C().then(function(l) {
|
|
112
|
+
l ? (e.onAuthSuccess && e.onAuthSuccess(), i.setSuccess(), x()) : i.setSuccess();
|
|
113
|
+
}).catch(function(l) {
|
|
114
|
+
i.setError(l);
|
|
115
|
+
});
|
|
116
|
+
}) : e.updateToken(-1).then(function() {
|
|
117
|
+
e.onAuthSuccess && e.onAuthSuccess(), i.setSuccess();
|
|
118
|
+
}).catch(function(l) {
|
|
119
|
+
e.onAuthError && e.onAuthError(), r.onLoad ? c() : i.setError(l);
|
|
120
|
+
})) : r.onLoad ? c() : i.setSuccess() : i.setSuccess();
|
|
121
|
+
}
|
|
122
|
+
return a.then(function() {
|
|
123
|
+
Z().then(n).catch(function(o) {
|
|
124
|
+
s.setError(o);
|
|
125
|
+
});
|
|
126
|
+
}), a.catch(function(o) {
|
|
127
|
+
s.setError(o);
|
|
128
|
+
}), s.promise;
|
|
129
|
+
}, e.login = function(r) {
|
|
130
|
+
return h.login(r);
|
|
131
|
+
};
|
|
132
|
+
function F(r) {
|
|
133
|
+
if (typeof crypto > "u" || typeof crypto.getRandomValues > "u")
|
|
134
|
+
throw new Error("Web Crypto API is not available.");
|
|
135
|
+
return crypto.getRandomValues(new Uint8Array(r));
|
|
136
|
+
}
|
|
137
|
+
function O(r) {
|
|
138
|
+
return q(r, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
|
|
139
|
+
}
|
|
140
|
+
function q(r, t) {
|
|
141
|
+
for (var s = F(r), i = new Array(r), a = 0; a < r; a++)
|
|
142
|
+
i[a] = t.charCodeAt(s[a] % t.length);
|
|
143
|
+
return String.fromCharCode.apply(null, i);
|
|
144
|
+
}
|
|
145
|
+
async function B(r, t) {
|
|
146
|
+
if (r !== "S256")
|
|
147
|
+
throw new TypeError(`Invalid value for 'pkceMethod', expected 'S256' but got '${r}'.`);
|
|
148
|
+
const s = new Uint8Array(await te(t));
|
|
149
|
+
return re(s).replace(/\+/g, "-").replace(/\//g, "_").replace(/\=/g, "");
|
|
150
|
+
}
|
|
151
|
+
function G(r) {
|
|
152
|
+
var t = {
|
|
153
|
+
id_token: {
|
|
154
|
+
acr: r
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
return JSON.stringify(t);
|
|
158
|
+
}
|
|
159
|
+
e.createLoginUrl = async function(r) {
|
|
160
|
+
var t = j(), s = j(), i = h.redirectUri(r), a = {
|
|
161
|
+
state: t,
|
|
162
|
+
nonce: s,
|
|
163
|
+
redirectUri: encodeURIComponent(i),
|
|
164
|
+
loginOptions: r
|
|
165
|
+
};
|
|
166
|
+
r && r.prompt && (a.prompt = r.prompt);
|
|
167
|
+
var c;
|
|
168
|
+
r && r.action == "register" ? c = e.endpoints.register() : c = e.endpoints.authorize();
|
|
169
|
+
var n = r && r.scope || e.scope;
|
|
170
|
+
n ? n.indexOf("openid") === -1 && (n = "openid " + n) : n = "openid";
|
|
171
|
+
var o = c + "?client_id=" + encodeURIComponent(e.clientId) + "&redirect_uri=" + encodeURIComponent(i) + "&state=" + encodeURIComponent(t) + "&response_mode=" + encodeURIComponent(e.responseMode) + "&response_type=" + encodeURIComponent(e.responseType) + "&scope=" + encodeURIComponent(n);
|
|
172
|
+
if (A && (o = o + "&nonce=" + encodeURIComponent(s)), r && r.prompt && (o += "&prompt=" + encodeURIComponent(r.prompt)), r && typeof r.maxAge == "number" && (o += "&max_age=" + encodeURIComponent(r.maxAge)), r && r.loginHint && (o += "&login_hint=" + encodeURIComponent(r.loginHint)), r && r.idpHint && (o += "&kc_idp_hint=" + encodeURIComponent(r.idpHint)), r && r.action && r.action != "register" && (o += "&kc_action=" + encodeURIComponent(r.action)), r && r.locale && (o += "&ui_locales=" + encodeURIComponent(r.locale)), r && r.acr) {
|
|
173
|
+
var l = G(r.acr);
|
|
174
|
+
o += "&claims=" + encodeURIComponent(l);
|
|
175
|
+
}
|
|
176
|
+
if ((r && r.acrValues || e.acrValues) && (o += "&acr_values=" + encodeURIComponent(r.acrValues || e.acrValues)), e.pkceMethod)
|
|
177
|
+
try {
|
|
178
|
+
const u = O(96), d = await B(e.pkceMethod, u);
|
|
179
|
+
a.pkceCodeVerifier = u, o += "&code_challenge=" + d, o += "&code_challenge_method=" + e.pkceMethod;
|
|
180
|
+
} catch (u) {
|
|
181
|
+
throw new Error("Failed to generate PKCE challenge.", { cause: u });
|
|
182
|
+
}
|
|
183
|
+
return U.add(a), o;
|
|
184
|
+
}, e.logout = function(r) {
|
|
185
|
+
return h.logout(r);
|
|
186
|
+
}, e.createLogoutUrl = function(r) {
|
|
187
|
+
if (((r == null ? void 0 : r.logoutMethod) ?? e.logoutMethod) === "POST")
|
|
188
|
+
return e.endpoints.logout();
|
|
189
|
+
var s = e.endpoints.logout() + "?client_id=" + encodeURIComponent(e.clientId) + "&post_logout_redirect_uri=" + encodeURIComponent(h.redirectUri(r, !1));
|
|
190
|
+
return e.idToken && (s += "&id_token_hint=" + encodeURIComponent(e.idToken)), s;
|
|
191
|
+
}, e.register = function(r) {
|
|
192
|
+
return h.register(r);
|
|
193
|
+
}, e.createRegisterUrl = async function(r) {
|
|
194
|
+
return r || (r = {}), r.action = "register", await e.createLoginUrl(r);
|
|
195
|
+
}, e.createAccountUrl = function(r) {
|
|
196
|
+
var t = b(), s = void 0;
|
|
197
|
+
return typeof t < "u" && (s = t + "/account?referrer=" + encodeURIComponent(e.clientId) + "&referrer_uri=" + encodeURIComponent(h.redirectUri(r))), s;
|
|
198
|
+
}, e.accountManagement = function() {
|
|
199
|
+
return h.accountManagement();
|
|
200
|
+
}, e.hasRealmRole = function(r) {
|
|
201
|
+
var t = e.realmAccess;
|
|
202
|
+
return !!t && t.roles.indexOf(r) >= 0;
|
|
203
|
+
}, e.hasResourceRole = function(r, t) {
|
|
204
|
+
if (!e.resourceAccess)
|
|
205
|
+
return !1;
|
|
206
|
+
var s = e.resourceAccess[t || e.clientId];
|
|
207
|
+
return !!s && s.roles.indexOf(r) >= 0;
|
|
208
|
+
}, e.loadUserProfile = function() {
|
|
209
|
+
var r = b() + "/account", t = new XMLHttpRequest();
|
|
210
|
+
t.open("GET", r, !0), t.setRequestHeader("Accept", "application/json"), t.setRequestHeader("Authorization", "bearer " + e.token);
|
|
211
|
+
var s = g();
|
|
212
|
+
return t.onreadystatechange = function() {
|
|
213
|
+
t.readyState == 4 && (t.status == 200 ? (e.profile = JSON.parse(t.responseText), s.setSuccess(e.profile)) : s.setError());
|
|
214
|
+
}, t.send(), s.promise;
|
|
215
|
+
}, e.loadUserInfo = function() {
|
|
216
|
+
var r = e.endpoints.userinfo(), t = new XMLHttpRequest();
|
|
217
|
+
t.open("GET", r, !0), t.setRequestHeader("Accept", "application/json"), t.setRequestHeader("Authorization", "bearer " + e.token);
|
|
218
|
+
var s = g();
|
|
219
|
+
return t.onreadystatechange = function() {
|
|
220
|
+
t.readyState == 4 && (t.status == 200 ? (e.userInfo = JSON.parse(t.responseText), s.setSuccess(e.userInfo)) : s.setError());
|
|
221
|
+
}, t.send(), s.promise;
|
|
222
|
+
}, e.isTokenExpired = function(r) {
|
|
223
|
+
if (!e.tokenParsed || !e.refreshToken && e.flow != "implicit")
|
|
224
|
+
throw "Not authenticated";
|
|
225
|
+
if (e.timeSkew == null)
|
|
226
|
+
return _("[KEYCLOAK] Unable to determine if token is expired as timeskew is not set"), !0;
|
|
227
|
+
var t = e.tokenParsed.exp - Math.ceil((/* @__PURE__ */ new Date()).getTime() / 1e3) + e.timeSkew;
|
|
228
|
+
if (r) {
|
|
229
|
+
if (isNaN(r))
|
|
230
|
+
throw "Invalid minValidity";
|
|
231
|
+
t -= r;
|
|
232
|
+
}
|
|
233
|
+
return t < 0;
|
|
234
|
+
}, e.updateToken = function(r) {
|
|
235
|
+
var t = g();
|
|
236
|
+
if (!e.refreshToken)
|
|
237
|
+
return t.setError(), t.promise;
|
|
238
|
+
r = r || 5;
|
|
239
|
+
var s = function() {
|
|
240
|
+
var a = !1;
|
|
241
|
+
if (r == -1 ? (a = !0, _("[KEYCLOAK] Refreshing token: forced refresh")) : (!e.tokenParsed || e.isTokenExpired(r)) && (a = !0, _("[KEYCLOAK] Refreshing token: token expired")), !a)
|
|
242
|
+
t.setSuccess(!1);
|
|
243
|
+
else {
|
|
244
|
+
var c = "grant_type=refresh_token&refresh_token=" + e.refreshToken, n = e.endpoints.token();
|
|
245
|
+
if (v.push(t), v.length == 1) {
|
|
246
|
+
var o = new XMLHttpRequest();
|
|
247
|
+
o.open("POST", n, !0), o.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), o.withCredentials = !0, c += "&client_id=" + encodeURIComponent(e.clientId);
|
|
248
|
+
var l = (/* @__PURE__ */ new Date()).getTime();
|
|
249
|
+
o.onreadystatechange = function() {
|
|
250
|
+
if (o.readyState == 4)
|
|
251
|
+
if (o.status == 200) {
|
|
252
|
+
_("[KEYCLOAK] Token refreshed"), l = (l + (/* @__PURE__ */ new Date()).getTime()) / 2;
|
|
253
|
+
var u = JSON.parse(o.responseText);
|
|
254
|
+
E(u.access_token, u.refresh_token, u.id_token, l), e.onAuthRefreshSuccess && e.onAuthRefreshSuccess();
|
|
255
|
+
for (var d = v.pop(); d != null; d = v.pop())
|
|
256
|
+
d.setSuccess(!0);
|
|
257
|
+
} else {
|
|
258
|
+
L("[KEYCLOAK] Failed to refresh token"), o.status == 400 && e.clearToken(), e.onAuthRefreshError && e.onAuthRefreshError();
|
|
259
|
+
for (var d = v.pop(); d != null; d = v.pop())
|
|
260
|
+
d.setError(!0);
|
|
261
|
+
}
|
|
262
|
+
}, o.send(c);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
if (p.enable) {
|
|
267
|
+
var i = C();
|
|
268
|
+
i.then(function() {
|
|
269
|
+
s();
|
|
270
|
+
}).catch(function(a) {
|
|
271
|
+
t.setError(a);
|
|
272
|
+
});
|
|
273
|
+
} else
|
|
274
|
+
s();
|
|
275
|
+
return t.promise;
|
|
276
|
+
}, e.clearToken = function() {
|
|
277
|
+
e.token && (E(null, null, null), e.onAuthLogout && e.onAuthLogout(), e.loginRequired && e.login());
|
|
278
|
+
};
|
|
279
|
+
function b() {
|
|
280
|
+
if (typeof e.authServerUrl < "u")
|
|
281
|
+
return e.authServerUrl.charAt(e.authServerUrl.length - 1) == "/" ? e.authServerUrl + "realms/" + encodeURIComponent(e.realm) : e.authServerUrl + "/realms/" + encodeURIComponent(e.realm);
|
|
282
|
+
}
|
|
283
|
+
function X() {
|
|
284
|
+
return window.location.origin ? window.location.origin : window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
|
|
285
|
+
}
|
|
286
|
+
function I(r, t) {
|
|
287
|
+
var s = r.code, i = r.error, a = r.prompt, c = (/* @__PURE__ */ new Date()).getTime();
|
|
288
|
+
if (r.kc_action_status && e.onActionUpdate && e.onActionUpdate(r.kc_action_status, r.kc_action), i) {
|
|
289
|
+
if (a != "none")
|
|
290
|
+
if (r.error_description && r.error_description === "authentication_expired")
|
|
291
|
+
e.login(r.loginOptions);
|
|
292
|
+
else {
|
|
293
|
+
var n = { error: i, error_description: r.error_description };
|
|
294
|
+
e.onAuthError && e.onAuthError(n), t && t.setError(n);
|
|
295
|
+
}
|
|
296
|
+
else
|
|
297
|
+
t && t.setSuccess();
|
|
298
|
+
return;
|
|
299
|
+
} else e.flow != "standard" && (r.access_token || r.id_token) && d(r.access_token, null, r.id_token, !0);
|
|
300
|
+
if (e.flow != "implicit" && s) {
|
|
301
|
+
var o = "code=" + s + "&grant_type=authorization_code", l = e.endpoints.token(), u = new XMLHttpRequest();
|
|
302
|
+
u.open("POST", l, !0), u.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), o += "&client_id=" + encodeURIComponent(e.clientId), o += "&redirect_uri=" + r.redirectUri, r.pkceCodeVerifier && (o += "&code_verifier=" + r.pkceCodeVerifier), u.withCredentials = !0, u.onreadystatechange = function() {
|
|
303
|
+
if (u.readyState == 4)
|
|
304
|
+
if (u.status == 200) {
|
|
305
|
+
var k = JSON.parse(u.responseText);
|
|
306
|
+
d(k.access_token, k.refresh_token, k.id_token, e.flow === "standard"), x();
|
|
307
|
+
} else
|
|
308
|
+
e.onAuthError && e.onAuthError(), t && t.setError();
|
|
309
|
+
}, u.send(o);
|
|
310
|
+
}
|
|
311
|
+
function d(k, y, S, w) {
|
|
312
|
+
c = (c + (/* @__PURE__ */ new Date()).getTime()) / 2, E(k, y, S, c), A && e.idTokenParsed && e.idTokenParsed.nonce != r.storedNonce ? (_("[KEYCLOAK] Invalid nonce, clearing token"), e.clearToken(), t && t.setError()) : w && (e.onAuthSuccess && e.onAuthSuccess(), t && t.setSuccess());
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function W() {
|
|
316
|
+
var r = g(), t;
|
|
317
|
+
typeof f == "string" && (t = f);
|
|
318
|
+
function s(n) {
|
|
319
|
+
n ? e.endpoints = {
|
|
320
|
+
authorize: function() {
|
|
321
|
+
return n.authorization_endpoint;
|
|
322
|
+
},
|
|
323
|
+
token: function() {
|
|
324
|
+
return n.token_endpoint;
|
|
325
|
+
},
|
|
326
|
+
logout: function() {
|
|
327
|
+
if (!n.end_session_endpoint)
|
|
328
|
+
throw "Not supported by the OIDC server";
|
|
329
|
+
return n.end_session_endpoint;
|
|
330
|
+
},
|
|
331
|
+
checkSessionIframe: function() {
|
|
332
|
+
if (!n.check_session_iframe)
|
|
333
|
+
throw "Not supported by the OIDC server";
|
|
334
|
+
return n.check_session_iframe;
|
|
335
|
+
},
|
|
336
|
+
register: function() {
|
|
337
|
+
throw 'Redirection to "Register user" page not supported in standard OIDC mode';
|
|
338
|
+
},
|
|
339
|
+
userinfo: function() {
|
|
340
|
+
if (!n.userinfo_endpoint)
|
|
341
|
+
throw "Not supported by the OIDC server";
|
|
342
|
+
return n.userinfo_endpoint;
|
|
343
|
+
}
|
|
344
|
+
} : e.endpoints = {
|
|
345
|
+
authorize: function() {
|
|
346
|
+
return b() + "/protocol/openid-connect/auth";
|
|
347
|
+
},
|
|
348
|
+
token: function() {
|
|
349
|
+
return b() + "/protocol/openid-connect/token";
|
|
350
|
+
},
|
|
351
|
+
logout: function() {
|
|
352
|
+
return b() + "/protocol/openid-connect/logout";
|
|
353
|
+
},
|
|
354
|
+
checkSessionIframe: function() {
|
|
355
|
+
return b() + "/protocol/openid-connect/login-status-iframe.html";
|
|
356
|
+
},
|
|
357
|
+
thirdPartyCookiesIframe: function() {
|
|
358
|
+
return b() + "/protocol/openid-connect/3p-cookies/step1.html";
|
|
359
|
+
},
|
|
360
|
+
register: function() {
|
|
361
|
+
return b() + "/protocol/openid-connect/registrations";
|
|
362
|
+
},
|
|
363
|
+
userinfo: function() {
|
|
364
|
+
return b() + "/protocol/openid-connect/userinfo";
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
if (t) {
|
|
369
|
+
var i = new XMLHttpRequest();
|
|
370
|
+
i.open("GET", t, !0), i.setRequestHeader("Accept", "application/json"), i.onreadystatechange = function() {
|
|
371
|
+
if (i.readyState == 4)
|
|
372
|
+
if (i.status == 200 || D(i)) {
|
|
373
|
+
var n = JSON.parse(i.responseText);
|
|
374
|
+
e.authServerUrl = n["auth-server-url"], e.realm = n.realm, e.clientId = n.resource, s(null), r.setSuccess();
|
|
375
|
+
} else
|
|
376
|
+
r.setError();
|
|
377
|
+
}, i.send();
|
|
378
|
+
} else {
|
|
379
|
+
e.clientId = f.clientId;
|
|
380
|
+
var a = f.oidcProvider;
|
|
381
|
+
if (!a)
|
|
382
|
+
e.authServerUrl = f.url, e.realm = f.realm, s(null), r.setSuccess();
|
|
383
|
+
else if (typeof a == "string") {
|
|
384
|
+
var c;
|
|
385
|
+
a.charAt(a.length - 1) == "/" ? c = a + ".well-known/openid-configuration" : c = a + "/.well-known/openid-configuration";
|
|
386
|
+
var i = new XMLHttpRequest();
|
|
387
|
+
i.open("GET", c, !0), i.setRequestHeader("Accept", "application/json"), i.onreadystatechange = function() {
|
|
388
|
+
if (i.readyState == 4)
|
|
389
|
+
if (i.status == 200 || D(i)) {
|
|
390
|
+
var o = JSON.parse(i.responseText);
|
|
391
|
+
s(o), r.setSuccess();
|
|
392
|
+
} else
|
|
393
|
+
r.setError();
|
|
394
|
+
}, i.send();
|
|
395
|
+
} else
|
|
396
|
+
s(a), r.setSuccess();
|
|
397
|
+
}
|
|
398
|
+
return r.promise;
|
|
399
|
+
}
|
|
400
|
+
function D(r) {
|
|
401
|
+
return r.status == 0 && r.responseText && r.responseURL.startsWith("file:");
|
|
402
|
+
}
|
|
403
|
+
function E(r, t, s, i) {
|
|
404
|
+
if (e.tokenTimeoutHandle && (clearTimeout(e.tokenTimeoutHandle), e.tokenTimeoutHandle = null), t ? (e.refreshToken = t, e.refreshTokenParsed = N(t)) : (delete e.refreshToken, delete e.refreshTokenParsed), s ? (e.idToken = s, e.idTokenParsed = N(s)) : (delete e.idToken, delete e.idTokenParsed), r) {
|
|
405
|
+
if (e.token = r, e.tokenParsed = N(r), e.sessionId = e.tokenParsed.sid, e.authenticated = !0, e.subject = e.tokenParsed.sub, e.realmAccess = e.tokenParsed.realm_access, e.resourceAccess = e.tokenParsed.resource_access, i && (e.timeSkew = Math.floor(i / 1e3) - e.tokenParsed.iat), e.timeSkew != null && (_("[KEYCLOAK] Estimated time difference between browser and server is " + e.timeSkew + " seconds"), e.onTokenExpired)) {
|
|
406
|
+
var a = (e.tokenParsed.exp - (/* @__PURE__ */ new Date()).getTime() / 1e3 + e.timeSkew) * 1e3;
|
|
407
|
+
_("[KEYCLOAK] Token expires in " + Math.round(a / 1e3) + " s"), a <= 0 ? e.onTokenExpired() : e.tokenTimeoutHandle = setTimeout(e.onTokenExpired, a);
|
|
408
|
+
}
|
|
409
|
+
} else
|
|
410
|
+
delete e.token, delete e.tokenParsed, delete e.subject, delete e.realmAccess, delete e.resourceAccess, e.authenticated = !1;
|
|
411
|
+
}
|
|
412
|
+
function j() {
|
|
413
|
+
if (typeof crypto > "u" || typeof crypto.randomUUID > "u")
|
|
414
|
+
throw new Error("Web Crypto API is not available.");
|
|
415
|
+
return crypto.randomUUID();
|
|
416
|
+
}
|
|
417
|
+
function T(r) {
|
|
418
|
+
var t = $(r);
|
|
419
|
+
if (t) {
|
|
420
|
+
var s = U.get(t.state);
|
|
421
|
+
return s && (t.valid = !0, t.redirectUri = s.redirectUri, t.storedNonce = s.nonce, t.prompt = s.prompt, t.pkceCodeVerifier = s.pkceCodeVerifier, t.loginOptions = s.loginOptions), t;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
function $(r) {
|
|
425
|
+
var t;
|
|
426
|
+
switch (e.flow) {
|
|
427
|
+
case "standard":
|
|
428
|
+
t = ["code", "state", "session_state", "kc_action_status", "kc_action", "iss"];
|
|
429
|
+
break;
|
|
430
|
+
case "implicit":
|
|
431
|
+
t = ["access_token", "token_type", "id_token", "state", "session_state", "expires_in", "kc_action_status", "kc_action", "iss"];
|
|
432
|
+
break;
|
|
433
|
+
case "hybrid":
|
|
434
|
+
t = ["access_token", "token_type", "id_token", "code", "state", "session_state", "expires_in", "kc_action_status", "kc_action", "iss"];
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
t.push("error"), t.push("error_description"), t.push("error_uri");
|
|
438
|
+
var s = r.indexOf("?"), i = r.indexOf("#"), a, c;
|
|
439
|
+
if (e.responseMode === "query" && s !== -1 ? (a = r.substring(0, s), c = z(r.substring(s + 1, i !== -1 ? i : r.length), t), c.paramsString !== "" && (a += "?" + c.paramsString), i !== -1 && (a += r.substring(i))) : e.responseMode === "fragment" && i !== -1 && (a = r.substring(0, i), c = z(r.substring(i + 1), t), c.paramsString !== "" && (a += "#" + c.paramsString)), c && c.oauthParams) {
|
|
440
|
+
if (e.flow === "standard" || e.flow === "hybrid") {
|
|
441
|
+
if ((c.oauthParams.code || c.oauthParams.error) && c.oauthParams.state)
|
|
442
|
+
return c.oauthParams.newUrl = a, c.oauthParams;
|
|
443
|
+
} else if (e.flow === "implicit" && (c.oauthParams.access_token || c.oauthParams.error) && c.oauthParams.state)
|
|
444
|
+
return c.oauthParams.newUrl = a, c.oauthParams;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
function z(r, t) {
|
|
448
|
+
for (var s = r.split("&"), i = {
|
|
449
|
+
paramsString: "",
|
|
450
|
+
oauthParams: {}
|
|
451
|
+
}, a = 0; a < s.length; a++) {
|
|
452
|
+
var c = s[a].indexOf("="), n = s[a].slice(0, c);
|
|
453
|
+
t.indexOf(n) !== -1 ? i.oauthParams[n] = s[a].slice(c + 1) : (i.paramsString !== "" && (i.paramsString += "&"), i.paramsString += s[a]);
|
|
454
|
+
}
|
|
455
|
+
return i;
|
|
456
|
+
}
|
|
457
|
+
function g() {
|
|
458
|
+
var r = {
|
|
459
|
+
setSuccess: function(t) {
|
|
460
|
+
r.resolve(t);
|
|
461
|
+
},
|
|
462
|
+
setError: function(t) {
|
|
463
|
+
r.reject(t);
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
return r.promise = new Promise(function(t, s) {
|
|
467
|
+
r.resolve = t, r.reject = s;
|
|
468
|
+
}), r;
|
|
469
|
+
}
|
|
470
|
+
function Q(r, t, s) {
|
|
471
|
+
var i = null, a = new Promise(function(c, n) {
|
|
472
|
+
i = setTimeout(function() {
|
|
473
|
+
n({ error: s });
|
|
474
|
+
}, t);
|
|
475
|
+
});
|
|
476
|
+
return Promise.race([r, a]).finally(function() {
|
|
477
|
+
clearTimeout(i);
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
function R() {
|
|
481
|
+
var r = g();
|
|
482
|
+
if (!p.enable || p.iframe)
|
|
483
|
+
return r.setSuccess(), r.promise;
|
|
484
|
+
var t = document.createElement("iframe");
|
|
485
|
+
p.iframe = t, t.onload = function() {
|
|
486
|
+
var a = e.endpoints.authorize();
|
|
487
|
+
a.charAt(0) === "/" ? p.iframeOrigin = X() : p.iframeOrigin = a.substring(0, a.indexOf("/", 8)), r.setSuccess();
|
|
488
|
+
};
|
|
489
|
+
var s = e.endpoints.checkSessionIframe();
|
|
490
|
+
t.setAttribute("src", s), t.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin"), t.setAttribute("title", "keycloak-session-iframe"), t.style.display = "none", document.body.appendChild(t);
|
|
491
|
+
var i = function(a) {
|
|
492
|
+
if (!(a.origin !== p.iframeOrigin || p.iframe.contentWindow !== a.source) && (a.data == "unchanged" || a.data == "changed" || a.data == "error")) {
|
|
493
|
+
a.data != "unchanged" && e.clearToken();
|
|
494
|
+
for (var c = p.callbackList.splice(0, p.callbackList.length), n = c.length - 1; n >= 0; --n) {
|
|
495
|
+
var o = c[n];
|
|
496
|
+
a.data == "error" ? o.setError() : o.setSuccess(a.data == "unchanged");
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
return window.addEventListener("message", i, !1), r.promise;
|
|
501
|
+
}
|
|
502
|
+
function x() {
|
|
503
|
+
p.enable && e.token && setTimeout(function() {
|
|
504
|
+
C().then(function(r) {
|
|
505
|
+
r && x();
|
|
506
|
+
});
|
|
507
|
+
}, p.interval * 1e3);
|
|
508
|
+
}
|
|
509
|
+
function C() {
|
|
510
|
+
var r = g();
|
|
511
|
+
if (p.iframe && p.iframeOrigin) {
|
|
512
|
+
var t = e.clientId + " " + (e.sessionId ? e.sessionId : "");
|
|
513
|
+
p.callbackList.push(r);
|
|
514
|
+
var s = p.iframeOrigin;
|
|
515
|
+
p.callbackList.length == 1 && p.iframe.contentWindow.postMessage(t, s);
|
|
516
|
+
} else
|
|
517
|
+
r.setSuccess();
|
|
518
|
+
return r.promise;
|
|
519
|
+
}
|
|
520
|
+
function Z() {
|
|
521
|
+
var r = g();
|
|
522
|
+
if (p.enable || e.silentCheckSsoRedirectUri) {
|
|
523
|
+
var t = document.createElement("iframe");
|
|
524
|
+
t.setAttribute("src", e.endpoints.thirdPartyCookiesIframe()), t.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin"), t.setAttribute("title", "keycloak-3p-check-iframe"), t.style.display = "none", document.body.appendChild(t);
|
|
525
|
+
var s = function(i) {
|
|
526
|
+
t.contentWindow === i.source && (i.data !== "supported" && i.data !== "unsupported" || (i.data === "unsupported" && (L(
|
|
527
|
+
`[KEYCLOAK] Your browser is blocking access to 3rd-party cookies, this means:
|
|
528
|
+
|
|
529
|
+
- It is not possible to retrieve tokens without redirecting to the Keycloak server (a.k.a. no support for silent authentication).
|
|
530
|
+
- It is not possible to automatically detect changes to the session status (such as the user logging out in another tab).
|
|
531
|
+
|
|
532
|
+
For more information see: https://www.keycloak.org/docs/latest/securing_apps/#_modern_browsers`
|
|
533
|
+
), p.enable = !1, e.silentCheckSsoFallback && (e.silentCheckSsoRedirectUri = !1)), document.body.removeChild(t), window.removeEventListener("message", s), r.setSuccess()));
|
|
534
|
+
};
|
|
535
|
+
window.addEventListener("message", s, !1);
|
|
536
|
+
} else
|
|
537
|
+
r.setSuccess();
|
|
538
|
+
return Q(r.promise, e.messageReceiveTimeout, "Timeout when waiting for 3rd party check iframe message.");
|
|
539
|
+
}
|
|
540
|
+
function P(r) {
|
|
541
|
+
if (!r || r == "default")
|
|
542
|
+
return {
|
|
543
|
+
login: async function(n) {
|
|
544
|
+
return window.location.assign(await e.createLoginUrl(n)), g().promise;
|
|
545
|
+
},
|
|
546
|
+
logout: async function(n) {
|
|
547
|
+
if (((n == null ? void 0 : n.logoutMethod) ?? e.logoutMethod) === "GET") {
|
|
548
|
+
window.location.replace(e.createLogoutUrl(n));
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
const l = e.createLogoutUrl(n), u = await fetch(l, {
|
|
552
|
+
method: "POST",
|
|
553
|
+
headers: {
|
|
554
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
555
|
+
},
|
|
556
|
+
body: new URLSearchParams({
|
|
557
|
+
id_token_hint: e.idToken,
|
|
558
|
+
client_id: e.clientId,
|
|
559
|
+
post_logout_redirect_uri: h.redirectUri(n, !1)
|
|
560
|
+
})
|
|
561
|
+
});
|
|
562
|
+
if (u.redirected) {
|
|
563
|
+
window.location.href = u.url;
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
if (u.ok) {
|
|
567
|
+
window.location.reload();
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
throw new Error("Logout failed, request returned an error code.");
|
|
571
|
+
},
|
|
572
|
+
register: function(n) {
|
|
573
|
+
return window.location.assign(e.createRegisterUrl(n)), g().promise;
|
|
574
|
+
},
|
|
575
|
+
accountManagement: function() {
|
|
576
|
+
var n = e.createAccountUrl();
|
|
577
|
+
if (typeof n < "u")
|
|
578
|
+
window.location.href = n;
|
|
579
|
+
else
|
|
580
|
+
throw "Not supported by the OIDC server";
|
|
581
|
+
return g().promise;
|
|
582
|
+
},
|
|
583
|
+
redirectUri: function(n, o) {
|
|
584
|
+
return n && n.redirectUri ? n.redirectUri : e.redirectUri ? e.redirectUri : location.href;
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
if (r == "cordova") {
|
|
588
|
+
p.enable = !1;
|
|
589
|
+
var t = function(n, o, l) {
|
|
590
|
+
return window.cordova && window.cordova.InAppBrowser ? window.cordova.InAppBrowser.open(n, o, l) : window.open(n, o, l);
|
|
591
|
+
}, s = function(n) {
|
|
592
|
+
return n && n.cordovaOptions ? Object.keys(n.cordovaOptions).reduce(function(o, l) {
|
|
593
|
+
return o[l] = n.cordovaOptions[l], o;
|
|
594
|
+
}, {}) : {};
|
|
595
|
+
}, i = function(n) {
|
|
596
|
+
return Object.keys(n).reduce(function(o, l) {
|
|
597
|
+
return o.push(l + "=" + n[l]), o;
|
|
598
|
+
}, []).join(",");
|
|
599
|
+
}, a = function(n) {
|
|
600
|
+
var o = s(n);
|
|
601
|
+
return o.location = "no", n && n.prompt == "none" && (o.hidden = "yes"), i(o);
|
|
602
|
+
}, c = function() {
|
|
603
|
+
return e.redirectUri || "http://localhost";
|
|
604
|
+
};
|
|
605
|
+
return {
|
|
606
|
+
login: async function(n) {
|
|
607
|
+
var o = g(), l = a(n), u = await e.createLoginUrl(n), d = t(u, "_blank", l), k = !1, y = !1, S = function() {
|
|
608
|
+
y = !0, d.close();
|
|
609
|
+
};
|
|
610
|
+
return d.addEventListener("loadstart", function(w) {
|
|
611
|
+
if (w.url.indexOf(c()) == 0) {
|
|
612
|
+
var H = T(w.url);
|
|
613
|
+
I(H, o), S(), k = !0;
|
|
614
|
+
}
|
|
615
|
+
}), d.addEventListener("loaderror", function(w) {
|
|
616
|
+
if (!k)
|
|
617
|
+
if (w.url.indexOf(c()) == 0) {
|
|
618
|
+
var H = T(w.url);
|
|
619
|
+
I(H, o), S(), k = !0;
|
|
620
|
+
} else
|
|
621
|
+
o.setError(), S();
|
|
622
|
+
}), d.addEventListener("exit", function(w) {
|
|
623
|
+
y || o.setError({
|
|
624
|
+
reason: "closed_by_user"
|
|
625
|
+
});
|
|
626
|
+
}), o.promise;
|
|
627
|
+
},
|
|
628
|
+
logout: function(n) {
|
|
629
|
+
var o = g(), l = e.createLogoutUrl(n), u = t(l, "_blank", "location=no,hidden=yes,clearcache=yes"), d;
|
|
630
|
+
return u.addEventListener("loadstart", function(k) {
|
|
631
|
+
k.url.indexOf(c()) == 0 && u.close();
|
|
632
|
+
}), u.addEventListener("loaderror", function(k) {
|
|
633
|
+
k.url.indexOf(c()) == 0 || (d = !0), u.close();
|
|
634
|
+
}), u.addEventListener("exit", function(k) {
|
|
635
|
+
d ? o.setError() : (e.clearToken(), o.setSuccess());
|
|
636
|
+
}), o.promise;
|
|
637
|
+
},
|
|
638
|
+
register: function(n) {
|
|
639
|
+
var o = g(), l = e.createRegisterUrl(), u = a(n), d = t(l, "_blank", u);
|
|
640
|
+
return d.addEventListener("loadstart", function(k) {
|
|
641
|
+
if (k.url.indexOf(c()) == 0) {
|
|
642
|
+
d.close();
|
|
643
|
+
var y = T(k.url);
|
|
644
|
+
I(y, o);
|
|
645
|
+
}
|
|
646
|
+
}), o.promise;
|
|
647
|
+
},
|
|
648
|
+
accountManagement: function() {
|
|
649
|
+
var n = e.createAccountUrl();
|
|
650
|
+
if (typeof n < "u") {
|
|
651
|
+
var o = t(n, "_blank", "location=no");
|
|
652
|
+
o.addEventListener("loadstart", function(l) {
|
|
653
|
+
l.url.indexOf(c()) == 0 && o.close();
|
|
654
|
+
});
|
|
655
|
+
} else
|
|
656
|
+
throw "Not supported by the OIDC server";
|
|
657
|
+
},
|
|
658
|
+
redirectUri: function(n) {
|
|
659
|
+
return c();
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
if (r == "cordova-native")
|
|
664
|
+
return p.enable = !1, {
|
|
665
|
+
login: async function(n) {
|
|
666
|
+
var o = g(), l = await e.createLoginUrl(n);
|
|
667
|
+
return universalLinks.subscribe("keycloak", function(u) {
|
|
668
|
+
universalLinks.unsubscribe("keycloak"), window.cordova.plugins.browsertab.close();
|
|
669
|
+
var d = T(u.url);
|
|
670
|
+
I(d, o);
|
|
671
|
+
}), window.cordova.plugins.browsertab.openUrl(l), o.promise;
|
|
672
|
+
},
|
|
673
|
+
logout: function(n) {
|
|
674
|
+
var o = g(), l = e.createLogoutUrl(n);
|
|
675
|
+
return universalLinks.subscribe("keycloak", function(u) {
|
|
676
|
+
universalLinks.unsubscribe("keycloak"), window.cordova.plugins.browsertab.close(), e.clearToken(), o.setSuccess();
|
|
677
|
+
}), window.cordova.plugins.browsertab.openUrl(l), o.promise;
|
|
678
|
+
},
|
|
679
|
+
register: function(n) {
|
|
680
|
+
var o = g(), l = e.createRegisterUrl(n);
|
|
681
|
+
return universalLinks.subscribe("keycloak", function(u) {
|
|
682
|
+
universalLinks.unsubscribe("keycloak"), window.cordova.plugins.browsertab.close();
|
|
683
|
+
var d = T(u.url);
|
|
684
|
+
I(d, o);
|
|
685
|
+
}), window.cordova.plugins.browsertab.openUrl(l), o.promise;
|
|
686
|
+
},
|
|
687
|
+
accountManagement: function() {
|
|
688
|
+
var n = e.createAccountUrl();
|
|
689
|
+
if (typeof n < "u")
|
|
690
|
+
window.cordova.plugins.browsertab.openUrl(n);
|
|
691
|
+
else
|
|
692
|
+
throw "Not supported by the OIDC server";
|
|
693
|
+
},
|
|
694
|
+
redirectUri: function(n) {
|
|
695
|
+
return n && n.redirectUri ? n.redirectUri : e.redirectUri ? e.redirectUri : "http://localhost";
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
throw "invalid adapter type: " + r;
|
|
699
|
+
}
|
|
700
|
+
var M = function() {
|
|
701
|
+
if (!(this instanceof M))
|
|
702
|
+
return new M();
|
|
703
|
+
localStorage.setItem("kc-test", "test"), localStorage.removeItem("kc-test");
|
|
704
|
+
var r = this;
|
|
705
|
+
function t() {
|
|
706
|
+
for (var s = (/* @__PURE__ */ new Date()).getTime(), i = 0; i < localStorage.length; i++) {
|
|
707
|
+
var a = localStorage.key(i);
|
|
708
|
+
if (a && a.indexOf("kc-callback-") == 0) {
|
|
709
|
+
var c = localStorage.getItem(a);
|
|
710
|
+
if (c)
|
|
711
|
+
try {
|
|
712
|
+
var n = JSON.parse(c).expires;
|
|
713
|
+
(!n || n < s) && localStorage.removeItem(a);
|
|
714
|
+
} catch {
|
|
715
|
+
localStorage.removeItem(a);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
r.get = function(s) {
|
|
721
|
+
if (s) {
|
|
722
|
+
var i = "kc-callback-" + s, a = localStorage.getItem(i);
|
|
723
|
+
return a && (localStorage.removeItem(i), a = JSON.parse(a)), t(), a;
|
|
724
|
+
}
|
|
725
|
+
}, r.add = function(s) {
|
|
726
|
+
t();
|
|
727
|
+
var i = "kc-callback-" + s.state;
|
|
728
|
+
s.expires = (/* @__PURE__ */ new Date()).getTime() + 60 * 60 * 1e3, localStorage.setItem(i, JSON.stringify(s));
|
|
729
|
+
};
|
|
730
|
+
}, K = function() {
|
|
731
|
+
if (!(this instanceof K))
|
|
732
|
+
return new K();
|
|
733
|
+
var r = this;
|
|
734
|
+
r.get = function(a) {
|
|
735
|
+
if (a) {
|
|
736
|
+
var c = s("kc-callback-" + a);
|
|
737
|
+
if (i("kc-callback-" + a, "", t(-100)), c)
|
|
738
|
+
return JSON.parse(c);
|
|
739
|
+
}
|
|
740
|
+
}, r.add = function(a) {
|
|
741
|
+
i("kc-callback-" + a.state, JSON.stringify(a), t(60));
|
|
742
|
+
}, r.removeItem = function(a) {
|
|
743
|
+
i(a, "", t(-100));
|
|
744
|
+
};
|
|
745
|
+
var t = function(a) {
|
|
746
|
+
var c = /* @__PURE__ */ new Date();
|
|
747
|
+
return c.setTime(c.getTime() + a * 60 * 1e3), c;
|
|
748
|
+
}, s = function(a) {
|
|
749
|
+
for (var c = a + "=", n = document.cookie.split(";"), o = 0; o < n.length; o++) {
|
|
750
|
+
for (var l = n[o]; l.charAt(0) == " "; )
|
|
751
|
+
l = l.substring(1);
|
|
752
|
+
if (l.indexOf(c) == 0)
|
|
753
|
+
return l.substring(c.length, l.length);
|
|
754
|
+
}
|
|
755
|
+
return "";
|
|
756
|
+
}, i = function(a, c, n) {
|
|
757
|
+
var o = a + "=" + c + "; expires=" + n.toUTCString() + "; ";
|
|
758
|
+
document.cookie = o;
|
|
759
|
+
};
|
|
760
|
+
};
|
|
761
|
+
function ee() {
|
|
762
|
+
try {
|
|
763
|
+
return new M();
|
|
764
|
+
} catch {
|
|
765
|
+
}
|
|
766
|
+
return new K();
|
|
767
|
+
}
|
|
768
|
+
function J(r) {
|
|
769
|
+
return function() {
|
|
770
|
+
e.enableLogging && r.apply(console, Array.prototype.slice.call(arguments));
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
function re(f) {
|
|
775
|
+
const e = String.fromCodePoint(...f);
|
|
776
|
+
return btoa(e);
|
|
777
|
+
}
|
|
778
|
+
async function te(f) {
|
|
779
|
+
const h = new TextEncoder().encode(f);
|
|
780
|
+
if (typeof crypto > "u" || typeof crypto.subtle > "u")
|
|
781
|
+
throw new Error("Web Crypto API is not available.");
|
|
782
|
+
return await crypto.subtle.digest("SHA-256", h);
|
|
783
|
+
}
|
|
784
|
+
function N(f) {
|
|
785
|
+
const [e, h] = f.split(".");
|
|
786
|
+
if (typeof h != "string")
|
|
787
|
+
throw new Error("Unable to decode token, payload not found.");
|
|
788
|
+
let v;
|
|
789
|
+
try {
|
|
790
|
+
v = ne(h);
|
|
791
|
+
} catch (U) {
|
|
792
|
+
throw new Error("Unable to decode token, payload is not a valid Base64URL value.", { cause: U });
|
|
793
|
+
}
|
|
794
|
+
try {
|
|
795
|
+
return JSON.parse(v);
|
|
796
|
+
} catch (U) {
|
|
797
|
+
throw new Error("Unable to decode token, payload is not a valid JSON value.", { cause: U });
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
function ne(f) {
|
|
801
|
+
let e = f.replaceAll("-", "+").replaceAll("_", "/");
|
|
802
|
+
switch (e.length % 4) {
|
|
803
|
+
case 0:
|
|
804
|
+
break;
|
|
805
|
+
case 2:
|
|
806
|
+
e += "==";
|
|
807
|
+
break;
|
|
808
|
+
case 3:
|
|
809
|
+
e += "=";
|
|
810
|
+
break;
|
|
811
|
+
default:
|
|
812
|
+
throw new Error("Input is not of the correct length.");
|
|
813
|
+
}
|
|
814
|
+
try {
|
|
815
|
+
return oe(e);
|
|
816
|
+
} catch {
|
|
817
|
+
return atob(e);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
function oe(f) {
|
|
821
|
+
return decodeURIComponent(atob(f).replace(/(.)/g, (e, h) => {
|
|
822
|
+
let v = h.charCodeAt(0).toString(16).toUpperCase();
|
|
823
|
+
return v.length < 2 && (v = "0" + v), "%" + v;
|
|
824
|
+
}));
|
|
825
|
+
}
|
|
826
|
+
function V(f) {
|
|
827
|
+
return typeof f == "object" && f !== null;
|
|
828
|
+
}
|
|
829
|
+
let m = null;
|
|
830
|
+
function ae(f, e = !0) {
|
|
831
|
+
return m || (m = new Y({
|
|
832
|
+
url: f.url,
|
|
833
|
+
realm: f.realm,
|
|
834
|
+
clientId: f.clientId
|
|
835
|
+
})), m.init({
|
|
836
|
+
onLoad: e ? "check-sso" : "login-required",
|
|
837
|
+
checkLoginIframe: !1
|
|
838
|
+
//silentCheckSsoRedirectUri: `${window.location.origin}/silent-check-sso.html`, // Ensure this file is set up
|
|
839
|
+
}).then((h) => h).catch((h) => (console.error("Failed to initialize Keycloak:", h), !1));
|
|
840
|
+
}
|
|
841
|
+
function ie() {
|
|
842
|
+
return m != null && m.authenticated && (m != null && m.idTokenParsed) ? {
|
|
843
|
+
fullname: m.idTokenParsed.name,
|
|
844
|
+
email: m.idTokenParsed.email,
|
|
845
|
+
lastname: m.idTokenParsed.family_name,
|
|
846
|
+
firstname: m.idTokenParsed.given_name,
|
|
847
|
+
username: m.idTokenParsed.preferred_username,
|
|
848
|
+
background: "grey",
|
|
849
|
+
// Optional custom value
|
|
850
|
+
token: m.token,
|
|
851
|
+
sub: m.idTokenParsed.sub
|
|
852
|
+
} : {};
|
|
853
|
+
}
|
|
854
|
+
function se() {
|
|
855
|
+
m ? m.login() : console.error("Keycloak is not initialized.");
|
|
856
|
+
}
|
|
857
|
+
function ce() {
|
|
858
|
+
m ? m.logout() : console.error("Keycloak is not initialized.");
|
|
859
|
+
}
|
|
860
|
+
function le() {
|
|
861
|
+
return !!(m != null && m.authenticated);
|
|
862
|
+
}
|
|
863
|
+
async function ue(f) {
|
|
864
|
+
try {
|
|
865
|
+
const e = await fetch(f, { method: "HEAD", mode: "no-cors" });
|
|
866
|
+
return e.ok || e.type === "opaque";
|
|
867
|
+
} catch {
|
|
868
|
+
return !1;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
export {
|
|
872
|
+
ce as a,
|
|
873
|
+
le as b,
|
|
874
|
+
ue as c,
|
|
875
|
+
ie as g,
|
|
876
|
+
ae as i,
|
|
877
|
+
se as l
|
|
878
|
+
};
|