@acorex-platform/framework-client 0.0.33 → 0.0.38
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/fesm2022/acorex-platform-framework-client-auth.mjs +172 -17
- package/fesm2022/acorex-platform-framework-client-auth.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-common-common-settings.provider-CzBr0cRi.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-common-settings-dialog.helper-DQNOCRL6.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-common.mjs +41 -38
- package/fesm2022/acorex-platform-framework-client-common.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-core.mjs +62 -3
- package/fesm2022/acorex-platform-framework-client-core.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-domain.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-layout-builder.mjs +1 -1
- package/fesm2022/acorex-platform-framework-client-layout-builder.mjs.map +1 -1
- package/fesm2022/{acorex-platform-framework-client-layout-components-binding-expression-editor-popup.component-oE8CeLE8.mjs → acorex-platform-framework-client-layout-components-binding-expression-editor-popup.component-Bp2cNCPO.mjs} +2 -2
- package/fesm2022/{acorex-platform-framework-client-layout-components-binding-expression-editor-popup.component-oE8CeLE8.mjs.map → acorex-platform-framework-client-layout-components-binding-expression-editor-popup.component-Bp2cNCPO.mjs.map} +1 -1
- package/fesm2022/acorex-platform-framework-client-layout-components-file-provider-picker.popup.component-BtLEUWAA.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-layout-components.mjs +54 -43
- package/fesm2022/acorex-platform-framework-client-layout-components.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-layout-designer.mjs +8 -8
- package/fesm2022/acorex-platform-framework-client-layout-designer.mjs.map +1 -1
- package/fesm2022/{acorex-platform-framework-client-layout-entity-acorex-platform-framework-client-layout-entity-D1prdDvf.mjs → acorex-platform-framework-client-layout-entity-acorex-platform-framework-client-layout-entity-CvaOWbJx.mjs} +763 -246
- package/fesm2022/acorex-platform-framework-client-layout-entity-acorex-platform-framework-client-layout-entity-CvaOWbJx.mjs.map +1 -0
- package/fesm2022/{acorex-platform-framework-client-layout-entity-attachments-page.component-CeVGNzup.mjs → acorex-platform-framework-client-layout-entity-attachments-page.component-Ds63Rt2n.mjs} +2 -2
- package/fesm2022/{acorex-platform-framework-client-layout-entity-attachments-page.component-CeVGNzup.mjs.map → acorex-platform-framework-client-layout-entity-attachments-page.component-Ds63Rt2n.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-framework-client-layout-entity-bulk-entity.command-CFScb-L4.mjs → acorex-platform-framework-client-layout-entity-bulk-entity.command-C0pohwdo.mjs} +2 -2
- package/fesm2022/{acorex-platform-framework-client-layout-entity-bulk-entity.command-CFScb-L4.mjs.map → acorex-platform-framework-client-layout-entity-bulk-entity.command-C0pohwdo.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-framework-client-layout-entity-file-list-popup.component-B3__csKW.mjs → acorex-platform-framework-client-layout-entity-file-list-popup.component-C0LgUzzv.mjs} +2 -2
- package/fesm2022/{acorex-platform-framework-client-layout-entity-file-list-popup.component-B3__csKW.mjs.map → acorex-platform-framework-client-layout-entity-file-list-popup.component-C0LgUzzv.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-framework-client-layout-entity-gallery-page.component-B17l6mbm.mjs → acorex-platform-framework-client-layout-entity-gallery-page.component-o2HuZrDN.mjs} +3 -3
- package/fesm2022/acorex-platform-framework-client-layout-entity-gallery-page.component-o2HuZrDN.mjs.map +1 -0
- package/fesm2022/acorex-platform-framework-client-layout-entity.mjs +1 -1
- package/fesm2022/acorex-platform-framework-client-layout-views.mjs +3 -3
- package/fesm2022/acorex-platform-framework-client-layout-views.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-layout-widget-core.mjs +16 -10
- package/fesm2022/acorex-platform-framework-client-layout-widget-core.mjs.map +1 -1
- package/fesm2022/{acorex-platform-framework-client-layout-widgets-button-widget-designer.component-BiWerYcu.mjs → acorex-platform-framework-client-layout-widgets-button-widget-designer.component-BDOdcoyN.mjs} +2 -2
- package/fesm2022/{acorex-platform-framework-client-layout-widgets-button-widget-designer.component-BiWerYcu.mjs.map → acorex-platform-framework-client-layout-widgets-button-widget-designer.component-BDOdcoyN.mjs.map} +1 -1
- package/fesm2022/acorex-platform-framework-client-layout-widgets-image-preview.popup-BOrrMm3U.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-layout-widgets-page-widget-designer.component-WzIiwnGC.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-layout-widgets-repeater-widget-column.component-4mX8aYzA.mjs.map +1 -1
- package/fesm2022/{acorex-platform-framework-client-layout-widgets-tabular-data-edit-popup.component-CRST84ou.mjs → acorex-platform-framework-client-layout-widgets-tabular-data-edit-popup.component-TWxthl21.mjs} +2 -2
- package/fesm2022/{acorex-platform-framework-client-layout-widgets-tabular-data-edit-popup.component-CRST84ou.mjs.map → acorex-platform-framework-client-layout-widgets-tabular-data-edit-popup.component-TWxthl21.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-framework-client-layout-widgets-tabular-data-view-popup.component-FjtSRxIX.mjs → acorex-platform-framework-client-layout-widgets-tabular-data-view-popup.component-D7P08nHH.mjs} +2 -2
- package/fesm2022/{acorex-platform-framework-client-layout-widgets-tabular-data-view-popup.component-FjtSRxIX.mjs.map → acorex-platform-framework-client-layout-widgets-tabular-data-view-popup.component-D7P08nHH.mjs.map} +1 -1
- package/fesm2022/acorex-platform-framework-client-layout-widgets-text-block-widget-designer.component-D6HFPmGC.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-layout-widgets.mjs +1121 -1107
- package/fesm2022/acorex-platform-framework-client-layout-widgets.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-native.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-realtime-set-presence-availability.command-CetlUjnM.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-realtime.mjs +2 -1
- package/fesm2022/acorex-platform-framework-client-realtime.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-runtime.mjs +46 -2
- package/fesm2022/acorex-platform-framework-client-runtime.mjs.map +1 -1
- package/fesm2022/{acorex-platform-framework-client-themes-default-entity-master-create-view.component-yeftgJ_K.mjs → acorex-platform-framework-client-themes-default-entity-master-create-view.component-CT7WWWG0.mjs} +2 -2
- package/fesm2022/{acorex-platform-framework-client-themes-default-entity-master-create-view.component-yeftgJ_K.mjs.map → acorex-platform-framework-client-themes-default-entity-master-create-view.component-CT7WWWG0.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-framework-client-themes-default-entity-master-modify-view.component-DWE3OWGm.mjs → acorex-platform-framework-client-themes-default-entity-master-modify-view.component-DienTcPE.mjs} +2 -2
- package/fesm2022/{acorex-platform-framework-client-themes-default-entity-master-modify-view.component-DWE3OWGm.mjs.map → acorex-platform-framework-client-themes-default-entity-master-modify-view.component-DienTcPE.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-framework-client-themes-default-entity-master-single-view.component-DCpl6AXq.mjs → acorex-platform-framework-client-themes-default-entity-master-single-view.component-DBUwSzvg.mjs} +2 -2
- package/fesm2022/{acorex-platform-framework-client-themes-default-entity-master-single-view.component-DCpl6AXq.mjs.map → acorex-platform-framework-client-themes-default-entity-master-single-view.component-DBUwSzvg.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-framework-client-themes-default-error-401.component-BrTotLx1.mjs → acorex-platform-framework-client-themes-default-error-401.component-CaV3MdRr.mjs} +2 -2
- package/fesm2022/{acorex-platform-framework-client-themes-default-error-401.component-BrTotLx1.mjs.map → acorex-platform-framework-client-themes-default-error-401.component-CaV3MdRr.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-framework-client-themes-default-error-404.component-DsC7_s59.mjs → acorex-platform-framework-client-themes-default-error-404.component-CTA-lxYp.mjs} +2 -2
- package/fesm2022/{acorex-platform-framework-client-themes-default-error-404.component-DsC7_s59.mjs.map → acorex-platform-framework-client-themes-default-error-404.component-CTA-lxYp.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-framework-client-themes-default-error-offline.component-CngiQycG.mjs → acorex-platform-framework-client-themes-default-error-offline.component-B85b0lsa.mjs} +2 -2
- package/fesm2022/{acorex-platform-framework-client-themes-default-error-offline.component-CngiQycG.mjs.map → acorex-platform-framework-client-themes-default-error-offline.component-B85b0lsa.mjs.map} +1 -1
- package/fesm2022/acorex-platform-framework-client-themes-default.mjs +21 -21
- package/fesm2022/acorex-platform-framework-client-themes-default.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-themes-shared-icon-chooser-column.component-CbZALjB5.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-themes-shared-icon-chooser-view.component-BRrNT6x2.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-themes-shared-settings.provider-CpsAIsxj.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-themes-shared-theme-color-chooser-column.component-BIsQTr6B.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-themes-shared-theme-color-chooser-view.component-ZclmSbt9.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-themes-shared.mjs +3 -3
- package/fesm2022/acorex-platform-framework-client-themes-shared.mjs.map +1 -1
- package/fesm2022/acorex-platform-framework-client-workflow.mjs.map +1 -1
- package/package.json +2 -2
- package/types/acorex-platform-framework-client-auth.d.ts +56 -10
- package/types/acorex-platform-framework-client-common.d.ts +16 -9
- package/types/acorex-platform-framework-client-core.d.ts +19 -9
- package/types/acorex-platform-framework-client-layout-components.d.ts +26 -7
- package/types/acorex-platform-framework-client-layout-entity.d.ts +38 -16
- package/types/acorex-platform-framework-client-layout-widgets.d.ts +29 -139
- package/types/acorex-platform-framework-client-realtime.d.ts +20 -2
- package/types/acorex-platform-framework-client-runtime.d.ts +8 -0
- package/types/acorex-platform-framework-client-themes-default.d.ts +1 -1
- package/fesm2022/acorex-platform-framework-client-layout-entity-acorex-platform-framework-client-layout-entity-D1prdDvf.mjs.map +0 -1
- package/fesm2022/acorex-platform-framework-client-layout-entity-gallery-page.component-B17l6mbm.mjs.map +0 -1
|
@@ -4,8 +4,8 @@ import { map, BehaviorSubject, shareReplay, defaultIfEmpty, switchMap, filter, d
|
|
|
4
4
|
import { AXPDebugService, AXPBroadcastEventService, AXP_SESSION_SERVICE, AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER, provideAppStartUpTask, AXP_APP_STARTUP_PRIORITY } from '@acorex-platform/framework-client/core';
|
|
5
5
|
import { isEmpty } from 'lodash-es';
|
|
6
6
|
import { AXPCommandService, AXPQueryService } from '@acorex-platform/framework-client/runtime';
|
|
7
|
-
import { AUTH_LOGOUT_DEFAULT, AUTH_REFRESH_DEFAULT, AUTH_UPDATE_SESSION_DEFAULT, AUTH_LIST_PROVIDERS_DEFAULT } from '@acorex-platform/framework-shared/runtime';
|
|
8
|
-
import {
|
|
7
|
+
import { AUTH_LOGOUT_DEFAULT, AUTH_REFRESH_DEFAULT, AUTH_UPDATE_SESSION_DEFAULT, AUTH_LIST_OWN_DEVICE_SESSIONS_DEFAULT, AUTH_TERMINATE_OWN_DEVICE_SESSION_DEFAULT, AUTH_LIST_PROVIDERS_DEFAULT } from '@acorex-platform/framework-shared/runtime';
|
|
8
|
+
import { runtimeQueryCollectionData, runtimeQueryObjectData, runtimeCommandPayloadData } from '@acorex-platform/framework-shared/core';
|
|
9
9
|
|
|
10
10
|
const AXP_APPLICATION_LOADER = new InjectionToken('AXP_APPLICATION_LOADER', {
|
|
11
11
|
providedIn: 'root',
|
|
@@ -325,30 +325,110 @@ const AXP_PERMISSION_CHECKER = new InjectionToken('AXP_PERMISSION_CHECKER');
|
|
|
325
325
|
const AXP_ACCESS_POLICY_CACHE_PORT = new InjectionToken('AXP_ACCESS_POLICY_CACHE_PORT');
|
|
326
326
|
//#endregion
|
|
327
327
|
|
|
328
|
-
//#region ---- OAuth pending strategy (
|
|
328
|
+
//#region ---- OAuth pending strategy (callback routing) ----
|
|
329
329
|
/**
|
|
330
|
-
*
|
|
331
|
-
* `restoreSession` clears partial `AXP_SESSION` (no user / no cookies) — this key
|
|
330
|
+
* When the SPA is redirected to `/auth/oauth-callback`, the active auth strategy name
|
|
332
331
|
* must survive so `/auth/oauth-callback` can resolve the strategy.
|
|
333
332
|
*/
|
|
334
|
-
const
|
|
335
|
-
/** Set by platform OAuth strategies before redirect (PKCE). */
|
|
333
|
+
const OAUTH_PENDING_STRATEGY_KEY = 'axp_oauth_pending_strategy';
|
|
336
334
|
const AXP_OAUTH_PKCE_VERIFIER_KEY = 'pkce_code_verifier';
|
|
337
335
|
function setOAuthPendingStrategy(strategy) {
|
|
338
|
-
|
|
339
|
-
if (!trimmed) {
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
localStorage.setItem(AXP_OAUTH_PENDING_STRATEGY_KEY, trimmed);
|
|
336
|
+
sessionStorage.setItem(OAUTH_PENDING_STRATEGY_KEY, strategy);
|
|
343
337
|
}
|
|
344
338
|
function getOAuthPendingStrategy() {
|
|
345
|
-
return
|
|
339
|
+
return sessionStorage.getItem(OAUTH_PENDING_STRATEGY_KEY);
|
|
346
340
|
}
|
|
347
341
|
function clearOAuthPendingStrategy() {
|
|
348
|
-
|
|
342
|
+
sessionStorage.removeItem(OAUTH_PENDING_STRATEGY_KEY);
|
|
343
|
+
}
|
|
344
|
+
/** @deprecated Server-side PKCE replaced localStorage verifier; kept for legacy detection only. */
|
|
345
|
+
function hasLegacyOAuthPkceVerifier() {
|
|
346
|
+
return !!localStorage.getItem(AXP_OAUTH_PKCE_VERIFIER_KEY);
|
|
347
|
+
}
|
|
348
|
+
function hasOAuthPendingFlow() {
|
|
349
|
+
return !!getOAuthPendingStrategy();
|
|
349
350
|
}
|
|
350
351
|
function isOAuthRedirectInFlight() {
|
|
351
|
-
return
|
|
352
|
+
return hasOAuthPendingFlow() || hasLegacyOAuthPkceVerifier();
|
|
353
|
+
}
|
|
354
|
+
//#endregion
|
|
355
|
+
|
|
356
|
+
//#region ---- Max active device sessions (client) ----
|
|
357
|
+
/** Stable API / ForbiddenException code from AuthService. */
|
|
358
|
+
const MAX_ACTIVE_DEVICE_SESSIONS_CODE = 'MAX_ACTIVE_DEVICE_SESSIONS';
|
|
359
|
+
const PENDING_TENANT_STORAGE_KEY = 'axp.auth.sessionLimit.pendingTenant';
|
|
360
|
+
function textContainsMaxSessionsCode(value) {
|
|
361
|
+
if (typeof value === 'string') {
|
|
362
|
+
return value === MAX_ACTIVE_DEVICE_SESSIONS_CODE || value.includes(MAX_ACTIVE_DEVICE_SESSIONS_CODE);
|
|
363
|
+
}
|
|
364
|
+
if (Array.isArray(value)) {
|
|
365
|
+
return value.some((item) => textContainsMaxSessionsCode(item));
|
|
366
|
+
}
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Detects tenant max concurrent device-session rejection from command / HTTP shapes.
|
|
371
|
+
* Must recognize {@link Error} subclasses (e.g. AuthApiError) via `.message`.
|
|
372
|
+
*/
|
|
373
|
+
function isMaxActiveDeviceSessionsError(error) {
|
|
374
|
+
if (error == null) {
|
|
375
|
+
return false;
|
|
376
|
+
}
|
|
377
|
+
if (typeof error === 'string') {
|
|
378
|
+
return textContainsMaxSessionsCode(error);
|
|
379
|
+
}
|
|
380
|
+
if (typeof error !== 'object') {
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
383
|
+
// Error.message is reliable for AuthApiError / Error thrown from UpdateSession.
|
|
384
|
+
if (error instanceof Error && textContainsMaxSessionsCode(error.message)) {
|
|
385
|
+
return true;
|
|
386
|
+
}
|
|
387
|
+
const err = error;
|
|
388
|
+
const candidates = [err['message'], err['error'], err['code']];
|
|
389
|
+
const nestedError = err['error'];
|
|
390
|
+
if (nestedError && typeof nestedError === 'object') {
|
|
391
|
+
const nested = nestedError;
|
|
392
|
+
candidates.push(nested['message'], nested['error'], nested['code']);
|
|
393
|
+
}
|
|
394
|
+
const apiError = err['apiError'];
|
|
395
|
+
if (apiError && typeof apiError === 'object') {
|
|
396
|
+
const api = apiError;
|
|
397
|
+
candidates.push(api['message'], api['error'], api['code']);
|
|
398
|
+
}
|
|
399
|
+
return candidates.some((value) => textContainsMaxSessionsCode(value));
|
|
400
|
+
}
|
|
401
|
+
function storeSessionLimitPendingTenant(tenant) {
|
|
402
|
+
try {
|
|
403
|
+
sessionStorage.setItem(PENDING_TENANT_STORAGE_KEY, JSON.stringify(tenant));
|
|
404
|
+
}
|
|
405
|
+
catch {
|
|
406
|
+
// Ignore quota / private-mode failures; route state may still carry the tenant.
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function readSessionLimitPendingTenant() {
|
|
410
|
+
try {
|
|
411
|
+
const raw = sessionStorage.getItem(PENDING_TENANT_STORAGE_KEY);
|
|
412
|
+
if (!raw) {
|
|
413
|
+
return null;
|
|
414
|
+
}
|
|
415
|
+
const parsed = JSON.parse(raw);
|
|
416
|
+
if (!parsed?.id || typeof parsed.id !== 'string') {
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
419
|
+
return parsed;
|
|
420
|
+
}
|
|
421
|
+
catch {
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
function clearSessionLimitPendingTenant() {
|
|
426
|
+
try {
|
|
427
|
+
sessionStorage.removeItem(PENDING_TENANT_STORAGE_KEY);
|
|
428
|
+
}
|
|
429
|
+
catch {
|
|
430
|
+
// ignore
|
|
431
|
+
}
|
|
352
432
|
}
|
|
353
433
|
//#endregion
|
|
354
434
|
|
|
@@ -706,6 +786,11 @@ class AXPSessionService {
|
|
|
706
786
|
}));
|
|
707
787
|
// Failed workspace bind must not leave a half-authenticated cookie session
|
|
708
788
|
// (that causes splash restore loops after refresh).
|
|
789
|
+
// Exception: max device sessions — keep identity session so the user can
|
|
790
|
+
// terminate another device and retry tenant bind.
|
|
791
|
+
if (isMaxActiveDeviceSessionsError(error)) {
|
|
792
|
+
throw error;
|
|
793
|
+
}
|
|
709
794
|
if (params?.['code']) {
|
|
710
795
|
clearOAuthPendingStrategy();
|
|
711
796
|
}
|
|
@@ -1795,6 +1880,7 @@ function parsePlatformExpiresIn(expiresIn) {
|
|
|
1795
1880
|
//#region ---- Platform OAuth helpers (PKCE + /connect/*) ----
|
|
1796
1881
|
const AXP_DEFAULT_PLATFORM_OAUTH_CLIENT_ID = 'acorex';
|
|
1797
1882
|
const AXP_DEFAULT_PLATFORM_OAUTH_SCOPE = 'openid profile email offline_access';
|
|
1883
|
+
const AXP_PLATFORM_OAUTH_CSRF_COOKIE = 'acx_csrf_token';
|
|
1798
1884
|
function resolvePlatformOAuthIssuer(baseUrl) {
|
|
1799
1885
|
const issuer = baseUrl?.replace(/\/$/, '');
|
|
1800
1886
|
if (!issuer) {
|
|
@@ -1812,6 +1898,18 @@ function resolvePlatformOAuthClientConfig(authConfig) {
|
|
|
1812
1898
|
scope: authConfig?.scope ?? AXP_DEFAULT_PLATFORM_OAUTH_SCOPE,
|
|
1813
1899
|
};
|
|
1814
1900
|
}
|
|
1901
|
+
function readPlatformOAuthCsrfToken() {
|
|
1902
|
+
const match = document.cookie.match(new RegExp(`(?:^|; )${AXP_PLATFORM_OAUTH_CSRF_COOKIE.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}=([^;]*)`));
|
|
1903
|
+
if (!match?.[1]) {
|
|
1904
|
+
return null;
|
|
1905
|
+
}
|
|
1906
|
+
try {
|
|
1907
|
+
return decodeURIComponent(match[1]);
|
|
1908
|
+
}
|
|
1909
|
+
catch {
|
|
1910
|
+
return match[1];
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1815
1913
|
async function fetchPlatformOAuthDiscoveryDocument(issuer) {
|
|
1816
1914
|
const response = await fetch(`${issuer}/.well-known/openid-configuration`);
|
|
1817
1915
|
if (!response.ok) {
|
|
@@ -1825,6 +1923,53 @@ function resolvePlatformOAuthAuthorizeEndpoint(issuer, discovery) {
|
|
|
1825
1923
|
function resolvePlatformOAuthTokenEndpoint(issuer, discovery) {
|
|
1826
1924
|
return discovery?.token_endpoint ?? `${issuer}/connect/token`;
|
|
1827
1925
|
}
|
|
1926
|
+
/**
|
|
1927
|
+
* BFF: server generates PKCE verifier/challenge and returns the platform authorize URL.
|
|
1928
|
+
* Verifier never touches browser localStorage.
|
|
1929
|
+
*/
|
|
1930
|
+
async function initPlatformOAuthAuthorization(input) {
|
|
1931
|
+
const response = await fetch(`${input.issuer}/connect/authorize/init`, {
|
|
1932
|
+
method: 'POST',
|
|
1933
|
+
credentials: 'include',
|
|
1934
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1935
|
+
body: JSON.stringify({
|
|
1936
|
+
client_id: input.clientId,
|
|
1937
|
+
redirect_uri: input.redirectUri,
|
|
1938
|
+
scope: input.scope,
|
|
1939
|
+
identity_provider: input.provider,
|
|
1940
|
+
}),
|
|
1941
|
+
});
|
|
1942
|
+
if (!response.ok) {
|
|
1943
|
+
const detail = await response.text().catch(() => '');
|
|
1944
|
+
throw new Error(`OAuth authorize init failed: ${response.status} ${response.statusText}${detail ? ` — ${detail}` : ''}`);
|
|
1945
|
+
}
|
|
1946
|
+
return (await response.json());
|
|
1947
|
+
}
|
|
1948
|
+
async function exchangePlatformOAuthAuthorizationCode(input) {
|
|
1949
|
+
const tokenEndpoint = input.tokenEndpoint ?? resolvePlatformOAuthTokenEndpoint(input.issuer);
|
|
1950
|
+
const csrfToken = readPlatformOAuthCsrfToken();
|
|
1951
|
+
const body = new URLSearchParams({
|
|
1952
|
+
grant_type: 'authorization_code',
|
|
1953
|
+
client_id: input.clientId,
|
|
1954
|
+
code: input.code,
|
|
1955
|
+
redirect_uri: input.redirectUri,
|
|
1956
|
+
});
|
|
1957
|
+
const headers = { 'Content-Type': 'application/x-www-form-urlencoded' };
|
|
1958
|
+
if (csrfToken) {
|
|
1959
|
+
headers['X-CSRF-Token'] = csrfToken;
|
|
1960
|
+
}
|
|
1961
|
+
const response = await fetch(tokenEndpoint, {
|
|
1962
|
+
method: 'POST',
|
|
1963
|
+
credentials: 'include',
|
|
1964
|
+
headers,
|
|
1965
|
+
body: body.toString(),
|
|
1966
|
+
});
|
|
1967
|
+
if (!response.ok) {
|
|
1968
|
+
const detail = await response.text().catch(() => '');
|
|
1969
|
+
throw new Error(`Token exchange failed: ${response.status} ${response.statusText}${detail ? ` — ${detail}` : ''}`);
|
|
1970
|
+
}
|
|
1971
|
+
return (await response.json());
|
|
1972
|
+
}
|
|
1828
1973
|
//#endregion
|
|
1829
1974
|
|
|
1830
1975
|
//#region ---- Auth:ListProviders public DTOs ----
|
|
@@ -1885,6 +2030,16 @@ class AXPPlatformAuthRuntimeService {
|
|
|
1885
2030
|
async updateSession(input) {
|
|
1886
2031
|
return this.executeCommand(AUTH_UPDATE_SESSION_DEFAULT, input);
|
|
1887
2032
|
}
|
|
2033
|
+
async listOwnDeviceSessions(tenantId) {
|
|
2034
|
+
const result = await this.queryService.fetch(AUTH_LIST_OWN_DEVICE_SESSIONS_DEFAULT, { tenantId });
|
|
2035
|
+
return runtimeQueryCollectionData(result)?.items ?? [];
|
|
2036
|
+
}
|
|
2037
|
+
async terminateOwnDeviceSession(id) {
|
|
2038
|
+
const result = await this.commandService.execute(AUTH_TERMINATE_OWN_DEVICE_SESSION_DEFAULT, { id });
|
|
2039
|
+
if (!result?.success) {
|
|
2040
|
+
throw new Error(commandMessageTextForError(result?.message?.text) || 'Failed to terminate device session');
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
1888
2043
|
async listProviders() {
|
|
1889
2044
|
if (this.listProvidersCache) {
|
|
1890
2045
|
return this.listProvidersCache;
|
|
@@ -1895,7 +2050,7 @@ class AXPPlatformAuthRuntimeService {
|
|
|
1895
2050
|
this.listProvidersInFlight = this.queryService
|
|
1896
2051
|
.fetch(AUTH_LIST_PROVIDERS_DEFAULT, {})
|
|
1897
2052
|
.then((result) => {
|
|
1898
|
-
this.listProvidersCache = asAuthListProvidersResponse(
|
|
2053
|
+
this.listProvidersCache = asAuthListProvidersResponse(runtimeQueryObjectData(result));
|
|
1899
2054
|
return this.listProvidersCache;
|
|
1900
2055
|
})
|
|
1901
2056
|
.finally(() => {
|
|
@@ -2172,5 +2327,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
2172
2327
|
* Generated bundle index. Do not edit.
|
|
2173
2328
|
*/
|
|
2174
2329
|
|
|
2175
|
-
export { AUTH_SESSION_TRACE_NS, AUTH_SESSION_TRACE_TITLE, AXPAuthGuard, AXPAuthModule, AXPAuthStrategy, AXPAuthStrategyRegistryService, AXPFeatureDirective, AXPFeatureEvaluatorScopeProvider, AXPFeatureGuard, AXPLoginChallengeComponentBase, AXPLoginChallengeProvider, AXPPermissionDefinitionBuilder, AXPPermissionDefinitionGroupBuilder, AXPPermissionDefinitionProviderContext, AXPPermissionDefinitionService, AXPPermissionDirective, AXPPermissionEvaluatorScopeProvider, AXPPermissionGuard, AXPPlatformAuthRuntimeService, AXPSessionContext, AXPSessionService, AXPSessionStatus, AXPSignInMethod, AXPSignInMethodRegistry, AXPUnauthenticatedError, AXPUnauthorizedError, AXPUserProfileIdentityService, AXP_ACCESS_POLICY_CACHE_PORT, AXP_APPLICATION_LOADER, AXP_DEFAULT_PLATFORM_OAUTH_CLIENT_ID, AXP_DEFAULT_PLATFORM_OAUTH_SCOPE, AXP_FEATURE_CHECKER, AXP_FEATURE_LOADER, AXP_LOGIN_CHALLENGE_PROVIDER,
|
|
2330
|
+
export { AUTH_SESSION_TRACE_NS, AUTH_SESSION_TRACE_TITLE, AXPAuthGuard, AXPAuthModule, AXPAuthStrategy, AXPAuthStrategyRegistryService, AXPFeatureDirective, AXPFeatureEvaluatorScopeProvider, AXPFeatureGuard, AXPLoginChallengeComponentBase, AXPLoginChallengeProvider, AXPPermissionDefinitionBuilder, AXPPermissionDefinitionGroupBuilder, AXPPermissionDefinitionProviderContext, AXPPermissionDefinitionService, AXPPermissionDirective, AXPPermissionEvaluatorScopeProvider, AXPPermissionGuard, AXPPlatformAuthRuntimeService, AXPSessionContext, AXPSessionService, AXPSessionStatus, AXPSignInMethod, AXPSignInMethodRegistry, AXPUnauthenticatedError, AXPUnauthorizedError, AXPUserProfileIdentityService, AXP_ACCESS_POLICY_CACHE_PORT, AXP_APPLICATION_LOADER, AXP_DEFAULT_PLATFORM_OAUTH_CLIENT_ID, AXP_DEFAULT_PLATFORM_OAUTH_SCOPE, AXP_FEATURE_CHECKER, AXP_FEATURE_LOADER, AXP_LOGIN_CHALLENGE_PROVIDER, AXP_OAUTH_PKCE_VERIFIER_KEY, AXP_PERMISSION_CHECKER, AXP_PERMISSION_DEFINITION_PROVIDER, AXP_PERMISSION_LOADER, AXP_PERMISSION_MODULES_RESOLVER, AXP_PLATFORM_OAUTH_CSRF_COOKIE, AXP_TENANT_LOADER, AXP_USER_AVATAR_CACHE_PORT, JwtUtil, MAX_ACTIVE_DEVICE_SESSIONS_CODE, PkceUtil, TimeUtil, asAuthListProvidersResponse, clearOAuthPendingStrategy, clearSessionLimitPendingTenant, commandMessageTextForError, exchangePlatformOAuthAuthorizationCode, fetchPlatformOAuthDiscoveryDocument, findIdentityProvider, getOAuthPendingStrategy, hasLegacyOAuthPkceVerifier, hasOAuthPendingFlow, initPlatformOAuthAuthorization, isMaxActiveDeviceSessionsError, isOAuthRedirectInFlight, platformOAuthSessionUpdateParams, readPlatformOAuthCsrfToken, readSessionLimitPendingTenant, resolvePlatformOAuthAuthorizeEndpoint, resolvePlatformOAuthClientConfig, resolvePlatformOAuthIssuer, resolvePlatformOAuthRedirectUri, resolvePlatformOAuthTokenEndpoint, setOAuthPendingStrategy, shouldPlatformOAuthBindSession, storeSessionLimitPendingTenant, toPlatformOAuthSignInResult, traceAuthAccessPolicy, traceAuthCatalog, traceAuthGuard, traceAuthLifecycle, traceAuthLifecycleError, traceAuthRestore, traceAuthWorkspace };
|
|
2176
2331
|
//# sourceMappingURL=acorex-platform-framework-client-auth.mjs.map
|