@ebrains/vue 0.9.2-beta → 0.9.3-beta
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/analytics-44b1416b-3vYuu4Xs.mjs +28 -0
- package/analytics-44b1416b-ol77SdQE.js +1 -0
- 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/bookmark-c200037c-CIcZ51ZQ.js +14 -0
- package/bookmark-c200037c-ClkCtyRY.mjs +17 -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-2554aad6-CCcV5UJZ.mjs +131 -0
- package/color-2554aad6-D1hFGX4H.js +1 -0
- package/color-primary-palette_6.entry-CloKiAKI.mjs +300 -0
- package/color-primary-palette_6.entry-DnBuZqiu.js +1 -0
- package/components-section.entry-BZl-upvI.js +162 -0
- package/components-section.entry-DEtf0V8r.mjs +351 -0
- package/copy-03b72cb6-B_WCNQrG.mjs +6 -0
- package/copy-03b72cb6-CZAFAegx.js +3 -0
- package/correct-use-of-colors.entry-CvrVVhIA.mjs +59 -0
- package/correct-use-of-colors.entry-ajROARV6.js +1 -0
- package/docs-palettes.entry-CegYRhKo.js +1 -0
- package/docs-palettes.entry-OWUmgE8-.mjs +22 -0
- package/docs-tokens.entry-BIwcLv8t.js +1 -0
- package/docs-tokens.entry-D720jRIB.mjs +30 -0
- package/eds-accordion.entry-Ct4upGzD.mjs +48 -0
- package/eds-accordion.entry-D5Qn9bWB.js +4 -0
- package/eds-alert.entry-D9ClanEp.js +739 -0
- package/eds-alert.entry-D9R2BeLM.mjs +825 -0
- package/eds-app-root.entry-C-CwU-8Y.js +1 -0
- package/eds-app-root.entry-DPM5X6uN.mjs +25 -0
- package/eds-avatar_27.entry-7vAHtj7m.mjs +33545 -0
- package/eds-avatar_27.entry-CnmtSNAS.js +31838 -0
- package/eds-card-desc_2.entry-1GoZmzeQ.mjs +53 -0
- package/eds-card-desc_2.entry-BfOXVZi0.js +1 -0
- package/eds-card-generic.entry-BKpFgWlR.js +1 -0
- package/eds-card-generic.entry-CT7jqo3p.mjs +56 -0
- package/eds-card-project.entry-BbLZfxAE.js +1 -0
- package/eds-card-project.entry-O11d3day.mjs +44 -0
- package/eds-card-section.entry-BWDrARpV.js +1 -0
- package/eds-card-section.entry-CXFOGMeJ.mjs +30 -0
- package/eds-card-tags.entry-Debtxwjy.mjs +13 -0
- package/eds-card-tags.entry-Do7oGWtS.js +1 -0
- package/eds-card-tool.entry-CXluEgpO.mjs +56 -0
- package/eds-card-tool.entry-kxsYfCOl.js +1 -0
- package/eds-card-wrapper.entry-DnHxiCgs.js +1 -0
- package/eds-card-wrapper.entry-Dyrfqp6K.mjs +24 -0
- package/eds-code-block.entry-B2tVEczx.js +9 -0
- package/eds-code-block.entry-BIGwear1.mjs +1623 -0
- package/eds-cookies-preference.entry-BwTBWuc7.mjs +20 -0
- package/eds-cookies-preference.entry-mbjVkbaf.js +1 -0
- package/eds-feedback.entry-CxE8Mda2.js +1 -0
- package/eds-feedback.entry-DQZP2iFN.mjs +53 -0
- package/eds-frame.entry-BzGgy3Ya.mjs +67 -0
- package/eds-frame.entry-CGFInzxQ.js +1 -0
- package/eds-icon-arrow-diagonal.entry-BzMthIH3.js +1 -0
- package/eds-icon-arrow-diagonal.entry-D0nObc1G.mjs +13 -0
- package/eds-icon-arrow-right.entry-BGLDpWIT.mjs +13 -0
- package/eds-icon-arrow-right.entry-DPLcd0Dg.js +1 -0
- package/eds-icon-bluesky.entry-ZXTtFyYw.mjs +13 -0
- package/eds-icon-bluesky.entry-bnwTCSoD.js +1 -0
- package/eds-icon-bookmark.entry-BV8nKCLz.mjs +13 -0
- package/eds-icon-bookmark.entry-vBTnOEht.js +1 -0
- package/eds-icon-chevron-down.entry-9YeZRA_B.mjs +13 -0
- package/eds-icon-chevron-down.entry-BNSIoEMh.js +1 -0
- package/eds-icon-chevron-left.entry-BBKqN2RH.js +1 -0
- package/eds-icon-chevron-left.entry-Bm5LaJAt.mjs +13 -0
- package/eds-icon-chevron-right.entry-ChbDkmms.mjs +13 -0
- package/eds-icon-chevron-right.entry-CieI-tuC.js +1 -0
- package/eds-icon-chevron-up.entry-BqkKRoL-.js +1 -0
- package/eds-icon-chevron-up.entry-D3DkXrLO.mjs +13 -0
- package/eds-icon-close.entry-4xYgUnOY.js +1 -0
- package/eds-icon-close.entry-DQv18xqh.mjs +13 -0
- package/eds-icon-copy.entry-C7-kaujN.mjs +13 -0
- package/eds-icon-copy.entry-DQl13_LK.js +1 -0
- package/eds-icon-eu.entry-B8fNjCUv.js +1 -0
- package/eds-icon-eu.entry-DR5lezcj.mjs +13 -0
- package/eds-icon-external.entry-BaIofxzF.js +1 -0
- package/eds-icon-external.entry-DvY_6Ld0.mjs +13 -0
- package/eds-icon-facebook.entry-D7FANZCQ.mjs +13 -0
- package/eds-icon-facebook.entry-Do2GEkmS.js +1 -0
- package/eds-icon-gitlab.entry-D7FC3Vn4.mjs +13 -0
- package/eds-icon-gitlab.entry-p78Zzlxs.js +1 -0
- package/eds-icon-linkedin.entry-BYQGxGkX.js +1 -0
- package/eds-icon-linkedin.entry-CchbiOIO.mjs +13 -0
- package/eds-icon-loader.entry-C8zfXt5G.mjs +13 -0
- package/eds-icon-loader.entry-Cw7oYrm3.js +1 -0
- package/eds-icon-mastodon.entry-BOgFKnbj.mjs +13 -0
- package/eds-icon-mastodon.entry-C_TXVQJB.js +1 -0
- package/eds-icon-menu.entry-BtdrFvM4.js +1 -0
- package/eds-icon-menu.entry-Dl7Xqhc3.mjs +13 -0
- package/eds-icon-minus.entry-BA5Al4_F.js +1 -0
- package/eds-icon-minus.entry-Bfm78Q48.mjs +13 -0
- package/eds-icon-more.entry-CHzRpt-L.mjs +13 -0
- package/eds-icon-more.entry-mAUgJoHF.js +1 -0
- package/eds-icon-paper.entry-DEiOlvnw.mjs +13 -0
- package/eds-icon-paper.entry-DtE79_lg.js +1 -0
- package/eds-icon-plus.entry-BCc2gk-Y.js +1 -0
- package/eds-icon-plus.entry-DxdfImnp.mjs +13 -0
- package/eds-icon-portal.entry-DgJxnehb.js +1 -0
- package/eds-icon-portal.entry-DygPWj8q.mjs +13 -0
- package/eds-icon-private.entry-BtxnzDjj.js +1 -0
- package/eds-icon-private.entry-ClDqtUa4.mjs +13 -0
- package/eds-icon-public.entry-BKL5QMPS.js +1 -0
- package/eds-icon-public.entry-D0qOA8dF.mjs +13 -0
- package/eds-icon-search.entry-BPeHLF3h.js +1 -0
- package/eds-icon-search.entry-iegCSWzH.mjs +13 -0
- package/eds-icon-star.entry-BP6oBKRH.mjs +13 -0
- package/eds-icon-star.entry-DSHqvj6t.js +1 -0
- package/eds-icon-success.entry-B2vqFpAU.mjs +13 -0
- package/eds-icon-success.entry-DoaW0KlM.js +1 -0
- package/eds-icon-thumbs-down.entry-CFMyu-CY.js +1 -0
- package/eds-icon-thumbs-down.entry-CmV8Km2F.mjs +13 -0
- package/eds-icon-thumbs-up.entry-8RPnzfnW.js +1 -0
- package/eds-icon-thumbs-up.entry-DhfFxKPT.mjs +13 -0
- package/eds-icon-tutorial.entry-B3NRKCnl.mjs +13 -0
- package/eds-icon-tutorial.entry-ImfBSV9b.js +1 -0
- package/eds-icon-twitter.entry-BLvpOiN-.js +1 -0
- package/eds-icon-twitter.entry-Da3X1sWO.mjs +13 -0
- package/eds-icon-unknown.entry--9_uerA-.js +1 -0
- package/eds-icon-unknown.entry-DH3YcJSO.mjs +13 -0
- package/eds-icon-updown.entry-BU4FzzAC.js +1 -0
- package/eds-icon-updown.entry-D6t6TWtG.mjs +13 -0
- package/eds-icon-user.entry-pb-JM7tE.mjs +13 -0
- package/eds-icon-user.entry-yNOw7Z1J.js +1 -0
- package/eds-icon-youtube.entry-CIx5D-1i.mjs +13 -0
- package/eds-icon-youtube.entry-CNH9Mxfw.js +1 -0
- package/eds-login_2.entry-shWfmpH4.mjs +981 -0
- package/eds-login_2.entry-swrZnwUp.js +9 -0
- package/eds-matomo-notice.entry-DD0R8UUN.mjs +90 -0
- package/eds-matomo-notice.entry-cucI3F6F.js +1 -0
- package/eds-pagination_2.entry-Cmqe9RbB.mjs +258 -0
- package/eds-pagination_2.entry-DFO92YFs.js +1 -0
- package/eds-progress-bar.entry-CIkJEHf9.mjs +21 -0
- package/eds-progress-bar.entry-CUoQ0OmO.js +1 -0
- package/eds-rating.entry-BJZaV3ft.js +1 -0
- package/eds-rating.entry-BaneuoOA.mjs +61 -0
- package/eds-section-core_2.entry-dmjdE4gJ.mjs +39 -0
- package/eds-section-core_2.entry-wnSqKsfm.js +1 -0
- package/eds-spinner.entry-BwIR2ZO2.mjs +36 -0
- package/eds-spinner.entry-Cdu4PTNJ.js +1 -0
- package/eds-switch.entry-8g9JkW0c.js +1 -0
- package/eds-switch.entry-BOxsYeYC.mjs +20 -0
- package/eds-tabs.entry-CdlLmrmB.js +7794 -0
- package/eds-tabs.entry-DRJv1vVW.mjs +7897 -0
- package/eds-timeline.entry-AsApD57a.mjs +7839 -0
- package/eds-timeline.entry-MDj5oqZG.js +7794 -0
- package/eds-toast-manager.entry-Bri3h_MP.mjs +36 -0
- package/eds-toast-manager.entry-zrDxthPz.js +1 -0
- package/eds-toast.entry-B1RS9m4v.js +3 -0
- package/eds-toast.entry-BNYlJ84c.mjs +61 -0
- package/eds-tooltip.entry-B6UpJ0wf.js +1 -0
- package/eds-tooltip.entry-Ci5te9B_.mjs +77 -0
- package/eds-trl.entry-CuUDfGYw.js +1 -0
- package/eds-trl.entry-Dz7LP4G1.mjs +34 -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 +40 -0
- package/generated/vue-component-lib/utils.d.ts +16 -0
- package/incorrect-use-of-colors.entry-CYXsk3TR.mjs +42 -0
- package/incorrect-use-of-colors.entry-CfmdbA7l.js +1 -0
- package/index-39c58238-BwYCDOHZ.mjs +44 -0
- package/index-39c58238-SQ-JC-LH.js +1 -0
- package/index-7ljGsgwC.js +21 -0
- package/index-l365C9dI.mjs +3617 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.mjs +42 -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-DxZ7v-wS.js +6 -0
- package/logo-space.entry-GOUZQmu9.mjs +19 -0
- package/logo-variations-horizontal_2.entry-CRdycvC5.js +7 -0
- package/logo-variations-horizontal_2.entry-DimbU2IU.mjs +29 -0
- package/logo-variations-tabs.entry-5kLk6tXo.js +1 -0
- package/logo-variations-tabs.entry-Uc3TLufg.mjs +22 -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-13RSC-bu.js +1 -0
- package/logo-wrong-usage.entry-CYcqaVbn.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/minus-b30a7c71-BPAvqHzH.mjs +12 -0
- package/minus-b30a7c71-DqCTe6Qh.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 +1 -1
- package/paper-8e74ea31-BvGrc1Vo.mjs +16 -0
- package/paper-8e74ea31-C4CV6tlB.js +13 -0
- package/plus-89c07be2-BTXnjg5K.js +10 -0
- package/plus-89c07be2-DyT9I4-L.mjs +13 -0
- package/portal-d6c8ce56-Cj61ldo8.mjs +19 -0
- package/portal-d6c8ce56-NpSrdNZ_.js +16 -0
- package/private-1c25ff8e-D3Fo36q6.js +23 -0
- package/private-1c25ff8e-Dz82_Xf8.mjs +26 -0
- package/public-d4d8c585-BJKDD5F6.mjs +17 -0
- package/public-d4d8c585-lV6QxdPw.js +14 -0
- package/search-fbcd79c2-BMxCaeEk.js +10 -0
- package/search-fbcd79c2-rfV0PlHP.mjs +13 -0
- package/sharedUtils-a550989c-Ci3Tx3jc.mjs +15 -0
- package/sharedUtils-a550989c-m4pF1Vqy.js +1 -0
- package/star-0da9b5e9-B3-jr0yE.js +3 -0
- package/star-0da9b5e9-DX8_iFmu.mjs +6 -0
- package/success-443809da-BD23vltm.mjs +19 -0
- package/success-443809da-BUEhLsAD.js +16 -0
- package/svg-repository.entry-Ck1z1CpA.js +173 -0
- package/svg-repository.entry-IIRiiFbB.mjs +301 -0
- package/thumbs-down-a18fd049-CzuBAj99.mjs +6 -0
- package/thumbs-down-a18fd049-DTNIbYbm.js +3 -0
- package/thumbs-up-c19a71bc-CjLv5Wgw.mjs +7 -0
- package/thumbs-up-c19a71bc-w8Z8gegt.js +4 -0
- package/toastManager-d9eee791-CEYNwx25.mjs +30 -0
- package/toastManager-d9eee791-DvR_vUPI.js +1 -0
- package/token-list_3.entry-CLlUT7ge.js +1 -0
- package/token-list_3.entry-CQ9aUIVd.mjs +247 -0
- package/token-ratios.entry-DkgSpwqw.mjs +25 -0
- package/token-ratios.entry-Dtrkv16c.js +1 -0
- package/token-typography.entry-CgJdJgCR.js +2 -0
- package/token-typography.entry-CrMCS1R0.mjs +213 -0
- package/tutotial-150ee1fd-DFdyoHVA.mjs +28 -0
- package/tutotial-150ee1fd-DjN_JBL5.js +25 -0
- package/twitter-ac21b505-CGWVGWM9.mjs +15 -0
- package/twitter-ac21b505-DDdHS4hB.js +12 -0
- package/unknown-ed01a24c-B0AcMuip.js +20 -0
- package/unknown-ed01a24c-DonOUpIC.mjs +23 -0
- package/up-and-down-d747abee-CWoZjUyq.js +10 -0
- package/up-and-down-d747abee-D7g6H0T0.mjs +13 -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
- package/.eslintrc.json +0 -18
- package/project.json +0 -9
- package/src/generated/components.ts +0 -374
- package/src/generated/vue-component-lib/utils.ts +0 -236
- package/src/index.ts +0 -1
- package/src/vue-shims.d.ts +0 -5
- package/tsconfig.json +0 -18
- package/tsconfig.lib.json +0 -27
- package/vite.config.ts +0 -71
|
@@ -0,0 +1,981 @@
|
|
|
1
|
+
import { r as X, c as J, h as U, H as se } from "./index-l365C9dI.mjs";
|
|
2
|
+
import { t as R } from "./toastManager-d9eee791-CEYNwx25.mjs";
|
|
3
|
+
function q(u) {
|
|
4
|
+
if (!(this instanceof q))
|
|
5
|
+
throw new Error("The 'Keycloak' constructor must be invoked with 'new'.");
|
|
6
|
+
if (typeof u != "string" && !O(u))
|
|
7
|
+
throw new Error("The 'Keycloak' constructor must be provided with a configuration object, or a URL to a JSON configuration file.");
|
|
8
|
+
if (O(u)) {
|
|
9
|
+
const r = "oidcProvider" in u ? ["clientId"] : ["url", "realm", "clientId"];
|
|
10
|
+
for (const t of r)
|
|
11
|
+
if (!u[t])
|
|
12
|
+
throw new Error(`The configuration object is missing the required '${t}' property.`);
|
|
13
|
+
}
|
|
14
|
+
var e = this, p, v = [], I, h = {
|
|
15
|
+
enable: !0,
|
|
16
|
+
callbackList: [],
|
|
17
|
+
interval: 5
|
|
18
|
+
};
|
|
19
|
+
e.didInitialize = !1;
|
|
20
|
+
var P = !0, _ = W(console.info), M = W(console.warn);
|
|
21
|
+
globalThis.isSecureContext || M(
|
|
22
|
+
`[KEYCLOAK] Keycloak JS must be used in a 'secure context' to function properly as it relies on browser APIs that are otherwise not available.
|
|
23
|
+
Continuing to run your application insecurely will lead to unexpected behavior and breakage.
|
|
24
|
+
|
|
25
|
+
For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts`
|
|
26
|
+
), e.init = function(r = {}) {
|
|
27
|
+
if (e.didInitialize)
|
|
28
|
+
throw new Error("A 'Keycloak' instance can only be initialized once.");
|
|
29
|
+
e.didInitialize = !0, e.authenticated = !1, I = ie();
|
|
30
|
+
var t = ["default", "cordova", "cordova-native"];
|
|
31
|
+
if (t.indexOf(r.adapter) > -1 ? p = N(r.adapter) : typeof r.adapter == "object" ? p = r.adapter : window.Cordova || window.cordova ? p = N("cordova") : p = N(), typeof r.useNonce < "u" && (P = r.useNonce), typeof r.checkLoginIframe < "u" && (h.enable = r.checkLoginIframe), r.checkLoginIframeInterval && (h.interval = r.checkLoginIframeInterval), r.onLoad === "login-required" && (e.loginRequired = !0), r.responseMode)
|
|
32
|
+
if (r.responseMode === "query" || r.responseMode === "fragment")
|
|
33
|
+
e.responseMode = r.responseMode;
|
|
34
|
+
else
|
|
35
|
+
throw "Invalid value for responseMode";
|
|
36
|
+
if (r.flow) {
|
|
37
|
+
switch (r.flow) {
|
|
38
|
+
case "standard":
|
|
39
|
+
e.responseType = "code";
|
|
40
|
+
break;
|
|
41
|
+
case "implicit":
|
|
42
|
+
e.responseType = "id_token token";
|
|
43
|
+
break;
|
|
44
|
+
case "hybrid":
|
|
45
|
+
e.responseType = "code id_token token";
|
|
46
|
+
break;
|
|
47
|
+
default:
|
|
48
|
+
throw "Invalid value for flow";
|
|
49
|
+
}
|
|
50
|
+
e.flow = r.flow;
|
|
51
|
+
}
|
|
52
|
+
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") {
|
|
53
|
+
if (r.pkceMethod !== "S256" && r.pkceMethod !== !1)
|
|
54
|
+
throw new TypeError(`Invalid value for pkceMethod', expected 'S256' or false but got ${r.pkceMethod}.`);
|
|
55
|
+
e.pkceMethod = r.pkceMethod;
|
|
56
|
+
} else
|
|
57
|
+
e.pkceMethod = "S256";
|
|
58
|
+
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, e.responseMode || (e.responseMode = "fragment"), e.responseType || (e.responseType = "code", e.flow = "standard");
|
|
59
|
+
var s = g(), i = g();
|
|
60
|
+
i.promise.then(function() {
|
|
61
|
+
e.onReady && e.onReady(e.authenticated), s.setSuccess(e.authenticated);
|
|
62
|
+
}).catch(function(o) {
|
|
63
|
+
s.setError(o);
|
|
64
|
+
});
|
|
65
|
+
var a = te();
|
|
66
|
+
function c() {
|
|
67
|
+
var o = function(d) {
|
|
68
|
+
d || (f.prompt = "none"), r.locale && (f.locale = r.locale), e.login(f).then(function() {
|
|
69
|
+
i.setSuccess();
|
|
70
|
+
}).catch(function(m) {
|
|
71
|
+
i.setError(m);
|
|
72
|
+
});
|
|
73
|
+
}, l = async function() {
|
|
74
|
+
var d = document.createElement("iframe"), m = await e.createLoginUrl({ prompt: "none", redirectUri: e.silentCheckSsoRedirectUri });
|
|
75
|
+
d.setAttribute("src", m), 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);
|
|
76
|
+
var w = function(S) {
|
|
77
|
+
if (!(S.origin !== window.location.origin || d.contentWindow !== S.source)) {
|
|
78
|
+
var y = E(S.data);
|
|
79
|
+
T(y, i), document.body.removeChild(d), window.removeEventListener("message", w);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
window.addEventListener("message", w);
|
|
83
|
+
}, f = {};
|
|
84
|
+
switch (r.onLoad) {
|
|
85
|
+
case "check-sso":
|
|
86
|
+
h.enable ? K().then(function() {
|
|
87
|
+
L().then(function(d) {
|
|
88
|
+
d ? i.setSuccess() : e.silentCheckSsoRedirectUri ? l() : o(!1);
|
|
89
|
+
}).catch(function(d) {
|
|
90
|
+
i.setError(d);
|
|
91
|
+
});
|
|
92
|
+
}) : e.silentCheckSsoRedirectUri ? l() : o(!1);
|
|
93
|
+
break;
|
|
94
|
+
case "login-required":
|
|
95
|
+
o(!0);
|
|
96
|
+
break;
|
|
97
|
+
default:
|
|
98
|
+
throw "Invalid value for onLoad";
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function n() {
|
|
102
|
+
var o = E(window.location.href);
|
|
103
|
+
if (o && window.history.replaceState(window.history.state, null, o.newUrl), o && o.valid)
|
|
104
|
+
return K().then(function() {
|
|
105
|
+
T(o, i);
|
|
106
|
+
}).catch(function(l) {
|
|
107
|
+
i.setError(l);
|
|
108
|
+
});
|
|
109
|
+
r.token && r.refreshToken ? (C(r.token, r.refreshToken, r.idToken), h.enable ? K().then(function() {
|
|
110
|
+
L().then(function(l) {
|
|
111
|
+
l ? (e.onAuthSuccess && e.onAuthSuccess(), i.setSuccess(), H()) : i.setSuccess();
|
|
112
|
+
}).catch(function(l) {
|
|
113
|
+
i.setError(l);
|
|
114
|
+
});
|
|
115
|
+
}) : e.updateToken(-1).then(function() {
|
|
116
|
+
e.onAuthSuccess && e.onAuthSuccess(), i.setSuccess();
|
|
117
|
+
}).catch(function(l) {
|
|
118
|
+
e.onAuthError && e.onAuthError(), r.onLoad ? c() : i.setError(l);
|
|
119
|
+
})) : r.onLoad ? c() : i.setSuccess();
|
|
120
|
+
}
|
|
121
|
+
return a.then(function() {
|
|
122
|
+
ae().then(n).catch(function(o) {
|
|
123
|
+
s.setError(o);
|
|
124
|
+
});
|
|
125
|
+
}), a.catch(function(o) {
|
|
126
|
+
s.setError(o);
|
|
127
|
+
}), s.promise;
|
|
128
|
+
}, e.login = function(r) {
|
|
129
|
+
return p.login(r);
|
|
130
|
+
};
|
|
131
|
+
function B(r) {
|
|
132
|
+
if (typeof crypto > "u" || typeof crypto.getRandomValues > "u")
|
|
133
|
+
throw new Error("Web Crypto API is not available.");
|
|
134
|
+
return crypto.getRandomValues(new Uint8Array(r));
|
|
135
|
+
}
|
|
136
|
+
function $(r) {
|
|
137
|
+
return Q(r, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
|
|
138
|
+
}
|
|
139
|
+
function Q(r, t) {
|
|
140
|
+
for (var s = B(r), i = new Array(r), a = 0; a < r; a++)
|
|
141
|
+
i[a] = t.charCodeAt(s[a] % t.length);
|
|
142
|
+
return String.fromCharCode.apply(null, i);
|
|
143
|
+
}
|
|
144
|
+
async function Z(r, t) {
|
|
145
|
+
if (r !== "S256")
|
|
146
|
+
throw new TypeError(`Invalid value for 'pkceMethod', expected 'S256' but got '${r}'.`);
|
|
147
|
+
const s = new Uint8Array(await le(t));
|
|
148
|
+
return ce(s).replace(/\+/g, "-").replace(/\//g, "_").replace(/\=/g, "");
|
|
149
|
+
}
|
|
150
|
+
function ee(r) {
|
|
151
|
+
var t = {
|
|
152
|
+
id_token: {
|
|
153
|
+
acr: r
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
return JSON.stringify(t);
|
|
157
|
+
}
|
|
158
|
+
e.createLoginUrl = async function(r) {
|
|
159
|
+
var t = Y(), s = Y(), i = p.redirectUri(r), a = {
|
|
160
|
+
state: t,
|
|
161
|
+
nonce: s,
|
|
162
|
+
redirectUri: encodeURIComponent(i),
|
|
163
|
+
loginOptions: r
|
|
164
|
+
};
|
|
165
|
+
r && r.prompt && (a.prompt = r.prompt);
|
|
166
|
+
var c;
|
|
167
|
+
r && r.action == "register" ? c = e.endpoints.register() : c = e.endpoints.authorize();
|
|
168
|
+
var n = r && r.scope || e.scope;
|
|
169
|
+
n ? n.indexOf("openid") === -1 && (n = "openid " + n) : n = "openid";
|
|
170
|
+
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);
|
|
171
|
+
if (P && (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) {
|
|
172
|
+
var l = ee(r.acr);
|
|
173
|
+
o += "&claims=" + encodeURIComponent(l);
|
|
174
|
+
}
|
|
175
|
+
if ((r && r.acrValues || e.acrValues) && (o += "&acr_values=" + encodeURIComponent(r.acrValues || e.acrValues)), e.pkceMethod)
|
|
176
|
+
try {
|
|
177
|
+
const f = $(96), d = await Z(e.pkceMethod, f);
|
|
178
|
+
a.pkceCodeVerifier = f, o += "&code_challenge=" + d, o += "&code_challenge_method=" + e.pkceMethod;
|
|
179
|
+
} catch (f) {
|
|
180
|
+
throw new Error("Failed to generate PKCE challenge.", { cause: f });
|
|
181
|
+
}
|
|
182
|
+
return I.add(a), o;
|
|
183
|
+
}, e.logout = function(r) {
|
|
184
|
+
return p.logout(r);
|
|
185
|
+
}, e.createLogoutUrl = function(r) {
|
|
186
|
+
if (((r == null ? void 0 : r.logoutMethod) ?? e.logoutMethod) === "POST")
|
|
187
|
+
return e.endpoints.logout();
|
|
188
|
+
var s = e.endpoints.logout() + "?client_id=" + encodeURIComponent(e.clientId) + "&post_logout_redirect_uri=" + encodeURIComponent(p.redirectUri(r, !1));
|
|
189
|
+
return e.idToken && (s += "&id_token_hint=" + encodeURIComponent(e.idToken)), s;
|
|
190
|
+
}, e.register = function(r) {
|
|
191
|
+
return p.register(r);
|
|
192
|
+
}, e.createRegisterUrl = async function(r) {
|
|
193
|
+
return r || (r = {}), r.action = "register", await e.createLoginUrl(r);
|
|
194
|
+
}, e.createAccountUrl = function(r) {
|
|
195
|
+
var t = b(), s = void 0;
|
|
196
|
+
return typeof t < "u" && (s = t + "/account?referrer=" + encodeURIComponent(e.clientId) + "&referrer_uri=" + encodeURIComponent(p.redirectUri(r))), s;
|
|
197
|
+
}, e.accountManagement = function() {
|
|
198
|
+
return p.accountManagement();
|
|
199
|
+
}, e.hasRealmRole = function(r) {
|
|
200
|
+
var t = e.realmAccess;
|
|
201
|
+
return !!t && t.roles.indexOf(r) >= 0;
|
|
202
|
+
}, e.hasResourceRole = function(r, t) {
|
|
203
|
+
if (!e.resourceAccess)
|
|
204
|
+
return !1;
|
|
205
|
+
var s = e.resourceAccess[t || e.clientId];
|
|
206
|
+
return !!s && s.roles.indexOf(r) >= 0;
|
|
207
|
+
}, e.loadUserProfile = function() {
|
|
208
|
+
var r = b() + "/account", t = new XMLHttpRequest();
|
|
209
|
+
t.open("GET", r, !0), t.setRequestHeader("Accept", "application/json"), t.setRequestHeader("Authorization", "bearer " + e.token);
|
|
210
|
+
var s = g();
|
|
211
|
+
return t.onreadystatechange = function() {
|
|
212
|
+
t.readyState == 4 && (t.status == 200 ? (e.profile = JSON.parse(t.responseText), s.setSuccess(e.profile)) : s.setError());
|
|
213
|
+
}, t.send(), s.promise;
|
|
214
|
+
}, e.loadUserInfo = function() {
|
|
215
|
+
var r = e.endpoints.userinfo(), t = new XMLHttpRequest();
|
|
216
|
+
t.open("GET", r, !0), t.setRequestHeader("Accept", "application/json"), t.setRequestHeader("Authorization", "bearer " + e.token);
|
|
217
|
+
var s = g();
|
|
218
|
+
return t.onreadystatechange = function() {
|
|
219
|
+
t.readyState == 4 && (t.status == 200 ? (e.userInfo = JSON.parse(t.responseText), s.setSuccess(e.userInfo)) : s.setError());
|
|
220
|
+
}, t.send(), s.promise;
|
|
221
|
+
}, e.isTokenExpired = function(r) {
|
|
222
|
+
if (!e.tokenParsed || !e.refreshToken && e.flow != "implicit")
|
|
223
|
+
throw "Not authenticated";
|
|
224
|
+
if (e.timeSkew == null)
|
|
225
|
+
return _("[KEYCLOAK] Unable to determine if token is expired as timeskew is not set"), !0;
|
|
226
|
+
var t = e.tokenParsed.exp - Math.ceil((/* @__PURE__ */ new Date()).getTime() / 1e3) + e.timeSkew;
|
|
227
|
+
if (r) {
|
|
228
|
+
if (isNaN(r))
|
|
229
|
+
throw "Invalid minValidity";
|
|
230
|
+
t -= r;
|
|
231
|
+
}
|
|
232
|
+
return t < 0;
|
|
233
|
+
}, e.updateToken = function(r) {
|
|
234
|
+
var t = g();
|
|
235
|
+
if (!e.refreshToken)
|
|
236
|
+
return t.setError(), t.promise;
|
|
237
|
+
r = r || 5;
|
|
238
|
+
var s = function() {
|
|
239
|
+
var a = !1;
|
|
240
|
+
if (r == -1 ? (a = !0, _("[KEYCLOAK] Refreshing token: forced refresh")) : (!e.tokenParsed || e.isTokenExpired(r)) && (a = !0, _("[KEYCLOAK] Refreshing token: token expired")), !a)
|
|
241
|
+
t.setSuccess(!1);
|
|
242
|
+
else {
|
|
243
|
+
var c = "grant_type=refresh_token&refresh_token=" + e.refreshToken, n = e.endpoints.token();
|
|
244
|
+
if (v.push(t), v.length == 1) {
|
|
245
|
+
var o = new XMLHttpRequest();
|
|
246
|
+
o.open("POST", n, !0), o.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), o.withCredentials = !0, c += "&client_id=" + encodeURIComponent(e.clientId);
|
|
247
|
+
var l = (/* @__PURE__ */ new Date()).getTime();
|
|
248
|
+
o.onreadystatechange = function() {
|
|
249
|
+
if (o.readyState == 4)
|
|
250
|
+
if (o.status == 200) {
|
|
251
|
+
_("[KEYCLOAK] Token refreshed"), l = (l + (/* @__PURE__ */ new Date()).getTime()) / 2;
|
|
252
|
+
var f = JSON.parse(o.responseText);
|
|
253
|
+
C(f.access_token, f.refresh_token, f.id_token, l), e.onAuthRefreshSuccess && e.onAuthRefreshSuccess();
|
|
254
|
+
for (var d = v.pop(); d != null; d = v.pop())
|
|
255
|
+
d.setSuccess(!0);
|
|
256
|
+
} else {
|
|
257
|
+
M("[KEYCLOAK] Failed to refresh token"), o.status == 400 && e.clearToken(), e.onAuthRefreshError && e.onAuthRefreshError();
|
|
258
|
+
for (var d = v.pop(); d != null; d = v.pop())
|
|
259
|
+
d.setError("Failed to refresh token: An unexpected HTTP error occurred while attempting to refresh the token.");
|
|
260
|
+
}
|
|
261
|
+
}, o.send(c);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
if (h.enable) {
|
|
266
|
+
var i = L();
|
|
267
|
+
i.then(function() {
|
|
268
|
+
s();
|
|
269
|
+
}).catch(function(a) {
|
|
270
|
+
t.setError(a);
|
|
271
|
+
});
|
|
272
|
+
} else
|
|
273
|
+
s();
|
|
274
|
+
return t.promise;
|
|
275
|
+
}, e.clearToken = function() {
|
|
276
|
+
e.token && (C(null, null, null), e.onAuthLogout && e.onAuthLogout(), e.loginRequired && e.login());
|
|
277
|
+
};
|
|
278
|
+
function b() {
|
|
279
|
+
if (typeof e.authServerUrl < "u")
|
|
280
|
+
return e.authServerUrl.charAt(e.authServerUrl.length - 1) == "/" ? e.authServerUrl + "realms/" + encodeURIComponent(e.realm) : e.authServerUrl + "/realms/" + encodeURIComponent(e.realm);
|
|
281
|
+
}
|
|
282
|
+
function re() {
|
|
283
|
+
return window.location.origin ? window.location.origin : window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
|
|
284
|
+
}
|
|
285
|
+
function T(r, t) {
|
|
286
|
+
var s = r.code, i = r.error, a = r.prompt, c = (/* @__PURE__ */ new Date()).getTime();
|
|
287
|
+
if (r.kc_action_status && e.onActionUpdate && e.onActionUpdate(r.kc_action_status, r.kc_action), i) {
|
|
288
|
+
if (a != "none")
|
|
289
|
+
if (r.error_description && r.error_description === "authentication_expired")
|
|
290
|
+
e.login(r.loginOptions);
|
|
291
|
+
else {
|
|
292
|
+
var n = { error: i, error_description: r.error_description };
|
|
293
|
+
e.onAuthError && e.onAuthError(n), t && t.setError(n);
|
|
294
|
+
}
|
|
295
|
+
else
|
|
296
|
+
t && t.setSuccess();
|
|
297
|
+
return;
|
|
298
|
+
} else e.flow != "standard" && (r.access_token || r.id_token) && d(r.access_token, null, r.id_token, !0);
|
|
299
|
+
if (e.flow != "implicit" && s) {
|
|
300
|
+
var o = "code=" + s + "&grant_type=authorization_code", l = e.endpoints.token(), f = new XMLHttpRequest();
|
|
301
|
+
f.open("POST", l, !0), f.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), f.withCredentials = !0, f.onreadystatechange = function() {
|
|
302
|
+
if (f.readyState == 4)
|
|
303
|
+
if (f.status == 200) {
|
|
304
|
+
var m = JSON.parse(f.responseText);
|
|
305
|
+
d(m.access_token, m.refresh_token, m.id_token, e.flow === "standard"), H();
|
|
306
|
+
} else
|
|
307
|
+
e.onAuthError && e.onAuthError(), t && t.setError();
|
|
308
|
+
}, f.send(o);
|
|
309
|
+
}
|
|
310
|
+
function d(m, w, S, y) {
|
|
311
|
+
c = (c + (/* @__PURE__ */ new Date()).getTime()) / 2, C(m, w, S, c), P && e.idTokenParsed && e.idTokenParsed.nonce != r.storedNonce ? (_("[KEYCLOAK] Invalid nonce, clearing token"), e.clearToken(), t && t.setError()) : y && (e.onAuthSuccess && e.onAuthSuccess(), t && t.setSuccess());
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function te() {
|
|
315
|
+
var r = g(), t;
|
|
316
|
+
typeof u == "string" && (t = u);
|
|
317
|
+
function s(n) {
|
|
318
|
+
n ? e.endpoints = {
|
|
319
|
+
authorize: function() {
|
|
320
|
+
return n.authorization_endpoint;
|
|
321
|
+
},
|
|
322
|
+
token: function() {
|
|
323
|
+
return n.token_endpoint;
|
|
324
|
+
},
|
|
325
|
+
logout: function() {
|
|
326
|
+
if (!n.end_session_endpoint)
|
|
327
|
+
throw "Not supported by the OIDC server";
|
|
328
|
+
return n.end_session_endpoint;
|
|
329
|
+
},
|
|
330
|
+
checkSessionIframe: function() {
|
|
331
|
+
if (!n.check_session_iframe)
|
|
332
|
+
throw "Not supported by the OIDC server";
|
|
333
|
+
return n.check_session_iframe;
|
|
334
|
+
},
|
|
335
|
+
register: function() {
|
|
336
|
+
throw 'Redirection to "Register user" page not supported in standard OIDC mode';
|
|
337
|
+
},
|
|
338
|
+
userinfo: function() {
|
|
339
|
+
if (!n.userinfo_endpoint)
|
|
340
|
+
throw "Not supported by the OIDC server";
|
|
341
|
+
return n.userinfo_endpoint;
|
|
342
|
+
}
|
|
343
|
+
} : e.endpoints = {
|
|
344
|
+
authorize: function() {
|
|
345
|
+
return b() + "/protocol/openid-connect/auth";
|
|
346
|
+
},
|
|
347
|
+
token: function() {
|
|
348
|
+
return b() + "/protocol/openid-connect/token";
|
|
349
|
+
},
|
|
350
|
+
logout: function() {
|
|
351
|
+
return b() + "/protocol/openid-connect/logout";
|
|
352
|
+
},
|
|
353
|
+
checkSessionIframe: function() {
|
|
354
|
+
return b() + "/protocol/openid-connect/login-status-iframe.html";
|
|
355
|
+
},
|
|
356
|
+
thirdPartyCookiesIframe: function() {
|
|
357
|
+
return b() + "/protocol/openid-connect/3p-cookies/step1.html";
|
|
358
|
+
},
|
|
359
|
+
register: function() {
|
|
360
|
+
return b() + "/protocol/openid-connect/registrations";
|
|
361
|
+
},
|
|
362
|
+
userinfo: function() {
|
|
363
|
+
return b() + "/protocol/openid-connect/userinfo";
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
if (t) {
|
|
368
|
+
var i = new XMLHttpRequest();
|
|
369
|
+
i.open("GET", t, !0), i.setRequestHeader("Accept", "application/json"), i.onreadystatechange = function() {
|
|
370
|
+
if (i.readyState == 4)
|
|
371
|
+
if (i.status == 200 || F(i)) {
|
|
372
|
+
var n = JSON.parse(i.responseText);
|
|
373
|
+
e.authServerUrl = n["auth-server-url"], e.realm = n.realm, e.clientId = n.resource, s(null), r.setSuccess();
|
|
374
|
+
} else
|
|
375
|
+
r.setError();
|
|
376
|
+
}, i.send();
|
|
377
|
+
} else {
|
|
378
|
+
e.clientId = u.clientId;
|
|
379
|
+
var a = u.oidcProvider;
|
|
380
|
+
if (!a)
|
|
381
|
+
e.authServerUrl = u.url, e.realm = u.realm, s(null), r.setSuccess();
|
|
382
|
+
else if (typeof a == "string") {
|
|
383
|
+
var c;
|
|
384
|
+
a.charAt(a.length - 1) == "/" ? c = a + ".well-known/openid-configuration" : c = a + "/.well-known/openid-configuration";
|
|
385
|
+
var i = new XMLHttpRequest();
|
|
386
|
+
i.open("GET", c, !0), i.setRequestHeader("Accept", "application/json"), i.onreadystatechange = function() {
|
|
387
|
+
if (i.readyState == 4)
|
|
388
|
+
if (i.status == 200 || F(i)) {
|
|
389
|
+
var o = JSON.parse(i.responseText);
|
|
390
|
+
s(o), r.setSuccess();
|
|
391
|
+
} else
|
|
392
|
+
r.setError();
|
|
393
|
+
}, i.send();
|
|
394
|
+
} else
|
|
395
|
+
s(a), r.setSuccess();
|
|
396
|
+
}
|
|
397
|
+
return r.promise;
|
|
398
|
+
}
|
|
399
|
+
function F(r) {
|
|
400
|
+
return r.status == 0 && r.responseText && r.responseURL.startsWith("file:");
|
|
401
|
+
}
|
|
402
|
+
function C(r, t, s, i) {
|
|
403
|
+
if (e.tokenTimeoutHandle && (clearTimeout(e.tokenTimeoutHandle), e.tokenTimeoutHandle = null), t ? (e.refreshToken = t, e.refreshTokenParsed = V(t)) : (delete e.refreshToken, delete e.refreshTokenParsed), s ? (e.idToken = s, e.idTokenParsed = V(s)) : (delete e.idToken, delete e.idTokenParsed), r) {
|
|
404
|
+
if (e.token = r, e.tokenParsed = V(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)) {
|
|
405
|
+
var a = (e.tokenParsed.exp - (/* @__PURE__ */ new Date()).getTime() / 1e3 + e.timeSkew) * 1e3;
|
|
406
|
+
_("[KEYCLOAK] Token expires in " + Math.round(a / 1e3) + " s"), a <= 0 ? e.onTokenExpired() : e.tokenTimeoutHandle = setTimeout(e.onTokenExpired, a);
|
|
407
|
+
}
|
|
408
|
+
} else
|
|
409
|
+
delete e.token, delete e.tokenParsed, delete e.subject, delete e.realmAccess, delete e.resourceAccess, e.authenticated = !1;
|
|
410
|
+
}
|
|
411
|
+
function Y() {
|
|
412
|
+
if (typeof crypto > "u" || typeof crypto.randomUUID > "u")
|
|
413
|
+
throw new Error("Web Crypto API is not available.");
|
|
414
|
+
return crypto.randomUUID();
|
|
415
|
+
}
|
|
416
|
+
function E(r) {
|
|
417
|
+
var t = ne(r);
|
|
418
|
+
if (t) {
|
|
419
|
+
var s = I.get(t.state);
|
|
420
|
+
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;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
function ne(r) {
|
|
424
|
+
var t;
|
|
425
|
+
switch (e.flow) {
|
|
426
|
+
case "standard":
|
|
427
|
+
t = ["code", "state", "session_state", "kc_action_status", "kc_action", "iss"];
|
|
428
|
+
break;
|
|
429
|
+
case "implicit":
|
|
430
|
+
t = ["access_token", "token_type", "id_token", "state", "session_state", "expires_in", "kc_action_status", "kc_action", "iss"];
|
|
431
|
+
break;
|
|
432
|
+
case "hybrid":
|
|
433
|
+
t = ["access_token", "token_type", "id_token", "code", "state", "session_state", "expires_in", "kc_action_status", "kc_action", "iss"];
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
t.push("error"), t.push("error_description"), t.push("error_uri");
|
|
437
|
+
var s = r.indexOf("?"), i = r.indexOf("#"), a, c;
|
|
438
|
+
if (e.responseMode === "query" && s !== -1 ? (a = r.substring(0, s), c = G(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 = G(r.substring(i + 1), t), c.paramsString !== "" && (a += "#" + c.paramsString)), c && c.oauthParams) {
|
|
439
|
+
if (e.flow === "standard" || e.flow === "hybrid") {
|
|
440
|
+
if ((c.oauthParams.code || c.oauthParams.error) && c.oauthParams.state)
|
|
441
|
+
return c.oauthParams.newUrl = a, c.oauthParams;
|
|
442
|
+
} else if (e.flow === "implicit" && (c.oauthParams.access_token || c.oauthParams.error) && c.oauthParams.state)
|
|
443
|
+
return c.oauthParams.newUrl = a, c.oauthParams;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
function G(r, t) {
|
|
447
|
+
for (var s = r.split("&"), i = {
|
|
448
|
+
paramsString: "",
|
|
449
|
+
oauthParams: {}
|
|
450
|
+
}, a = 0; a < s.length; a++) {
|
|
451
|
+
var c = s[a].indexOf("="), n = s[a].slice(0, c);
|
|
452
|
+
t.indexOf(n) !== -1 ? i.oauthParams[n] = s[a].slice(c + 1) : (i.paramsString !== "" && (i.paramsString += "&"), i.paramsString += s[a]);
|
|
453
|
+
}
|
|
454
|
+
return i;
|
|
455
|
+
}
|
|
456
|
+
function g() {
|
|
457
|
+
var r = {
|
|
458
|
+
setSuccess: function(t) {
|
|
459
|
+
r.resolve(t);
|
|
460
|
+
},
|
|
461
|
+
setError: function(t) {
|
|
462
|
+
r.reject(t);
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
return r.promise = new Promise(function(t, s) {
|
|
466
|
+
r.resolve = t, r.reject = s;
|
|
467
|
+
}), r;
|
|
468
|
+
}
|
|
469
|
+
function oe(r, t, s) {
|
|
470
|
+
var i = null, a = new Promise(function(c, n) {
|
|
471
|
+
i = setTimeout(function() {
|
|
472
|
+
n({ error: s });
|
|
473
|
+
}, t);
|
|
474
|
+
});
|
|
475
|
+
return Promise.race([r, a]).finally(function() {
|
|
476
|
+
clearTimeout(i);
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
function K() {
|
|
480
|
+
var r = g();
|
|
481
|
+
if (!h.enable || h.iframe)
|
|
482
|
+
return r.setSuccess(), r.promise;
|
|
483
|
+
var t = document.createElement("iframe");
|
|
484
|
+
h.iframe = t, t.onload = function() {
|
|
485
|
+
var a = e.endpoints.authorize();
|
|
486
|
+
a.charAt(0) === "/" ? h.iframeOrigin = re() : h.iframeOrigin = a.substring(0, a.indexOf("/", 8)), r.setSuccess();
|
|
487
|
+
};
|
|
488
|
+
var s = e.endpoints.checkSessionIframe();
|
|
489
|
+
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);
|
|
490
|
+
var i = function(a) {
|
|
491
|
+
if (!(a.origin !== h.iframeOrigin || h.iframe.contentWindow !== a.source) && (a.data == "unchanged" || a.data == "changed" || a.data == "error")) {
|
|
492
|
+
a.data != "unchanged" && e.clearToken();
|
|
493
|
+
for (var c = h.callbackList.splice(0, h.callbackList.length), n = c.length - 1; n >= 0; --n) {
|
|
494
|
+
var o = c[n];
|
|
495
|
+
a.data == "error" ? o.setError() : o.setSuccess(a.data == "unchanged");
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
return window.addEventListener("message", i, !1), r.promise;
|
|
500
|
+
}
|
|
501
|
+
function H() {
|
|
502
|
+
h.enable && e.token && setTimeout(function() {
|
|
503
|
+
L().then(function(r) {
|
|
504
|
+
r && H();
|
|
505
|
+
});
|
|
506
|
+
}, h.interval * 1e3);
|
|
507
|
+
}
|
|
508
|
+
function L() {
|
|
509
|
+
var r = g();
|
|
510
|
+
if (h.iframe && h.iframeOrigin) {
|
|
511
|
+
var t = e.clientId + " " + (e.sessionId ? e.sessionId : "");
|
|
512
|
+
h.callbackList.push(r);
|
|
513
|
+
var s = h.iframeOrigin;
|
|
514
|
+
h.callbackList.length == 1 && h.iframe.contentWindow.postMessage(t, s);
|
|
515
|
+
} else
|
|
516
|
+
r.setSuccess();
|
|
517
|
+
return r.promise;
|
|
518
|
+
}
|
|
519
|
+
function ae() {
|
|
520
|
+
var r = g();
|
|
521
|
+
if ((h.enable || e.silentCheckSsoRedirectUri) && typeof e.endpoints.thirdPartyCookiesIframe == "function") {
|
|
522
|
+
var t = document.createElement("iframe");
|
|
523
|
+
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);
|
|
524
|
+
var s = function(i) {
|
|
525
|
+
t.contentWindow === i.source && (i.data !== "supported" && i.data !== "unsupported" || (i.data === "unsupported" && (M(
|
|
526
|
+
`[KEYCLOAK] Your browser is blocking access to 3rd-party cookies, this means:
|
|
527
|
+
|
|
528
|
+
- It is not possible to retrieve tokens without redirecting to the Keycloak server (a.k.a. no support for silent authentication).
|
|
529
|
+
- It is not possible to automatically detect changes to the session status (such as the user logging out in another tab).
|
|
530
|
+
|
|
531
|
+
For more information see: https://www.keycloak.org/securing-apps/javascript-adapter#_modern_browsers`
|
|
532
|
+
), h.enable = !1, e.silentCheckSsoFallback && (e.silentCheckSsoRedirectUri = !1)), document.body.removeChild(t), window.removeEventListener("message", s), r.setSuccess()));
|
|
533
|
+
};
|
|
534
|
+
window.addEventListener("message", s, !1);
|
|
535
|
+
} else
|
|
536
|
+
r.setSuccess();
|
|
537
|
+
return oe(r.promise, e.messageReceiveTimeout, "Timeout when waiting for 3rd party check iframe message.");
|
|
538
|
+
}
|
|
539
|
+
function N(r) {
|
|
540
|
+
if (!r || r == "default")
|
|
541
|
+
return {
|
|
542
|
+
login: async function(n) {
|
|
543
|
+
return window.location.assign(await e.createLoginUrl(n)), g().promise;
|
|
544
|
+
},
|
|
545
|
+
logout: async function(n) {
|
|
546
|
+
if (((n == null ? void 0 : n.logoutMethod) ?? e.logoutMethod) === "GET") {
|
|
547
|
+
window.location.replace(e.createLogoutUrl(n));
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
const l = document.createElement("form");
|
|
551
|
+
l.setAttribute("method", "POST"), l.setAttribute("action", e.createLogoutUrl(n)), l.style.display = "none";
|
|
552
|
+
const f = {
|
|
553
|
+
id_token_hint: e.idToken,
|
|
554
|
+
client_id: e.clientId,
|
|
555
|
+
post_logout_redirect_uri: p.redirectUri(n, !1)
|
|
556
|
+
};
|
|
557
|
+
for (const [d, m] of Object.entries(f)) {
|
|
558
|
+
const w = document.createElement("input");
|
|
559
|
+
w.setAttribute("type", "hidden"), w.setAttribute("name", d), w.setAttribute("value", m), l.appendChild(w);
|
|
560
|
+
}
|
|
561
|
+
document.body.appendChild(l), l.submit();
|
|
562
|
+
},
|
|
563
|
+
register: async function(n) {
|
|
564
|
+
return window.location.assign(await e.createRegisterUrl(n)), g().promise;
|
|
565
|
+
},
|
|
566
|
+
accountManagement: function() {
|
|
567
|
+
var n = e.createAccountUrl();
|
|
568
|
+
if (typeof n < "u")
|
|
569
|
+
window.location.href = n;
|
|
570
|
+
else
|
|
571
|
+
throw "Not supported by the OIDC server";
|
|
572
|
+
return g().promise;
|
|
573
|
+
},
|
|
574
|
+
redirectUri: function(n, o) {
|
|
575
|
+
return n && n.redirectUri ? n.redirectUri : e.redirectUri ? e.redirectUri : location.href;
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
if (r == "cordova") {
|
|
579
|
+
h.enable = !1;
|
|
580
|
+
var t = function(n, o, l) {
|
|
581
|
+
return window.cordova && window.cordova.InAppBrowser ? window.cordova.InAppBrowser.open(n, o, l) : window.open(n, o, l);
|
|
582
|
+
}, s = function(n) {
|
|
583
|
+
return n && n.cordovaOptions ? Object.keys(n.cordovaOptions).reduce(function(o, l) {
|
|
584
|
+
return o[l] = n.cordovaOptions[l], o;
|
|
585
|
+
}, {}) : {};
|
|
586
|
+
}, i = function(n) {
|
|
587
|
+
return Object.keys(n).reduce(function(o, l) {
|
|
588
|
+
return o.push(l + "=" + n[l]), o;
|
|
589
|
+
}, []).join(",");
|
|
590
|
+
}, a = function(n) {
|
|
591
|
+
var o = s(n);
|
|
592
|
+
return o.location = "no", n && n.prompt == "none" && (o.hidden = "yes"), i(o);
|
|
593
|
+
}, c = function() {
|
|
594
|
+
return e.redirectUri || "http://localhost";
|
|
595
|
+
};
|
|
596
|
+
return {
|
|
597
|
+
login: async function(n) {
|
|
598
|
+
var o = g(), l = a(n), f = await e.createLoginUrl(n), d = t(f, "_blank", l), m = !1, w = !1, S = function() {
|
|
599
|
+
w = !0, d.close();
|
|
600
|
+
};
|
|
601
|
+
return d.addEventListener("loadstart", function(y) {
|
|
602
|
+
if (y.url.indexOf(c()) == 0) {
|
|
603
|
+
var z = E(y.url);
|
|
604
|
+
T(z, o), S(), m = !0;
|
|
605
|
+
}
|
|
606
|
+
}), d.addEventListener("loaderror", function(y) {
|
|
607
|
+
if (!m)
|
|
608
|
+
if (y.url.indexOf(c()) == 0) {
|
|
609
|
+
var z = E(y.url);
|
|
610
|
+
T(z, o), S(), m = !0;
|
|
611
|
+
} else
|
|
612
|
+
o.setError(), S();
|
|
613
|
+
}), d.addEventListener("exit", function(y) {
|
|
614
|
+
w || o.setError({
|
|
615
|
+
reason: "closed_by_user"
|
|
616
|
+
});
|
|
617
|
+
}), o.promise;
|
|
618
|
+
},
|
|
619
|
+
logout: function(n) {
|
|
620
|
+
var o = g(), l = e.createLogoutUrl(n), f = t(l, "_blank", "location=no,hidden=yes,clearcache=yes"), d;
|
|
621
|
+
return f.addEventListener("loadstart", function(m) {
|
|
622
|
+
m.url.indexOf(c()) == 0 && f.close();
|
|
623
|
+
}), f.addEventListener("loaderror", function(m) {
|
|
624
|
+
m.url.indexOf(c()) == 0 || (d = !0), f.close();
|
|
625
|
+
}), f.addEventListener("exit", function(m) {
|
|
626
|
+
d ? o.setError() : (e.clearToken(), o.setSuccess());
|
|
627
|
+
}), o.promise;
|
|
628
|
+
},
|
|
629
|
+
register: async function(n) {
|
|
630
|
+
var o = g(), l = await e.createRegisterUrl(), f = a(n), d = t(l, "_blank", f);
|
|
631
|
+
return d.addEventListener("loadstart", function(m) {
|
|
632
|
+
if (m.url.indexOf(c()) == 0) {
|
|
633
|
+
d.close();
|
|
634
|
+
var w = E(m.url);
|
|
635
|
+
T(w, o);
|
|
636
|
+
}
|
|
637
|
+
}), o.promise;
|
|
638
|
+
},
|
|
639
|
+
accountManagement: function() {
|
|
640
|
+
var n = e.createAccountUrl();
|
|
641
|
+
if (typeof n < "u") {
|
|
642
|
+
var o = t(n, "_blank", "location=no");
|
|
643
|
+
o.addEventListener("loadstart", function(l) {
|
|
644
|
+
l.url.indexOf(c()) == 0 && o.close();
|
|
645
|
+
});
|
|
646
|
+
} else
|
|
647
|
+
throw "Not supported by the OIDC server";
|
|
648
|
+
},
|
|
649
|
+
redirectUri: function(n) {
|
|
650
|
+
return c();
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
if (r == "cordova-native")
|
|
655
|
+
return h.enable = !1, {
|
|
656
|
+
login: async function(n) {
|
|
657
|
+
var o = g(), l = await e.createLoginUrl(n);
|
|
658
|
+
return universalLinks.subscribe("keycloak", function(f) {
|
|
659
|
+
universalLinks.unsubscribe("keycloak"), window.cordova.plugins.browsertab.close();
|
|
660
|
+
var d = E(f.url);
|
|
661
|
+
T(d, o);
|
|
662
|
+
}), window.cordova.plugins.browsertab.openUrl(l), o.promise;
|
|
663
|
+
},
|
|
664
|
+
logout: function(n) {
|
|
665
|
+
var o = g(), l = e.createLogoutUrl(n);
|
|
666
|
+
return universalLinks.subscribe("keycloak", function(f) {
|
|
667
|
+
universalLinks.unsubscribe("keycloak"), window.cordova.plugins.browsertab.close(), e.clearToken(), o.setSuccess();
|
|
668
|
+
}), window.cordova.plugins.browsertab.openUrl(l), o.promise;
|
|
669
|
+
},
|
|
670
|
+
register: async function(n) {
|
|
671
|
+
var o = g(), l = await e.createRegisterUrl(n);
|
|
672
|
+
return universalLinks.subscribe("keycloak", function(f) {
|
|
673
|
+
universalLinks.unsubscribe("keycloak"), window.cordova.plugins.browsertab.close();
|
|
674
|
+
var d = E(f.url);
|
|
675
|
+
T(d, o);
|
|
676
|
+
}), window.cordova.plugins.browsertab.openUrl(l), o.promise;
|
|
677
|
+
},
|
|
678
|
+
accountManagement: function() {
|
|
679
|
+
var n = e.createAccountUrl();
|
|
680
|
+
if (typeof n < "u")
|
|
681
|
+
window.cordova.plugins.browsertab.openUrl(n);
|
|
682
|
+
else
|
|
683
|
+
throw "Not supported by the OIDC server";
|
|
684
|
+
},
|
|
685
|
+
redirectUri: function(n) {
|
|
686
|
+
return n && n.redirectUri ? n.redirectUri : e.redirectUri ? e.redirectUri : "http://localhost";
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
throw "invalid adapter type: " + r;
|
|
690
|
+
}
|
|
691
|
+
const A = "kc-callback-";
|
|
692
|
+
var D = function() {
|
|
693
|
+
if (!(this instanceof D))
|
|
694
|
+
return new D();
|
|
695
|
+
localStorage.setItem("kc-test", "test"), localStorage.removeItem("kc-test");
|
|
696
|
+
var r = this;
|
|
697
|
+
function t() {
|
|
698
|
+
const c = Date.now();
|
|
699
|
+
for (const [n, o] of i()) {
|
|
700
|
+
const l = a(o);
|
|
701
|
+
(l === null || l < c) && localStorage.removeItem(n);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
function s() {
|
|
705
|
+
for (const [c] of i())
|
|
706
|
+
localStorage.removeItem(c);
|
|
707
|
+
}
|
|
708
|
+
function i() {
|
|
709
|
+
return Object.entries(localStorage).filter(([c]) => c.startsWith(A));
|
|
710
|
+
}
|
|
711
|
+
function a(c) {
|
|
712
|
+
let n;
|
|
713
|
+
try {
|
|
714
|
+
n = JSON.parse(c);
|
|
715
|
+
} catch {
|
|
716
|
+
return null;
|
|
717
|
+
}
|
|
718
|
+
return O(n) && "expires" in n && typeof n.expires == "number" ? n.expires : null;
|
|
719
|
+
}
|
|
720
|
+
r.get = function(c) {
|
|
721
|
+
if (c) {
|
|
722
|
+
var n = A + c, o = localStorage.getItem(n);
|
|
723
|
+
return o && (localStorage.removeItem(n), o = JSON.parse(o)), t(), o;
|
|
724
|
+
}
|
|
725
|
+
}, r.add = function(c) {
|
|
726
|
+
t();
|
|
727
|
+
const n = A + c.state, o = JSON.stringify({
|
|
728
|
+
...c,
|
|
729
|
+
// Set the expiry time to 1 hour from now.
|
|
730
|
+
expires: Date.now() + 60 * 60 * 1e3
|
|
731
|
+
});
|
|
732
|
+
try {
|
|
733
|
+
localStorage.setItem(n, o);
|
|
734
|
+
} catch {
|
|
735
|
+
s(), localStorage.setItem(n, o);
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
}, j = function() {
|
|
739
|
+
if (!(this instanceof j))
|
|
740
|
+
return new j();
|
|
741
|
+
var r = this;
|
|
742
|
+
r.get = function(a) {
|
|
743
|
+
if (a) {
|
|
744
|
+
var c = s(A + a);
|
|
745
|
+
if (i(A + a, "", t(-100)), c)
|
|
746
|
+
return JSON.parse(c);
|
|
747
|
+
}
|
|
748
|
+
}, r.add = function(a) {
|
|
749
|
+
i(A + a.state, JSON.stringify(a), t(60));
|
|
750
|
+
}, r.removeItem = function(a) {
|
|
751
|
+
i(a, "", t(-100));
|
|
752
|
+
};
|
|
753
|
+
var t = function(a) {
|
|
754
|
+
var c = /* @__PURE__ */ new Date();
|
|
755
|
+
return c.setTime(c.getTime() + a * 60 * 1e3), c;
|
|
756
|
+
}, s = function(a) {
|
|
757
|
+
for (var c = a + "=", n = document.cookie.split(";"), o = 0; o < n.length; o++) {
|
|
758
|
+
for (var l = n[o]; l.charAt(0) == " "; )
|
|
759
|
+
l = l.substring(1);
|
|
760
|
+
if (l.indexOf(c) == 0)
|
|
761
|
+
return l.substring(c.length, l.length);
|
|
762
|
+
}
|
|
763
|
+
return "";
|
|
764
|
+
}, i = function(a, c, n) {
|
|
765
|
+
var o = a + "=" + c + "; expires=" + n.toUTCString() + "; ";
|
|
766
|
+
document.cookie = o;
|
|
767
|
+
};
|
|
768
|
+
};
|
|
769
|
+
function ie() {
|
|
770
|
+
try {
|
|
771
|
+
return new D();
|
|
772
|
+
} catch {
|
|
773
|
+
}
|
|
774
|
+
return new j();
|
|
775
|
+
}
|
|
776
|
+
function W(r) {
|
|
777
|
+
return function() {
|
|
778
|
+
e.enableLogging && r.apply(console, Array.prototype.slice.call(arguments));
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
function ce(u) {
|
|
783
|
+
const e = String.fromCodePoint(...u);
|
|
784
|
+
return btoa(e);
|
|
785
|
+
}
|
|
786
|
+
async function le(u) {
|
|
787
|
+
const p = new TextEncoder().encode(u);
|
|
788
|
+
if (typeof crypto > "u" || typeof crypto.subtle > "u")
|
|
789
|
+
throw new Error("Web Crypto API is not available.");
|
|
790
|
+
return await crypto.subtle.digest("SHA-256", p);
|
|
791
|
+
}
|
|
792
|
+
function V(u) {
|
|
793
|
+
const [e, p] = u.split(".");
|
|
794
|
+
if (typeof p != "string")
|
|
795
|
+
throw new Error("Unable to decode token, payload not found.");
|
|
796
|
+
let v;
|
|
797
|
+
try {
|
|
798
|
+
v = ue(p);
|
|
799
|
+
} catch (I) {
|
|
800
|
+
throw new Error("Unable to decode token, payload is not a valid Base64URL value.", { cause: I });
|
|
801
|
+
}
|
|
802
|
+
try {
|
|
803
|
+
return JSON.parse(v);
|
|
804
|
+
} catch (I) {
|
|
805
|
+
throw new Error("Unable to decode token, payload is not a valid JSON value.", { cause: I });
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
function ue(u) {
|
|
809
|
+
let e = u.replaceAll("-", "+").replaceAll("_", "/");
|
|
810
|
+
switch (e.length % 4) {
|
|
811
|
+
case 0:
|
|
812
|
+
break;
|
|
813
|
+
case 2:
|
|
814
|
+
e += "==";
|
|
815
|
+
break;
|
|
816
|
+
case 3:
|
|
817
|
+
e += "=";
|
|
818
|
+
break;
|
|
819
|
+
default:
|
|
820
|
+
throw new Error("Input is not of the correct length.");
|
|
821
|
+
}
|
|
822
|
+
try {
|
|
823
|
+
return de(e);
|
|
824
|
+
} catch {
|
|
825
|
+
return atob(e);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
function de(u) {
|
|
829
|
+
return decodeURIComponent(atob(u).replace(/(.)/g, (e, p) => {
|
|
830
|
+
let v = p.charCodeAt(0).toString(16).toUpperCase();
|
|
831
|
+
return v.length < 2 && (v = "0" + v), "%" + v;
|
|
832
|
+
}));
|
|
833
|
+
}
|
|
834
|
+
function O(u) {
|
|
835
|
+
return typeof u == "object" && u !== null;
|
|
836
|
+
}
|
|
837
|
+
let k = null, x = null;
|
|
838
|
+
function fe(u, e = !0) {
|
|
839
|
+
return x ? (console.log("Keycloak already initialized, returning from cache"), x) : (k || (k = new q({
|
|
840
|
+
url: u.url,
|
|
841
|
+
realm: u.realm,
|
|
842
|
+
clientId: u.clientId
|
|
843
|
+
})), x = k.init({
|
|
844
|
+
onLoad: e ? "check-sso" : "login-required",
|
|
845
|
+
checkLoginIframe: !1
|
|
846
|
+
//silentCheckSsoRedirectUri: `${window.location.origin}/silent-check-sso.html`, // Ensure this file is set up
|
|
847
|
+
}).then((p) => p).catch((p) => (console.error("Failed to initialize Keycloak:", p), !1)), x);
|
|
848
|
+
}
|
|
849
|
+
function he() {
|
|
850
|
+
return k != null && k.authenticated && (k != null && k.idTokenParsed) ? {
|
|
851
|
+
fullname: k.idTokenParsed.name,
|
|
852
|
+
email: k.idTokenParsed.email,
|
|
853
|
+
lastname: k.idTokenParsed.family_name,
|
|
854
|
+
firstname: k.idTokenParsed.given_name,
|
|
855
|
+
username: k.idTokenParsed.preferred_username,
|
|
856
|
+
background: "grey",
|
|
857
|
+
// Optional custom value
|
|
858
|
+
token: k.token,
|
|
859
|
+
sub: k.idTokenParsed.sub
|
|
860
|
+
} : {};
|
|
861
|
+
}
|
|
862
|
+
function pe() {
|
|
863
|
+
if (k)
|
|
864
|
+
k.login();
|
|
865
|
+
else
|
|
866
|
+
throw new Error("Keycloak is not initialized.");
|
|
867
|
+
}
|
|
868
|
+
function me() {
|
|
869
|
+
if (k)
|
|
870
|
+
k.logout();
|
|
871
|
+
else
|
|
872
|
+
throw new Error("Keycloak is not initialized.");
|
|
873
|
+
}
|
|
874
|
+
function ke() {
|
|
875
|
+
return !!(k != null && k.authenticated);
|
|
876
|
+
}
|
|
877
|
+
async function ge(u) {
|
|
878
|
+
try {
|
|
879
|
+
const e = await fetch(u, { method: "HEAD", mode: "no-cors" });
|
|
880
|
+
return e.ok || e.type === "opaque";
|
|
881
|
+
} catch {
|
|
882
|
+
return !1;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
const Ue = class {
|
|
886
|
+
constructor(u) {
|
|
887
|
+
X(this, u), this.keycloak = J(this, "keycloak", 7), this.auth = J(this, "auth", 7), this.handleLogin = async () => {
|
|
888
|
+
if (!this.authenticated)
|
|
889
|
+
try {
|
|
890
|
+
await pe();
|
|
891
|
+
} catch (e) {
|
|
892
|
+
R.show(e.message, "error");
|
|
893
|
+
}
|
|
894
|
+
}, this.handleLogout = async () => {
|
|
895
|
+
try {
|
|
896
|
+
await me();
|
|
897
|
+
} catch (e) {
|
|
898
|
+
R.show(e.message, "error");
|
|
899
|
+
}
|
|
900
|
+
this.authenticated = !1, this.user = null;
|
|
901
|
+
}, this.keycloakUrl = void 0, this.keycloakRealm = void 0, this.keycloakClientId = void 0, this.authenticated = !1, this.user = null, this.serverAvailable = !1;
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* Lifecycle method that runs when the component is about to load.
|
|
905
|
+
* It initializes authentication by calling the `initAuth` method.
|
|
906
|
+
*/
|
|
907
|
+
async componentWillLoad() {
|
|
908
|
+
if (!this.keycloakUrl || !this.keycloakRealm || !this.keycloakClientId) {
|
|
909
|
+
console.error("Keycloak configuration props are missing.");
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
if (this.serverAvailable = await ge(`${this.keycloakUrl}/realms/${this.keycloakRealm}`), !this.serverAvailable) {
|
|
913
|
+
R.show("Keycloak server is unavailable.", "error");
|
|
914
|
+
return;
|
|
915
|
+
}
|
|
916
|
+
await this.initAuth();
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Initializes the Keycloak authentication by configuring Keycloak with the provided props.
|
|
920
|
+
* Sets the `authenticated` state and `user` data if the user is authenticated.
|
|
921
|
+
* Emits `authStatusChanged` event with the authentication status.
|
|
922
|
+
*/
|
|
923
|
+
async initAuth() {
|
|
924
|
+
try {
|
|
925
|
+
const u = await fe({
|
|
926
|
+
url: this.keycloakUrl,
|
|
927
|
+
realm: this.keycloakRealm,
|
|
928
|
+
clientId: this.keycloakClientId
|
|
929
|
+
}, !0);
|
|
930
|
+
this.keycloak.emit({
|
|
931
|
+
init: u
|
|
932
|
+
}), ke() && (this.user = he(), this.authenticated = !0, this.auth.emit({
|
|
933
|
+
authenticated: this.authenticated,
|
|
934
|
+
user: this.user
|
|
935
|
+
}));
|
|
936
|
+
} catch (u) {
|
|
937
|
+
R.show(u.message, "error");
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
render() {
|
|
941
|
+
return U("div", { key: "041846174aaad541acce03588a087793d10daa1e", class: "block" }, !this.authenticated && U("eds-button", { key: "360a84ec79a15c9293e3898b77df649c469d9529", label: "Login", intent: "primary", "extra-class": "text-default", "aria-label": "Login", triggerClick: this.handleLogin.bind(this) }));
|
|
942
|
+
}
|
|
943
|
+
}, ve = ".splash-overlay{position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:9999999;background-color:var(--grey-200);display:flex;flex-direction:column;align-items:center;justify-content:center}.logo-container{width:200px;height:200px;margin-bottom:1rem}.content-container{position:relative;width:5rem;height:5rem;display:flex;align-items:center;justify-content:center}", we = ve, ye = class {
|
|
944
|
+
constructor(u) {
|
|
945
|
+
X(this, u), this.splash = J(this, "splash", 7), this.inverse = !1, this.initPromise = void 0, this.isVisible = !0;
|
|
946
|
+
}
|
|
947
|
+
// When the component loads, check if there is a promise.
|
|
948
|
+
componentWillLoad() {
|
|
949
|
+
this.initPromise && this.handleInitPromise(this.initPromise);
|
|
950
|
+
}
|
|
951
|
+
// Watch for changes on initPromise.
|
|
952
|
+
async watchInitPromise(u) {
|
|
953
|
+
u && this.handleInitPromise(u);
|
|
954
|
+
}
|
|
955
|
+
async handleInitPromise(u) {
|
|
956
|
+
try {
|
|
957
|
+
await u, this.hideSplash();
|
|
958
|
+
} catch (e) {
|
|
959
|
+
this.splash.emit({ type: "error", message: e.message || "Unknown error" });
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
handleHideSplash() {
|
|
963
|
+
this.hideSplash();
|
|
964
|
+
}
|
|
965
|
+
hideSplash() {
|
|
966
|
+
this.isVisible = !1, this.splash.emit({ type: "hidden", message: "Splash screen hidden successfully" });
|
|
967
|
+
}
|
|
968
|
+
render() {
|
|
969
|
+
return this.isVisible ? U(se, null, U("div", { class: "splash-overlay", style: { background: this.inverse ? "black" : "var(--grey-200)" } }, U("div", { class: "logo-container" }, this.inverse ? U("eds-logo", { orientation: "vertical", type: "color-white" }) : U("eds-logo", { orientation: "vertical", type: "color" })), U("div", { class: "content-container" }, U("eds-spinner", { size: "1rem", thickness: "3px", "border-color": "var(--grey-400)", "bottom-color": "var(--grey-900)", background: "none", fullscreen: !1 })))) : null;
|
|
970
|
+
}
|
|
971
|
+
static get watchers() {
|
|
972
|
+
return {
|
|
973
|
+
initPromise: ["watchInitPromise"]
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
};
|
|
977
|
+
ye.style = we;
|
|
978
|
+
export {
|
|
979
|
+
Ue as eds_login,
|
|
980
|
+
ye as eds_splash_screen
|
|
981
|
+
};
|