@ebrains/react 0.4.0-alpha.0 → 0.6.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/analytics-44b1416b.esm.js +55 -0
- package/color-2554aad6.esm.js +122 -0
- package/color-primary-palette_6.entry.esm.js +106 -106
- package/correct-use-of-colors.entry.esm.js +33 -33
- package/eds-accordion_13.entry.esm.js +1064 -0
- package/eds-alert.entry.esm.js +104 -0
- package/eds-block-break.entry.esm.js +22 -0
- package/eds-breadcrumb.entry.esm.js +182 -0
- package/eds-card-project.entry.esm.js +12 -11
- package/eds-card-tags.entry.esm.js +1 -1
- package/eds-card-tool.entry.esm.js +5 -6
- package/eds-card-wrapper.entry.esm.js +4 -4
- package/eds-code-block.entry.esm.js +8 -8
- package/eds-components-section.entry.esm.js +14 -2
- package/eds-cookies-preference.entry.esm.js +47 -0
- package/eds-docs-palettes.entry.esm.js +1 -1
- package/eds-docs-tokens.entry.esm.js +1 -1
- package/eds-dropdown_2.entry.esm.js +235 -0
- package/eds-footer.entry.esm.js +102 -0
- package/eds-form.entry.esm.js +410 -0
- package/eds-frame.entry.esm.js +117 -0
- package/eds-fullscreen-menu.entry.esm.js +143 -0
- package/eds-header.entry.esm.js +130 -0
- package/eds-icon-arrow-diagonal.entry.esm.js +1 -1
- package/eds-icon-arrow-right.entry.esm.js +1 -1
- package/eds-icon-bluesky.entry.esm.js +1 -1
- package/eds-icon-chevron-down.entry.esm.js +1 -1
- package/eds-icon-chevron-left.entry.esm.js +1 -1
- package/eds-icon-chevron-right.entry.esm.js +1 -1
- package/eds-icon-chevron-up.entry.esm.js +1 -1
- package/eds-icon-close.entry.esm.js +1 -1
- package/eds-icon-copy.entry.esm.js +1 -1
- package/eds-icon-eu.entry.esm.js +1 -1
- package/eds-icon-facebook.entry.esm.js +1 -1
- package/eds-icon-gitlab.entry.esm.js +1 -1
- package/eds-icon-linkedin.entry.esm.js +1 -1
- package/eds-icon-loader.entry.esm.js +1 -1
- package/eds-icon-mastodon.entry.esm.js +1 -1
- package/eds-icon-menu.entry.esm.js +1 -1
- package/eds-icon-more.entry.esm.js +1 -1
- package/eds-icon-search.entry.esm.js +1 -1
- package/eds-icon-success.entry.esm.js +1 -1
- package/eds-icon-twitter.entry.esm.js +1 -1
- package/eds-icon-user.entry.esm.js +1 -1
- package/eds-icon-youtube.entry.esm.js +1 -1
- package/eds-input_7.entry.esm.js +529 -0
- package/eds-link.entry.esm.js +204 -0
- package/eds-login.entry.esm.js +66 -45
- package/eds-logo-variations.entry.esm.js +1 -1
- package/eds-logo.entry.esm.js +87 -0
- package/eds-modal.entry.esm.js +129 -0
- package/eds-navigator.entry.esm.js +5 -5
- package/eds-pagination_2.entry.esm.js +15 -16
- package/eds-progress-bar.entry.esm.js +7 -2
- package/eds-rating.entry.esm.js +28 -18
- package/eds-section-core_2.entry.esm.js +5 -5
- package/eds-social-networks.entry.esm.js +74 -0
- package/eds-steps.entry.esm.js +98 -0
- package/eds-svg-repository.entry.esm.js +1 -1
- package/eds-switch.entry.esm.js +58 -0
- package/eds-tab.entry.esm.js +1 -1
- package/eds-tabs-content.entry.esm.js +5 -5
- package/eds-tabs.entry.esm.js +4 -4
- package/eds-timeline.entry.esm.js +4 -4
- package/eds-tooltip.entry.esm.js +4 -5
- package/eds-trl.entry.esm.js +2 -2
- package/eds-user.entry.esm.js +118 -0
- package/eds-vertical-stepper.entry.esm.js +81 -0
- package/incorrect-use-of-colors.entry.esm.js +7 -7
- package/index.esm.js +1 -1
- package/index.esm2.js +63 -9
- package/{keycloak-13893af6.esm.js → keycloak-d502ec16.esm.js} +219 -168
- package/logo-space.entry.esm.js +4 -4
- package/logo-variations-horizontal_2.entry.esm.js +26 -26
- package/logo-wrong-usage.entry.esm.js +37 -37
- package/package.json +1 -1
- package/src/components.d.ts +3 -0
- package/token-list_3.entry.esm.js +5 -5
- package/token-ratios.entry.esm.js +3 -3
- package/token-spacing.entry.esm.js +26 -26
- package/token-typography.entry.esm.js +2 -2
- package/color-bb472c37.esm.js +0 -423
- package/eds-accordion_33.entry.esm.js +0 -369
- package/eds-card-section.entry.esm.js +0 -70
- package/eds-matomo-notice.entry.esm.js +0 -129
|
@@ -45,7 +45,7 @@ function Keycloak(config) {
|
|
|
45
45
|
if (!globalThis.isSecureContext) {
|
|
46
46
|
logWarn("[KEYCLOAK] Keycloak JS must be used in a 'secure context' to function properly as it relies on browser APIs that are otherwise not available.\n" + "Continuing to run your application insecurely will lead to unexpected behavior and breakage.\n\n" + "For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts");
|
|
47
47
|
}
|
|
48
|
-
kc.init = function (initOptions) {
|
|
48
|
+
kc.init = function (initOptions = {}) {
|
|
49
49
|
if (kc.didInitialize) {
|
|
50
50
|
throw new Error("A 'Keycloak' instance can only be initialized once.");
|
|
51
51
|
}
|
|
@@ -53,9 +53,9 @@ function Keycloak(config) {
|
|
|
53
53
|
kc.authenticated = false;
|
|
54
54
|
callbackStorage = createCallbackStorage();
|
|
55
55
|
var adapters = ['default', 'cordova', 'cordova-native'];
|
|
56
|
-
if (
|
|
56
|
+
if (adapters.indexOf(initOptions.adapter) > -1) {
|
|
57
57
|
adapter = loadAdapter(initOptions.adapter);
|
|
58
|
-
} else if (
|
|
58
|
+
} else if (typeof initOptions.adapter === "object") {
|
|
59
59
|
adapter = initOptions.adapter;
|
|
60
60
|
} else {
|
|
61
61
|
if (window.Cordova || window.cordova) {
|
|
@@ -64,85 +64,83 @@ function Keycloak(config) {
|
|
|
64
64
|
adapter = loadAdapter();
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
if (initOptions) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (initOptions.responseMode) {
|
|
81
|
-
|
|
82
|
-
kc.responseMode = initOptions.responseMode;
|
|
83
|
-
} else {
|
|
84
|
-
throw 'Invalid value for responseMode';
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (initOptions.flow) {
|
|
88
|
-
switch (initOptions.flow) {
|
|
89
|
-
case 'standard':
|
|
90
|
-
kc.responseType = 'code';
|
|
91
|
-
break;
|
|
92
|
-
case 'implicit':
|
|
93
|
-
kc.responseType = 'id_token token';
|
|
94
|
-
break;
|
|
95
|
-
case 'hybrid':
|
|
96
|
-
kc.responseType = 'code id_token token';
|
|
97
|
-
break;
|
|
98
|
-
default:
|
|
99
|
-
throw 'Invalid value for flow';
|
|
100
|
-
}
|
|
101
|
-
kc.flow = initOptions.flow;
|
|
102
|
-
}
|
|
103
|
-
if (initOptions.timeSkew != null) {
|
|
104
|
-
kc.timeSkew = initOptions.timeSkew;
|
|
105
|
-
}
|
|
106
|
-
if (initOptions.redirectUri) {
|
|
107
|
-
kc.redirectUri = initOptions.redirectUri;
|
|
108
|
-
}
|
|
109
|
-
if (initOptions.silentCheckSsoRedirectUri) {
|
|
110
|
-
kc.silentCheckSsoRedirectUri = initOptions.silentCheckSsoRedirectUri;
|
|
111
|
-
}
|
|
112
|
-
if (typeof initOptions.silentCheckSsoFallback === 'boolean') {
|
|
113
|
-
kc.silentCheckSsoFallback = initOptions.silentCheckSsoFallback;
|
|
114
|
-
} else {
|
|
115
|
-
kc.silentCheckSsoFallback = true;
|
|
116
|
-
}
|
|
117
|
-
if (typeof initOptions.pkceMethod !== "undefined") {
|
|
118
|
-
if (initOptions.pkceMethod !== "S256" && initOptions.pkceMethod !== false) {
|
|
119
|
-
throw new TypeError(`Invalid value for pkceMethod', expected 'S256' or false but got ${initOptions.pkceMethod}.`);
|
|
120
|
-
}
|
|
121
|
-
kc.pkceMethod = initOptions.pkceMethod;
|
|
122
|
-
} else {
|
|
123
|
-
kc.pkceMethod = "S256";
|
|
124
|
-
}
|
|
125
|
-
if (typeof initOptions.enableLogging === 'boolean') {
|
|
126
|
-
kc.enableLogging = initOptions.enableLogging;
|
|
127
|
-
} else {
|
|
128
|
-
kc.enableLogging = false;
|
|
129
|
-
}
|
|
130
|
-
if (initOptions.logoutMethod === 'POST') {
|
|
131
|
-
kc.logoutMethod = 'POST';
|
|
67
|
+
if (typeof initOptions.useNonce !== 'undefined') {
|
|
68
|
+
useNonce = initOptions.useNonce;
|
|
69
|
+
}
|
|
70
|
+
if (typeof initOptions.checkLoginIframe !== 'undefined') {
|
|
71
|
+
loginIframe.enable = initOptions.checkLoginIframe;
|
|
72
|
+
}
|
|
73
|
+
if (initOptions.checkLoginIframeInterval) {
|
|
74
|
+
loginIframe.interval = initOptions.checkLoginIframeInterval;
|
|
75
|
+
}
|
|
76
|
+
if (initOptions.onLoad === 'login-required') {
|
|
77
|
+
kc.loginRequired = true;
|
|
78
|
+
}
|
|
79
|
+
if (initOptions.responseMode) {
|
|
80
|
+
if (initOptions.responseMode === 'query' || initOptions.responseMode === 'fragment') {
|
|
81
|
+
kc.responseMode = initOptions.responseMode;
|
|
132
82
|
} else {
|
|
133
|
-
|
|
83
|
+
throw 'Invalid value for responseMode';
|
|
134
84
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
85
|
+
}
|
|
86
|
+
if (initOptions.flow) {
|
|
87
|
+
switch (initOptions.flow) {
|
|
88
|
+
case 'standard':
|
|
89
|
+
kc.responseType = 'code';
|
|
90
|
+
break;
|
|
91
|
+
case 'implicit':
|
|
92
|
+
kc.responseType = 'id_token token';
|
|
93
|
+
break;
|
|
94
|
+
case 'hybrid':
|
|
95
|
+
kc.responseType = 'code id_token token';
|
|
96
|
+
break;
|
|
97
|
+
default:
|
|
98
|
+
throw 'Invalid value for flow';
|
|
140
99
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
100
|
+
kc.flow = initOptions.flow;
|
|
101
|
+
}
|
|
102
|
+
if (initOptions.timeSkew != null) {
|
|
103
|
+
kc.timeSkew = initOptions.timeSkew;
|
|
104
|
+
}
|
|
105
|
+
if (initOptions.redirectUri) {
|
|
106
|
+
kc.redirectUri = initOptions.redirectUri;
|
|
107
|
+
}
|
|
108
|
+
if (initOptions.silentCheckSsoRedirectUri) {
|
|
109
|
+
kc.silentCheckSsoRedirectUri = initOptions.silentCheckSsoRedirectUri;
|
|
110
|
+
}
|
|
111
|
+
if (typeof initOptions.silentCheckSsoFallback === 'boolean') {
|
|
112
|
+
kc.silentCheckSsoFallback = initOptions.silentCheckSsoFallback;
|
|
113
|
+
} else {
|
|
114
|
+
kc.silentCheckSsoFallback = true;
|
|
115
|
+
}
|
|
116
|
+
if (typeof initOptions.pkceMethod !== "undefined") {
|
|
117
|
+
if (initOptions.pkceMethod !== "S256" && initOptions.pkceMethod !== false) {
|
|
118
|
+
throw new TypeError(`Invalid value for pkceMethod', expected 'S256' or false but got ${initOptions.pkceMethod}.`);
|
|
145
119
|
}
|
|
120
|
+
kc.pkceMethod = initOptions.pkceMethod;
|
|
121
|
+
} else {
|
|
122
|
+
kc.pkceMethod = "S256";
|
|
123
|
+
}
|
|
124
|
+
if (typeof initOptions.enableLogging === 'boolean') {
|
|
125
|
+
kc.enableLogging = initOptions.enableLogging;
|
|
126
|
+
} else {
|
|
127
|
+
kc.enableLogging = false;
|
|
128
|
+
}
|
|
129
|
+
if (initOptions.logoutMethod === 'POST') {
|
|
130
|
+
kc.logoutMethod = 'POST';
|
|
131
|
+
} else {
|
|
132
|
+
kc.logoutMethod = 'GET';
|
|
133
|
+
}
|
|
134
|
+
if (typeof initOptions.scope === 'string') {
|
|
135
|
+
kc.scope = initOptions.scope;
|
|
136
|
+
}
|
|
137
|
+
if (typeof initOptions.acrValues === 'string') {
|
|
138
|
+
kc.acrValues = initOptions.acrValues;
|
|
139
|
+
}
|
|
140
|
+
if (typeof initOptions.messageReceiveTimeout === 'number' && initOptions.messageReceiveTimeout > 0) {
|
|
141
|
+
kc.messageReceiveTimeout = initOptions.messageReceiveTimeout;
|
|
142
|
+
} else {
|
|
143
|
+
kc.messageReceiveTimeout = 10000;
|
|
146
144
|
}
|
|
147
145
|
if (!kc.responseMode) {
|
|
148
146
|
kc.responseMode = 'fragment';
|
|
@@ -165,7 +163,7 @@ function Keycloak(config) {
|
|
|
165
163
|
if (!prompt) {
|
|
166
164
|
options.prompt = 'none';
|
|
167
165
|
}
|
|
168
|
-
if (initOptions
|
|
166
|
+
if (initOptions.locale) {
|
|
169
167
|
options.locale = initOptions.locale;
|
|
170
168
|
}
|
|
171
169
|
kc.login(options).then(function () {
|
|
@@ -233,41 +231,38 @@ function Keycloak(config) {
|
|
|
233
231
|
}).catch(function (error) {
|
|
234
232
|
initPromise.setError(error);
|
|
235
233
|
});
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
} else {
|
|
247
|
-
initPromise.setSuccess();
|
|
248
|
-
}
|
|
249
|
-
}).catch(function (error) {
|
|
250
|
-
initPromise.setError(error);
|
|
251
|
-
});
|
|
252
|
-
});
|
|
253
|
-
} else {
|
|
254
|
-
kc.updateToken(-1).then(function () {
|
|
255
|
-
kc.onAuthSuccess && kc.onAuthSuccess();
|
|
256
|
-
initPromise.setSuccess();
|
|
257
|
-
}).catch(function (error) {
|
|
258
|
-
kc.onAuthError && kc.onAuthError();
|
|
259
|
-
if (initOptions.onLoad) {
|
|
260
|
-
onLoad();
|
|
234
|
+
}
|
|
235
|
+
if (initOptions.token && initOptions.refreshToken) {
|
|
236
|
+
setToken(initOptions.token, initOptions.refreshToken, initOptions.idToken);
|
|
237
|
+
if (loginIframe.enable) {
|
|
238
|
+
setupCheckLoginIframe().then(function () {
|
|
239
|
+
checkLoginIframe().then(function (unchanged) {
|
|
240
|
+
if (unchanged) {
|
|
241
|
+
kc.onAuthSuccess && kc.onAuthSuccess();
|
|
242
|
+
initPromise.setSuccess();
|
|
243
|
+
scheduleCheckIframe();
|
|
261
244
|
} else {
|
|
262
|
-
initPromise.
|
|
245
|
+
initPromise.setSuccess();
|
|
263
246
|
}
|
|
247
|
+
}).catch(function (error) {
|
|
248
|
+
initPromise.setError(error);
|
|
264
249
|
});
|
|
265
|
-
}
|
|
266
|
-
} else if (initOptions.onLoad) {
|
|
267
|
-
onLoad();
|
|
250
|
+
});
|
|
268
251
|
} else {
|
|
269
|
-
|
|
252
|
+
kc.updateToken(-1).then(function () {
|
|
253
|
+
kc.onAuthSuccess && kc.onAuthSuccess();
|
|
254
|
+
initPromise.setSuccess();
|
|
255
|
+
}).catch(function (error) {
|
|
256
|
+
kc.onAuthError && kc.onAuthError();
|
|
257
|
+
if (initOptions.onLoad) {
|
|
258
|
+
onLoad();
|
|
259
|
+
} else {
|
|
260
|
+
initPromise.setError(error);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
270
263
|
}
|
|
264
|
+
} else if (initOptions.onLoad) {
|
|
265
|
+
onLoad();
|
|
271
266
|
} else {
|
|
272
267
|
initPromise.setSuccess();
|
|
273
268
|
}
|
|
@@ -542,7 +537,7 @@ function Keycloak(config) {
|
|
|
542
537
|
}
|
|
543
538
|
kc.onAuthRefreshError && kc.onAuthRefreshError();
|
|
544
539
|
for (var p = refreshQueue.pop(); p != null; p = refreshQueue.pop()) {
|
|
545
|
-
p.setError(
|
|
540
|
+
p.setError("Failed to refresh token: An unexpected HTTP error occurred while attempting to refresh the token.");
|
|
546
541
|
}
|
|
547
542
|
}
|
|
548
543
|
}
|
|
@@ -1036,7 +1031,7 @@ function Keycloak(config) {
|
|
|
1036
1031
|
}
|
|
1037
1032
|
function check3pCookiesSupported() {
|
|
1038
1033
|
var promise = createPromise();
|
|
1039
|
-
if (loginIframe.enable || kc.silentCheckSsoRedirectUri) {
|
|
1034
|
+
if ((loginIframe.enable || kc.silentCheckSsoRedirectUri) && typeof kc.endpoints.thirdPartyCookiesIframe === 'function') {
|
|
1040
1035
|
var iframe = document.createElement('iframe');
|
|
1041
1036
|
iframe.setAttribute('src', kc.endpoints.thirdPartyCookiesIframe());
|
|
1042
1037
|
iframe.setAttribute('sandbox', 'allow-storage-access-by-user-activation allow-scripts allow-same-origin');
|
|
@@ -1050,7 +1045,7 @@ function Keycloak(config) {
|
|
|
1050
1045
|
if (event.data !== "supported" && event.data !== "unsupported") {
|
|
1051
1046
|
return;
|
|
1052
1047
|
} else if (event.data === "unsupported") {
|
|
1053
|
-
logWarn("[KEYCLOAK] Your browser is blocking access to 3rd-party cookies, this means:\n\n" + " - It is not possible to retrieve tokens without redirecting to the Keycloak server (a.k.a. no support for silent authentication).\n" + " - It is not possible to automatically detect changes to the session status (such as the user logging out in another tab).\n\n" + "For more information see: https://www.keycloak.org/
|
|
1048
|
+
logWarn("[KEYCLOAK] Your browser is blocking access to 3rd-party cookies, this means:\n\n" + " - It is not possible to retrieve tokens without redirecting to the Keycloak server (a.k.a. no support for silent authentication).\n" + " - It is not possible to automatically detect changes to the session status (such as the user logging out in another tab).\n\n" + "For more information see: https://www.keycloak.org/securing-apps/javascript-adapter#_modern_browsers");
|
|
1054
1049
|
loginIframe.enable = false;
|
|
1055
1050
|
if (kc.silentCheckSsoFallback) {
|
|
1056
1051
|
kc.silentCheckSsoRedirectUri = false;
|
|
@@ -1079,30 +1074,33 @@ function Keycloak(config) {
|
|
|
1079
1074
|
window.location.replace(kc.createLogoutUrl(options));
|
|
1080
1075
|
return;
|
|
1081
1076
|
}
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1077
|
+
|
|
1078
|
+
// Create form to send POST request.
|
|
1079
|
+
const form = document.createElement("form");
|
|
1080
|
+
form.setAttribute("method", "POST");
|
|
1081
|
+
form.setAttribute("action", kc.createLogoutUrl(options));
|
|
1082
|
+
form.style.display = "none";
|
|
1083
|
+
|
|
1084
|
+
// Add data to form as hidden input fields.
|
|
1085
|
+
const data = {
|
|
1086
|
+
id_token_hint: kc.idToken,
|
|
1087
|
+
client_id: kc.clientId,
|
|
1088
|
+
post_logout_redirect_uri: adapter.redirectUri(options, false)
|
|
1089
|
+
};
|
|
1090
|
+
for (const [name, value] of Object.entries(data)) {
|
|
1091
|
+
const input = document.createElement("input");
|
|
1092
|
+
input.setAttribute("type", "hidden");
|
|
1093
|
+
input.setAttribute("name", name);
|
|
1094
|
+
input.setAttribute("value", value);
|
|
1095
|
+
form.appendChild(input);
|
|
1101
1096
|
}
|
|
1102
|
-
|
|
1097
|
+
|
|
1098
|
+
// Append form to page and submit it to perform logout and redirect.
|
|
1099
|
+
document.body.appendChild(form);
|
|
1100
|
+
form.submit();
|
|
1103
1101
|
},
|
|
1104
|
-
register: function (options) {
|
|
1105
|
-
window.location.assign(kc.createRegisterUrl(options));
|
|
1102
|
+
register: async function (options) {
|
|
1103
|
+
window.location.assign(await kc.createRegisterUrl(options));
|
|
1106
1104
|
return createPromise().promise;
|
|
1107
1105
|
},
|
|
1108
1106
|
accountManagement: function () {
|
|
@@ -1232,9 +1230,9 @@ function Keycloak(config) {
|
|
|
1232
1230
|
});
|
|
1233
1231
|
return promise.promise;
|
|
1234
1232
|
},
|
|
1235
|
-
register: function (options) {
|
|
1233
|
+
register: async function (options) {
|
|
1236
1234
|
var promise = createPromise();
|
|
1237
|
-
var registerUrl = kc.createRegisterUrl();
|
|
1235
|
+
var registerUrl = await kc.createRegisterUrl();
|
|
1238
1236
|
var cordovaOptions = createCordovaOptions(options);
|
|
1239
1237
|
var ref = cordovaOpenWindowWrapper(registerUrl, '_blank', cordovaOptions);
|
|
1240
1238
|
ref.addEventListener('loadstart', function (event) {
|
|
@@ -1291,9 +1289,9 @@ function Keycloak(config) {
|
|
|
1291
1289
|
window.cordova.plugins.browsertab.openUrl(logoutUrl);
|
|
1292
1290
|
return promise.promise;
|
|
1293
1291
|
},
|
|
1294
|
-
register: function (options) {
|
|
1292
|
+
register: async function (options) {
|
|
1295
1293
|
var promise = createPromise();
|
|
1296
|
-
var registerUrl = kc.createRegisterUrl(options);
|
|
1294
|
+
var registerUrl = await kc.createRegisterUrl(options);
|
|
1297
1295
|
universalLinks.subscribe('keycloak', function (event) {
|
|
1298
1296
|
universalLinks.unsubscribe('keycloak');
|
|
1299
1297
|
window.cordova.plugins.browsertab.close();
|
|
@@ -1324,6 +1322,7 @@ function Keycloak(config) {
|
|
|
1324
1322
|
}
|
|
1325
1323
|
throw 'invalid adapter type: ' + type;
|
|
1326
1324
|
}
|
|
1325
|
+
const STORAGE_KEY_PREFIX = 'kc-callback-';
|
|
1327
1326
|
var LocalStorage = function () {
|
|
1328
1327
|
if (!(this instanceof LocalStorage)) {
|
|
1329
1328
|
return new LocalStorage();
|
|
@@ -1331,43 +1330,89 @@ function Keycloak(config) {
|
|
|
1331
1330
|
localStorage.setItem('kc-test', 'test');
|
|
1332
1331
|
localStorage.removeItem('kc-test');
|
|
1333
1332
|
var cs = this;
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
localStorage.removeItem(key);
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1333
|
+
|
|
1334
|
+
/**
|
|
1335
|
+
* Clears all values from local storage that are no longer valid.
|
|
1336
|
+
*/
|
|
1337
|
+
function clearInvalidValues() {
|
|
1338
|
+
const currentTime = Date.now();
|
|
1339
|
+
for (const [key, value] of getStoredEntries()) {
|
|
1340
|
+
// Attempt to parse the expiry time from the value.
|
|
1341
|
+
const expiry = parseExpiry(value);
|
|
1342
|
+
|
|
1343
|
+
// Discard the value if it is malformed or expired.
|
|
1344
|
+
if (expiry === null || expiry < currentTime) {
|
|
1345
|
+
localStorage.removeItem(key);
|
|
1350
1346
|
}
|
|
1351
1347
|
}
|
|
1352
1348
|
}
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* Clears all known values from local storage.
|
|
1352
|
+
*/
|
|
1353
|
+
function clearAllValues() {
|
|
1354
|
+
for (const [key] of getStoredEntries()) {
|
|
1355
|
+
localStorage.removeItem(key);
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
/**
|
|
1360
|
+
* Gets all entries stored in local storage that are known to be managed by this class.
|
|
1361
|
+
* @returns {Array<[string, unknown]>} An array of key-value pairs.
|
|
1362
|
+
*/
|
|
1363
|
+
function getStoredEntries() {
|
|
1364
|
+
return Object.entries(localStorage).filter(([key]) => key.startsWith(STORAGE_KEY_PREFIX));
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
/**
|
|
1368
|
+
* Parses the expiry time from a value stored in local storage.
|
|
1369
|
+
* @param {unknown} value
|
|
1370
|
+
* @returns {number | null} The expiry time in milliseconds, or `null` if the value is malformed.
|
|
1371
|
+
*/
|
|
1372
|
+
function parseExpiry(value) {
|
|
1373
|
+
let parsedValue;
|
|
1374
|
+
|
|
1375
|
+
// Attempt to parse the value as JSON.
|
|
1376
|
+
try {
|
|
1377
|
+
parsedValue = JSON.parse(value);
|
|
1378
|
+
} catch (error) {
|
|
1379
|
+
return null;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
// Attempt to extract the 'expires' property.
|
|
1383
|
+
if (isObject(parsedValue) && 'expires' in parsedValue && typeof parsedValue.expires === 'number') {
|
|
1384
|
+
return parsedValue.expires;
|
|
1385
|
+
}
|
|
1386
|
+
return null;
|
|
1387
|
+
}
|
|
1353
1388
|
cs.get = function (state) {
|
|
1354
1389
|
if (!state) {
|
|
1355
1390
|
return;
|
|
1356
1391
|
}
|
|
1357
|
-
var key =
|
|
1392
|
+
var key = STORAGE_KEY_PREFIX + state;
|
|
1358
1393
|
var value = localStorage.getItem(key);
|
|
1359
1394
|
if (value) {
|
|
1360
1395
|
localStorage.removeItem(key);
|
|
1361
1396
|
value = JSON.parse(value);
|
|
1362
1397
|
}
|
|
1363
|
-
|
|
1398
|
+
clearInvalidValues();
|
|
1364
1399
|
return value;
|
|
1365
1400
|
};
|
|
1366
1401
|
cs.add = function (state) {
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1402
|
+
clearInvalidValues();
|
|
1403
|
+
const key = STORAGE_KEY_PREFIX + state.state;
|
|
1404
|
+
const value = JSON.stringify({
|
|
1405
|
+
...state,
|
|
1406
|
+
// Set the expiry time to 1 hour from now.
|
|
1407
|
+
expires: Date.now() + 60 * 60 * 1000
|
|
1408
|
+
});
|
|
1409
|
+
try {
|
|
1410
|
+
localStorage.setItem(key, value);
|
|
1411
|
+
} catch (error) {
|
|
1412
|
+
// If the storage is full, clear all known values and try again.
|
|
1413
|
+
clearAllValues();
|
|
1414
|
+
localStorage.setItem(key, value);
|
|
1415
|
+
}
|
|
1371
1416
|
};
|
|
1372
1417
|
};
|
|
1373
1418
|
var CookieStorage = function () {
|
|
@@ -1379,14 +1424,14 @@ function Keycloak(config) {
|
|
|
1379
1424
|
if (!state) {
|
|
1380
1425
|
return;
|
|
1381
1426
|
}
|
|
1382
|
-
var value = getCookie(
|
|
1383
|
-
setCookie(
|
|
1427
|
+
var value = getCookie(STORAGE_KEY_PREFIX + state);
|
|
1428
|
+
setCookie(STORAGE_KEY_PREFIX + state, '', cookieExpiration(-100));
|
|
1384
1429
|
if (value) {
|
|
1385
1430
|
return JSON.parse(value);
|
|
1386
1431
|
}
|
|
1387
1432
|
};
|
|
1388
1433
|
cs.add = function (state) {
|
|
1389
|
-
setCookie(
|
|
1434
|
+
setCookie(STORAGE_KEY_PREFIX + state.state, JSON.stringify(state), cookieExpiration(60));
|
|
1390
1435
|
};
|
|
1391
1436
|
cs.removeItem = function (key) {
|
|
1392
1437
|
setCookie(key, '', cookieExpiration(-100));
|
|
@@ -1522,8 +1567,15 @@ function isObject(input) {
|
|
|
1522
1567
|
return typeof input === 'object' && input !== null;
|
|
1523
1568
|
}
|
|
1524
1569
|
let keycloak = null;
|
|
1570
|
+
let keycloakInitPromise = null;
|
|
1525
1571
|
// Initialize Keycloak with an optional silent check
|
|
1526
1572
|
function initKeycloak(config, silentCheck = true) {
|
|
1573
|
+
// If already initializing or initialized, return the cached promise
|
|
1574
|
+
if (keycloakInitPromise) {
|
|
1575
|
+
// eslint-disable-next-line
|
|
1576
|
+
console.log('Keycloak already initialized, returning from cache');
|
|
1577
|
+
return keycloakInitPromise;
|
|
1578
|
+
}
|
|
1527
1579
|
if (!keycloak) {
|
|
1528
1580
|
keycloak = new Keycloak({
|
|
1529
1581
|
url: config.url,
|
|
@@ -1531,7 +1583,7 @@ function initKeycloak(config, silentCheck = true) {
|
|
|
1531
1583
|
clientId: config.clientId
|
|
1532
1584
|
});
|
|
1533
1585
|
}
|
|
1534
|
-
|
|
1586
|
+
keycloakInitPromise = keycloak.init({
|
|
1535
1587
|
onLoad: silentCheck ? 'check-sso' : 'login-required',
|
|
1536
1588
|
checkLoginIframe: false
|
|
1537
1589
|
//silentCheckSsoRedirectUri: `${window.location.origin}/silent-check-sso.html`, // Ensure this file is set up
|
|
@@ -1540,6 +1592,7 @@ function initKeycloak(config, silentCheck = true) {
|
|
|
1540
1592
|
console.error('Failed to initialize Keycloak:', error);
|
|
1541
1593
|
return false;
|
|
1542
1594
|
});
|
|
1595
|
+
return keycloakInitPromise;
|
|
1543
1596
|
}
|
|
1544
1597
|
function getUser() {
|
|
1545
1598
|
if ((keycloak === null || keycloak === void 0 ? void 0 : keycloak.authenticated) && (keycloak === null || keycloak === void 0 ? void 0 : keycloak.idTokenParsed)) {
|
|
@@ -1562,8 +1615,7 @@ function login() {
|
|
|
1562
1615
|
if (keycloak) {
|
|
1563
1616
|
keycloak.login();
|
|
1564
1617
|
} else {
|
|
1565
|
-
|
|
1566
|
-
console.error('Keycloak is not initialized.');
|
|
1618
|
+
throw new Error('Keycloak is not initialized.');
|
|
1567
1619
|
}
|
|
1568
1620
|
}
|
|
1569
1621
|
// Log out the user
|
|
@@ -1571,8 +1623,7 @@ function logout() {
|
|
|
1571
1623
|
if (keycloak) {
|
|
1572
1624
|
keycloak.logout();
|
|
1573
1625
|
} else {
|
|
1574
|
-
|
|
1575
|
-
console.error('Keycloak is not initialized.');
|
|
1626
|
+
throw new Error('Keycloak is not initialized.');
|
|
1576
1627
|
}
|
|
1577
1628
|
}
|
|
1578
1629
|
// Check if the user is authenticated
|
package/logo-space.entry.esm.js
CHANGED
|
@@ -12,16 +12,16 @@ const LogoSpace = class {
|
|
|
12
12
|
}
|
|
13
13
|
render() {
|
|
14
14
|
return h("div", {
|
|
15
|
-
key: '
|
|
15
|
+
key: 'fc5040b294d45ecbf8e3ee0ab26875c63efa3625',
|
|
16
16
|
class: "container my-20"
|
|
17
17
|
}, h("div", {
|
|
18
|
-
key: '
|
|
18
|
+
key: 'acad9c182cb46fd58f37d9195c9e20658df81767',
|
|
19
19
|
class: "w-[300px]"
|
|
20
20
|
}, h("div", {
|
|
21
|
-
key: '
|
|
21
|
+
key: '4caac9e94b715c967958fe6bd9e5d988622c8729',
|
|
22
22
|
class: "bg-dark"
|
|
23
23
|
}, h("div", {
|
|
24
|
-
key: '
|
|
24
|
+
key: 'd82b6156de96fd91e996c0ab775b9503395ba04f',
|
|
25
25
|
class: "logo-container",
|
|
26
26
|
innerHTML: vLogoMargins
|
|
27
27
|
}))));
|