@meshmakers/shared-auth 3.5.790 → 3.5.800

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.
@@ -1,360 +1,360 @@
1
- import * as _angular_core from '@angular/core';
2
- import { Signal, InjectionToken, ElementRef, EnvironmentProviders } from '@angular/core';
3
- import { CanActivateFn, CanMatchFn } from '@angular/router';
4
- import { OAuthStorage } from 'angular-oauth2-oidc';
5
- import { HttpInterceptorFn } from '@angular/common/http';
6
-
7
- declare enum Roles {
8
- ReportingManagement = "ReportingManagement",
9
- ReportingViewer = "ReportingViewer",
10
- /**
11
- * Manage platform files: create/delete roots and folders, upload, move, rename and delete files in the
12
- * tenant file system (`System/FileSystemItem`, AB#6171 decision D5). Seeded by `System.Identity.Bootstrap`
13
- * and granted to every holder of `ReportingManagement` by a one-off identity migration.
14
- */
15
- FileManagement = "FileManagement",
16
- /**
17
- * Browse and download platform files (AB#6171 decision D5). Seeded by `System.Identity.Bootstrap`
18
- * and granted to every holder of `ReportingViewer` by a one-off identity migration.
19
- */
20
- FileViewer = "FileViewer",
21
- AdminPanelManagement = "AdminPanelManagement",
22
- /**
23
- * Trigger secret sweeps (Verify / Encrypt / CleanupUnreadable) and delete a pre-sweep dump early
24
- * (SECRET value type AB#5528, handover §6). Seeded by `System.Identity.Bootstrap`
25
- * (`CommonConstants.SecretManagementRole`); the secrets overview itself needs `AdminPanelManagement`.
26
- */
27
- SecretManagement = "SecretManagement",
28
- BotManagement = "BotManagement",
29
- UserManagement = "UserManagement",
30
- CommunicationManagement = "CommunicationManagement",
31
- TenantManagement = "TenantManagement",
32
- Development = "Development",
33
- StreamDataAdmin = "StreamDataAdmin",
34
- StreamDataWriter = "StreamDataWriter",
35
- StreamDataReader = "StreamDataReader"
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ import * as i0 from "@angular/core";
5
+ import { ElementRef, EnvironmentProviders, InjectionToken, Signal } from "@angular/core";
6
+ import { OAuthStorage } from "angular-oauth2-oidc";
7
+ import { HttpInterceptorFn } from "@angular/common/http";
8
+ import { CanActivateFn, CanMatchFn } from "@angular/router";
9
+ export declare enum Roles {
10
+ ReportingManagement = "ReportingManagement",
11
+ ReportingViewer = "ReportingViewer",
12
+ /**
13
+ * Manage platform files: create/delete roots and folders, upload, move, rename and delete files in the
14
+ * tenant file system (`System/FileSystemItem`, AB#6171 decision D5). Seeded by `System.Identity.Bootstrap`
15
+ * and granted to every holder of `ReportingManagement` by a one-off identity migration.
16
+ */
17
+ FileManagement = "FileManagement",
18
+ /**
19
+ * Browse and download platform files (AB#6171 decision D5). Seeded by `System.Identity.Bootstrap`
20
+ * and granted to every holder of `ReportingViewer` by a one-off identity migration.
21
+ */
22
+ FileViewer = "FileViewer",
23
+ AdminPanelManagement = "AdminPanelManagement",
24
+ /**
25
+ * Trigger secret sweeps (Verify / Encrypt / CleanupUnreadable) and delete a pre-sweep dump early
26
+ * (SECRET value type AB#5528, handover §6). Seeded by `System.Identity.Bootstrap`
27
+ * (`CommonConstants.SecretManagementRole`); the secrets overview itself needs `AdminPanelManagement`.
28
+ */
29
+ SecretManagement = "SecretManagement",
30
+ BotManagement = "BotManagement",
31
+ UserManagement = "UserManagement",
32
+ CommunicationManagement = "CommunicationManagement",
33
+ TenantManagement = "TenantManagement",
34
+ Development = "Development",
35
+ StreamDataAdmin = "StreamDataAdmin",
36
+ StreamDataWriter = "StreamDataWriter",
37
+ StreamDataReader = "StreamDataReader"
36
38
  }
37
-
38
- interface IUser {
39
- family_name: string | null;
40
- given_name: string | null;
41
- name: string;
42
- role: string[] | null;
43
- sub: string;
44
- idp: string;
45
- email: string | null;
39
+ export interface IUser {
40
+ family_name: string | null;
41
+ given_name: string | null;
42
+ name: string;
43
+ role: string[] | null;
44
+ sub: string;
45
+ idp: string;
46
+ email: string | null;
46
47
  }
47
- interface DiscoveryDocumentRetryOptions {
48
- attempts: number;
49
- initialDelayMs: number;
50
- maxDelayMs: number;
48
+ export interface DiscoveryDocumentRetryOptions {
49
+ attempts: number;
50
+ initialDelayMs: number;
51
+ maxDelayMs: number;
51
52
  }
52
- declare class AuthorizeOptions {
53
- wellKnownServiceUris?: string[];
54
- issuer?: string;
55
- redirectUri?: string;
56
- postLogoutRedirectUri?: string;
57
- clientId?: string;
58
- scope?: string;
59
- showDebugInformation?: boolean;
60
- sessionChecksEnabled?: boolean;
61
- defaultTenantId?: string;
62
- discoveryScopeTenantId?: string;
63
- discoveryDocumentRetry?: DiscoveryDocumentRetryOptions;
53
+ export declare class AuthorizeOptions {
54
+ wellKnownServiceUris?: string[];
55
+ issuer?: string;
56
+ redirectUri?: string;
57
+ postLogoutRedirectUri?: string;
58
+ clientId?: string;
59
+ scope?: string;
60
+ showDebugInformation?: boolean;
61
+ sessionChecksEnabled?: boolean;
62
+ defaultTenantId?: string;
63
+ discoveryScopeTenantId?: string;
64
+ discoveryDocumentRetry?: DiscoveryDocumentRetryOptions;
64
65
  }
65
- declare class AuthorizeService {
66
- private readonly oauthService;
67
- private readonly _isAuthenticated;
68
- private readonly _issuer;
69
- private readonly _accessToken;
70
- private readonly _user;
71
- private readonly _userInitials;
72
- private readonly _isInitialized;
73
- private readonly _isInitializing;
74
- private readonly _sessionLoading;
75
- private readonly _allowedTenants;
76
- private readonly _tokenTenantId;
77
- private readonly _discoveryDocumentError;
78
- private readonly _discoveryDocumentRetryAttempt;
79
- private static readonly TENANT_REAUTH_KEY;
80
- /** RFC 8693 token exchange, used to switch tenants without a redirect. */
81
- private static readonly TOKEN_EXCHANGE_GRANT;
82
- private static readonly ACCESS_TOKEN_TYPE;
83
- private static readonly TENANT_SWITCH_ATTEMPTED_KEY;
84
- /** Set when the user explicitly retried the sign-in from the tenant-mismatch screen (AB#6731). */
85
- private static readonly TENANT_SIGNIN_RETRIED_KEY;
86
- private static readonly DEFAULT_DISCOVERY_RETRY;
87
- private readonly tenantStorage;
88
- private _loginInProgress;
89
- private authorizeOptions;
90
- private lastAuthConfig;
91
- /**
92
- * Signal indicating whether the user is currently authenticated.
93
- */
94
- readonly isAuthenticated: Signal<boolean>;
95
- /**
96
- * Signal containing the issuer URL.
97
- */
98
- readonly issuer: Signal<string | null>;
99
- /**
100
- * Signal containing the current access token.
101
- */
102
- readonly accessToken: Signal<string | null>;
103
- /**
104
- * Signal containing the current user information.
105
- */
106
- readonly user: Signal<IUser | null>;
107
- /**
108
- * Computed signal containing the user's initials (e.g., "JD" for John Doe).
109
- */
110
- readonly userInitials: Signal<string | null>;
111
- /**
112
- * Signal indicating whether the session is currently loading.
113
- */
114
- readonly sessionLoading: Signal<boolean>;
115
- /**
116
- * Signal containing the list of tenants the user is allowed to access.
117
- * Parsed from the allowed_tenants claims in the access token.
118
- */
119
- readonly allowedTenants: Signal<string[]>;
120
- /**
121
- * Signal containing the tenant_id claim from the current access token.
122
- * Used to detect tenant mismatch when navigating between tenants.
123
- */
124
- readonly tokenTenantId: Signal<string | null>;
125
- /**
126
- * Computed signal containing the user's roles.
127
- */
128
- readonly roles: Signal<string[]>;
129
- /**
130
- * Signal carrying the last error from loadDiscoveryDocumentAndTryLogin().
131
- * Non-null means the Identity service was unreachable across the full retry
132
- * budget; host apps can render a recovery screen and call retryDiscoveryDocument().
133
- */
134
- readonly discoveryDocumentError: Signal<Error | null>;
135
- /**
136
- * Signal containing the current discovery-document retry attempt (1-based while
137
- * retrying, 0 when idle). Useful for showing "Reconnecting (attempt N)…" UI.
138
- */
139
- readonly discoveryDocumentRetryAttempt: Signal<number>;
140
- /**
141
- * Computed signal for the user's display name.
142
- * Uses given_name + family_name if available, otherwise derives from the username.
143
- */
144
- readonly displayName: Signal<string | null>;
145
- constructor();
146
- /**
147
- * Public hook to retry loading the discovery document after a failure.
148
- * No-op while initialization is in progress.
149
- */
150
- retryDiscoveryDocument(): Promise<void>;
151
- /**
152
- * Checks if the current user has the specified role.
153
- */
154
- isInRole(role: Roles): boolean;
155
- /**
156
- * Gets the configured service URIs that should receive the authorization token.
157
- */
158
- getServiceUris(): string[] | null;
159
- /**
160
- * Sets the tenant ID for per-tenant token storage isolation.
161
- * Call it BEFORE initialize() so tokens are stored/retrieved under the correct tenant prefix
162
- * in localStorage.
163
- *
164
- * When set, all OAuth storage keys are prefixed with `{tenantId}__`
165
- * (e.g., `maco__access_token`), preventing token collisions between tenants.
166
- * The tenant ID is also persisted in sessionStorage so it survives OAuth redirects.
167
- *
168
- * It may also be called AFTER initialize(), once the app has learned the tenant from the
169
- * token: a sign-in that started without a tenant — identity resolved it through tenant
170
- * discovery — leaves its session in the unprefixed slot, and that session is then moved into
171
- * the tenant's slot (see {@link TenantAwareOAuthStorage.adoptUnprefixedSession}). Without
172
- * the move, the next reload on a tenant URL finds an empty slot and re-authenticates silently.
173
- *
174
- * @param tenantId The tenant ID to use for storage key prefixing, or null for unprefixed mode.
175
- */
176
- setStorageTenantId(tenantId: string | null): void;
177
- /**
178
- * Returns the current storage tenant ID.
179
- * Used by the interceptor to inject acr_values into token endpoint requests.
180
- */
181
- getStorageTenantId(): string | null;
182
- /**
183
- * Restores the storage tenant ID from sessionStorage.
184
- * Use this when the tenant ID cannot be determined from the URL
185
- * (e.g., after an OAuth redirect to the root path).
186
- *
187
- * @returns The restored tenant ID, or null if none was persisted.
188
- */
189
- restoreStorageTenantId(): string | null;
190
- /**
191
- * Gets the current access token synchronously.
192
- * Use this for functional interceptors that need immediate access to the token.
193
- *
194
- * @returns The current access token or null if not authenticated
195
- */
196
- getAccessTokenSync(): string | null;
197
- /**
198
- * Checks if the user is allowed to access the specified tenant.
199
- * Returns true if no allowed_tenants claims are present (backwards compatibility).
200
- */
201
- isTenantAllowed(tenantId: string): boolean;
202
- /**
203
- * Initiates the login flow.
204
- * Multiple guards (canActivateChild, canMatch) may call this concurrently
205
- * during route resolution. Only the first call proceeds — subsequent calls
206
- * are skipped to prevent generating a new nonce that overwrites the first
207
- * one, which would cause an "invalid_nonce_in_state" error after the
208
- * identity server redirects back.
209
- *
210
- * @param tenantId Optional tenant ID. When provided, includes acr_values=tenant:{tenantId}
211
- * so the identity server redirects to the correct tenant's login page. Without one
212
- * (and without a defaultTenantId) identity resolves the tenant itself; a configured
213
- * discoveryScopeTenantId then travels as acr_values=tenant_scope:{scope} and limits
214
- * that resolution to the scope's subtree (AB#5311).
215
- */
216
- login(tenantId?: string): void;
217
- /**
218
- * Forces re-authentication for a different tenant by clearing the local
219
- * OAuth session and reloading the page. On reload, the guard will see
220
- * isAuthenticated=false and call login(tenantId) with the correct acr_values.
221
- *
222
- * This is used when the current token's tenant_id does not match the
223
- * route's tenantId (e.g., navigating from octosystem to meshtest).
224
- */
225
- /**
226
- * Returns true if the switch was initiated, false if skipped (loop prevention).
227
- */
228
- switchTenant(targetTenantId: string, targetUrl: string): boolean;
229
- /**
230
- * User-initiated retry from the tenant-mismatch screen (AB#6731): clears the loop-protection
231
- * flag once and starts a fresh authorization-code flow for the target tenant. The retry is
232
- * remembered, so a second mismatch is reported as "not a member" instead of offering another
233
- * sign-in. Returns false (and does nothing) when this tenant was already retried.
234
- */
235
- retryTenantSignIn(targetTenantId: string, targetUrl: string): boolean;
236
- /** True when the user already retried the sign-in for this tenant from the mismatch screen. */
237
- isTenantSignInRetried(targetTenantId: string): boolean;
238
- /**
239
- * Switches to another tenant in place, without a redirect, by exchanging the current access
240
- * token for one issued in the target tenant (RFC 8693).
241
- *
242
- * Preferred over {@link switchTenant}, which reloads the page and runs a full authorization
243
- * code flow — a visible round trip through the identity server, and a fresh login mask whenever
244
- * the tenant's session cookie has expired. The exchange re-resolves the user's roles in the
245
- * target tenant server-side, so no privilege from the source tenant leaks across.
246
- *
247
- * @returns true when the switch completed and the session now belongs to the target tenant;
248
- * false when it was not possible, in which case the caller should fall back to
249
- * {@link switchTenant}. Never throws.
250
- */
251
- switchTenantByExchange(targetTenantId: string): Promise<boolean>;
252
- /** Reads the profile of an exchanged token; it carries no id_token of its own. */
253
- private fetchUserInfoClaims;
254
- /**
255
- * Writes the exchanged tokens into the TARGET tenant's storage slots, so the OAuth library and
256
- * a later reload both find a complete session there.
257
- */
258
- private storeExchangedTokens;
259
- /** Mirrors what loadUserAsync() publishes, for a session that arrived without an id_token. */
260
- private applyExchangedSession;
261
- /**
262
- * Returns the pending tenant switch target (if any) WITHOUT clearing it.
263
- * The key persists across the OAuth redirect cycle (guard → IDS → callback → guard)
264
- * and is only cleared after a successful token exchange in loadUserAsync().
265
- *
266
- * Previously this method removed the key immediately, but that caused a race condition:
267
- * the guard consumed it before the IDS redirect, and after the callback redirect the
268
- * key was gone — causing the guard to fall back to the route tenant (wrong tenant).
269
- */
270
- consumePendingTenantSwitch(): string | null;
271
- /**
272
- * Clears the pending tenant switch key. Called after a successful token exchange
273
- * when the token's tenant_id matches the target, completing the switch cycle.
274
- */
275
- clearPendingTenantSwitch(): void;
276
- /**
277
- * Returns the tenant for which a switch was already attempted (if any) and clears it.
278
- * Used by the guard to prevent infinite redirect loops: if the Identity Server
279
- * issues a token for the wrong tenant even after a switch, we skip the second attempt.
280
- */
281
- consumeSwitchAttempted(): string | null;
282
- /**
283
- * Logs out the current user by redirecting to the Identity Server's
284
- * OIDC end_session_endpoint for proper Single Logout (SLO).
285
- *
286
- * We cannot rely on oauthService.logOut() for the redirect because it calls
287
- * clearStorage() which may clear internal state before the redirect happens.
288
- * Instead, we capture the logoutUrl and id_token first, then clear state,
289
- * then manually redirect to the end_session_endpoint.
290
- */
291
- logout(): void;
292
- /**
293
- * Updates the redirect URIs without performing a full re-initialization.
294
- * Use this when the OAuth session is already established and only the
295
- * redirect targets need to change (e.g., when switching tenants).
296
- */
297
- updateRedirectUris(redirectUri: string, postLogoutRedirectUri: string): void;
298
- /**
299
- * Refreshes the access token and updates the allowed tenants signal.
300
- * Call this after actions that change the user's tenant access (e.g., provisioning).
301
- */
302
- refreshAccessToken(): Promise<void>;
303
- /**
304
- * Initializes the authorization service with the specified options.
305
- */
306
- initialize(authorizeOptions: AuthorizeOptions): Promise<void>;
307
- /**
308
- * Wraps oauthService.loadDiscoveryDocumentAndTryLogin() with bounded
309
- * exponential-backoff retries so a brief outage of the Identity service
310
- * (cold start after redeploy, rolling restart, transient ingress 5xx)
311
- * does not leave the SPA stuck on the loading icon.
312
- *
313
- * The CORS-error symptom seen on test-2 — "No 'Access-Control-Allow-Origin'
314
- * header" against /.well-known/openid-configuration — is exactly such a
315
- * transient failure: the ingress synthesises a default error page that
316
- * does not carry the CORS headers, so the browser reports a CORS violation
317
- * rather than the actual HTTP status. Retrying after the backend comes
318
- * back resolves it without user interaction.
319
- *
320
- * Throws the last error if every attempt fails. The error is also stored
321
- * in the discoveryDocumentError signal so callers can render a recovery UI.
322
- */
323
- private loadDiscoveryDocumentAndTryLoginWithRetry;
324
- /**
325
- * Uninitializes the authorization service.
326
- */
327
- uninitialize(): Promise<void>;
328
- /**
329
- * Drives the optional {@link SessionIdentitySink} from one place (AB#7327): the identity is derived from
330
- * `_user` + `_tokenTenantId`, so every path that sets them (login, token refresh, in-place tenant switch,
331
- * redirect fallback) and every path that clears them (logout, session_terminated, token_refresh_error,
332
- * cross-tab logout, reset before a redirect switch) is covered without touching each one. Nothing is
333
- * registered when the app provides no sink. A sink that throws never affects authentication.
334
- */
335
- private setUpSessionIdentity;
336
- private loadUserAsync;
337
- /**
338
- * Decodes the JWT access token payload and extracts allowed_tenants claims.
339
- * The claim can be a single string or an array of strings.
340
- */
341
- private deriveDisplayNameFromUsername;
342
- private deriveInitials;
343
- /**
344
- * Reloads the page. This method is protected to allow mocking in tests.
345
- * @internal
346
- */
347
- protected reloadPage(): void;
348
- /**
349
- * Navigates to the given URL via full page navigation.
350
- * This method is protected to allow mocking in tests.
351
- * @internal
352
- */
353
- protected navigateTo(url: string): void;
354
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<AuthorizeService, never>;
355
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<AuthorizeService>;
66
+ export declare class AuthorizeService {
67
+ private readonly oauthService;
68
+ private readonly _isAuthenticated;
69
+ private readonly _issuer;
70
+ private readonly _accessToken;
71
+ private readonly _user;
72
+ private readonly _userInitials;
73
+ private readonly _isInitialized;
74
+ private readonly _isInitializing;
75
+ private readonly _sessionLoading;
76
+ private readonly _allowedTenants;
77
+ private readonly _tokenTenantId;
78
+ private readonly _discoveryDocumentError;
79
+ private readonly _discoveryDocumentRetryAttempt;
80
+ private static readonly TENANT_REAUTH_KEY;
81
+ /** RFC 8693 token exchange, used to switch tenants without a redirect. */
82
+ private static readonly TOKEN_EXCHANGE_GRANT;
83
+ private static readonly ACCESS_TOKEN_TYPE;
84
+ private static readonly TENANT_SWITCH_ATTEMPTED_KEY;
85
+ /** Set when the user explicitly retried the sign-in from the tenant-mismatch screen (AB#6731). */
86
+ private static readonly TENANT_SIGNIN_RETRIED_KEY;
87
+ private static readonly DEFAULT_DISCOVERY_RETRY;
88
+ private readonly tenantStorage;
89
+ private _loginInProgress;
90
+ private authorizeOptions;
91
+ private lastAuthConfig;
92
+ /**
93
+ * Signal indicating whether the user is currently authenticated.
94
+ */
95
+ readonly isAuthenticated: Signal<boolean>;
96
+ /**
97
+ * Signal containing the issuer URL.
98
+ */
99
+ readonly issuer: Signal<string | null>;
100
+ /**
101
+ * Signal containing the current access token.
102
+ */
103
+ readonly accessToken: Signal<string | null>;
104
+ /**
105
+ * Signal containing the current user information.
106
+ */
107
+ readonly user: Signal<IUser | null>;
108
+ /**
109
+ * Computed signal containing the user's initials (e.g., "JD" for John Doe).
110
+ */
111
+ readonly userInitials: Signal<string | null>;
112
+ /**
113
+ * Signal indicating whether the session is currently loading.
114
+ */
115
+ readonly sessionLoading: Signal<boolean>;
116
+ /**
117
+ * Signal containing the list of tenants the user is allowed to access.
118
+ * Parsed from the allowed_tenants claims in the access token.
119
+ */
120
+ readonly allowedTenants: Signal<string[]>;
121
+ /**
122
+ * Signal containing the tenant_id claim from the current access token.
123
+ * Used to detect tenant mismatch when navigating between tenants.
124
+ */
125
+ readonly tokenTenantId: Signal<string | null>;
126
+ /**
127
+ * Computed signal containing the user's roles.
128
+ */
129
+ readonly roles: Signal<string[]>;
130
+ /**
131
+ * Signal carrying the last error from loadDiscoveryDocumentAndTryLogin().
132
+ * Non-null means the Identity service was unreachable across the full retry
133
+ * budget; host apps can render a recovery screen and call retryDiscoveryDocument().
134
+ */
135
+ readonly discoveryDocumentError: Signal<Error | null>;
136
+ /**
137
+ * Signal containing the current discovery-document retry attempt (1-based while
138
+ * retrying, 0 when idle). Useful for showing "Reconnecting (attempt N)…" UI.
139
+ */
140
+ readonly discoveryDocumentRetryAttempt: Signal<number>;
141
+ /**
142
+ * Computed signal for the user's display name.
143
+ * Uses given_name + family_name if available, otherwise derives from the username.
144
+ */
145
+ readonly displayName: Signal<string | null>;
146
+ constructor();
147
+ /**
148
+ * Public hook to retry loading the discovery document after a failure.
149
+ * No-op while initialization is in progress.
150
+ */
151
+ retryDiscoveryDocument(): Promise<void>;
152
+ /**
153
+ * Checks if the current user has the specified role.
154
+ */
155
+ isInRole(role: Roles): boolean;
156
+ /**
157
+ * Gets the configured service URIs that should receive the authorization token.
158
+ */
159
+ getServiceUris(): string[] | null;
160
+ /**
161
+ * Sets the tenant ID for per-tenant token storage isolation.
162
+ * Call it BEFORE initialize() so tokens are stored/retrieved under the correct tenant prefix
163
+ * in localStorage.
164
+ *
165
+ * When set, all OAuth storage keys are prefixed with `{tenantId}__`
166
+ * (e.g., `maco__access_token`), preventing token collisions between tenants.
167
+ * The tenant ID is also persisted in sessionStorage so it survives OAuth redirects.
168
+ *
169
+ * It may also be called AFTER initialize(), once the app has learned the tenant from the
170
+ * token: a sign-in that started without a tenant — identity resolved it through tenant
171
+ * discovery — leaves its session in the unprefixed slot, and that session is then moved into
172
+ * the tenant's slot (see {@link TenantAwareOAuthStorage.adoptUnprefixedSession}). Without
173
+ * the move, the next reload on a tenant URL finds an empty slot and re-authenticates silently.
174
+ *
175
+ * @param tenantId The tenant ID to use for storage key prefixing, or null for unprefixed mode.
176
+ */
177
+ setStorageTenantId(tenantId: string | null): void;
178
+ /**
179
+ * Returns the current storage tenant ID.
180
+ * Used by the interceptor to inject acr_values into token endpoint requests.
181
+ */
182
+ getStorageTenantId(): string | null;
183
+ /**
184
+ * Restores the storage tenant ID from sessionStorage.
185
+ * Use this when the tenant ID cannot be determined from the URL
186
+ * (e.g., after an OAuth redirect to the root path).
187
+ *
188
+ * @returns The restored tenant ID, or null if none was persisted.
189
+ */
190
+ restoreStorageTenantId(): string | null;
191
+ /**
192
+ * Gets the current access token synchronously.
193
+ * Use this for functional interceptors that need immediate access to the token.
194
+ *
195
+ * @returns The current access token or null if not authenticated
196
+ */
197
+ getAccessTokenSync(): string | null;
198
+ /**
199
+ * Checks if the user is allowed to access the specified tenant.
200
+ * Returns true if no allowed_tenants claims are present (backwards compatibility).
201
+ */
202
+ isTenantAllowed(tenantId: string): boolean;
203
+ /**
204
+ * Initiates the login flow.
205
+ * Multiple guards (canActivateChild, canMatch) may call this concurrently
206
+ * during route resolution. Only the first call proceeds — subsequent calls
207
+ * are skipped to prevent generating a new nonce that overwrites the first
208
+ * one, which would cause an "invalid_nonce_in_state" error after the
209
+ * identity server redirects back.
210
+ *
211
+ * @param tenantId Optional tenant ID. When provided, includes acr_values=tenant:{tenantId}
212
+ * so the identity server redirects to the correct tenant's login page. Without one
213
+ * (and without a defaultTenantId) identity resolves the tenant itself; a configured
214
+ * discoveryScopeTenantId then travels as acr_values=tenant_scope:{scope} and limits
215
+ * that resolution to the scope's subtree (AB#5311).
216
+ */
217
+ login(tenantId?: string): void;
218
+ /**
219
+ * Forces re-authentication for a different tenant by clearing the local
220
+ * OAuth session and reloading the page. On reload, the guard will see
221
+ * isAuthenticated=false and call login(tenantId) with the correct acr_values.
222
+ *
223
+ * This is used when the current token's tenant_id does not match the
224
+ * route's tenantId (e.g., navigating from octosystem to meshtest).
225
+ */
226
+ /**
227
+ * Returns true if the switch was initiated, false if skipped (loop prevention).
228
+ */
229
+ switchTenant(targetTenantId: string, targetUrl: string): boolean;
230
+ /**
231
+ * User-initiated retry from the tenant-mismatch screen (AB#6731): clears the loop-protection
232
+ * flag once and starts a fresh authorization-code flow for the target tenant. The retry is
233
+ * remembered, so a second mismatch is reported as "not a member" instead of offering another
234
+ * sign-in. Returns false (and does nothing) when this tenant was already retried.
235
+ */
236
+ retryTenantSignIn(targetTenantId: string, targetUrl: string): boolean;
237
+ /** True when the user already retried the sign-in for this tenant from the mismatch screen. */
238
+ isTenantSignInRetried(targetTenantId: string): boolean;
239
+ /**
240
+ * Switches to another tenant in place, without a redirect, by exchanging the current access
241
+ * token for one issued in the target tenant (RFC 8693).
242
+ *
243
+ * Preferred over {@link switchTenant}, which reloads the page and runs a full authorization
244
+ * code flow — a visible round trip through the identity server, and a fresh login mask whenever
245
+ * the tenant's session cookie has expired. The exchange re-resolves the user's roles in the
246
+ * target tenant server-side, so no privilege from the source tenant leaks across.
247
+ *
248
+ * @returns true when the switch completed and the session now belongs to the target tenant;
249
+ * false when it was not possible, in which case the caller should fall back to
250
+ * {@link switchTenant}. Never throws.
251
+ */
252
+ switchTenantByExchange(targetTenantId: string): Promise<boolean>;
253
+ /** Reads the profile of an exchanged token; it carries no id_token of its own. */
254
+ private fetchUserInfoClaims;
255
+ /**
256
+ * Writes the exchanged tokens into the TARGET tenant's storage slots, so the OAuth library and
257
+ * a later reload both find a complete session there.
258
+ */
259
+ private storeExchangedTokens;
260
+ /** Mirrors what loadUserAsync() publishes, for a session that arrived without an id_token. */
261
+ private applyExchangedSession;
262
+ /**
263
+ * Returns the pending tenant switch target (if any) WITHOUT clearing it.
264
+ * The key persists across the OAuth redirect cycle (guard → IDS → callback → guard)
265
+ * and is only cleared after a successful token exchange in loadUserAsync().
266
+ *
267
+ * Previously this method removed the key immediately, but that caused a race condition:
268
+ * the guard consumed it before the IDS redirect, and after the callback redirect the
269
+ * key was gone — causing the guard to fall back to the route tenant (wrong tenant).
270
+ */
271
+ consumePendingTenantSwitch(): string | null;
272
+ /**
273
+ * Clears the pending tenant switch key. Called after a successful token exchange
274
+ * when the token's tenant_id matches the target, completing the switch cycle.
275
+ */
276
+ clearPendingTenantSwitch(): void;
277
+ /**
278
+ * Returns the tenant for which a switch was already attempted (if any) and clears it.
279
+ * Used by the guard to prevent infinite redirect loops: if the Identity Server
280
+ * issues a token for the wrong tenant even after a switch, we skip the second attempt.
281
+ */
282
+ consumeSwitchAttempted(): string | null;
283
+ /**
284
+ * Logs out the current user by redirecting to the Identity Server's
285
+ * OIDC end_session_endpoint for proper Single Logout (SLO).
286
+ *
287
+ * We cannot rely on oauthService.logOut() for the redirect because it calls
288
+ * clearStorage() which may clear internal state before the redirect happens.
289
+ * Instead, we capture the logoutUrl and id_token first, then clear state,
290
+ * then manually redirect to the end_session_endpoint.
291
+ */
292
+ logout(): void;
293
+ /**
294
+ * Updates the redirect URIs without performing a full re-initialization.
295
+ * Use this when the OAuth session is already established and only the
296
+ * redirect targets need to change (e.g., when switching tenants).
297
+ */
298
+ updateRedirectUris(redirectUri: string, postLogoutRedirectUri: string): void;
299
+ /**
300
+ * Refreshes the access token and updates the allowed tenants signal.
301
+ * Call this after actions that change the user's tenant access (e.g., provisioning).
302
+ */
303
+ refreshAccessToken(): Promise<void>;
304
+ /**
305
+ * Initializes the authorization service with the specified options.
306
+ */
307
+ initialize(authorizeOptions: AuthorizeOptions): Promise<void>;
308
+ /**
309
+ * Wraps oauthService.loadDiscoveryDocumentAndTryLogin() with bounded
310
+ * exponential-backoff retries so a brief outage of the Identity service
311
+ * (cold start after redeploy, rolling restart, transient ingress 5xx)
312
+ * does not leave the SPA stuck on the loading icon.
313
+ *
314
+ * The CORS-error symptom seen on test-2 — "No 'Access-Control-Allow-Origin'
315
+ * header" against /.well-known/openid-configuration — is exactly such a
316
+ * transient failure: the ingress synthesises a default error page that
317
+ * does not carry the CORS headers, so the browser reports a CORS violation
318
+ * rather than the actual HTTP status. Retrying after the backend comes
319
+ * back resolves it without user interaction.
320
+ *
321
+ * Throws the last error if every attempt fails. The error is also stored
322
+ * in the discoveryDocumentError signal so callers can render a recovery UI.
323
+ */
324
+ private loadDiscoveryDocumentAndTryLoginWithRetry;
325
+ /**
326
+ * Uninitializes the authorization service.
327
+ */
328
+ uninitialize(): Promise<void>;
329
+ /**
330
+ * Drives the optional {@link SessionIdentitySink} from one place (AB#7327): the identity is derived from
331
+ * `_user` + `_tokenTenantId`, so every path that sets them (login, token refresh, in-place tenant switch,
332
+ * redirect fallback) and every path that clears them (logout, session_terminated, token_refresh_error,
333
+ * cross-tab logout, reset before a redirect switch) is covered without touching each one. Nothing is
334
+ * registered when the app provides no sink. A sink that throws never affects authentication.
335
+ */
336
+ private setUpSessionIdentity;
337
+ private loadUserAsync;
338
+ /**
339
+ * Decodes the JWT access token payload and extracts allowed_tenants claims.
340
+ * The claim can be a single string or an array of strings.
341
+ */
342
+ private deriveDisplayNameFromUsername;
343
+ private deriveInitials;
344
+ /**
345
+ * Reloads the page. This method is protected to allow mocking in tests.
346
+ * @internal
347
+ */
348
+ protected reloadPage(): void;
349
+ /**
350
+ * Navigates to the given URL via full page navigation.
351
+ * This method is protected to allow mocking in tests.
352
+ * @internal
353
+ */
354
+ protected navigateTo(url: string): void;
355
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthorizeService, never>;
356
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
356
357
  }
357
-
358
358
  /**
359
359
  * Tenant-aware OAuth storage that prefixes all keys with a tenant ID
360
360
  * and splits storage between localStorage and sessionStorage.
@@ -382,64 +382,63 @@ declare class AuthorizeService {
382
382
  * // Stored in: sessionStorage['maco__nonce'] = 'xyz' (per-tab!)
383
383
  * ```
384
384
  */
385
- declare class TenantAwareOAuthStorage extends OAuthStorage {
386
- private tenantId;
387
- /**
388
- * Sets the tenant ID used to prefix storage keys.
389
- * Must be called before the OAuthService reads/writes tokens.
390
- * The tenant ID is persisted in sessionStorage so it survives OAuth redirects.
391
- *
392
- * @param tenantId The tenant ID, or null for unprefixed (backwards-compatible) mode.
393
- */
394
- setTenantId(tenantId: string | null): void;
395
- /**
396
- * Returns the currently configured tenant ID.
397
- */
398
- getTenantId(): string | null;
399
- /**
400
- * Moves a session that was stored without a tenant prefix into this tenant's slot.
401
- *
402
- * A sign-in that starts without a tenant — the app let identity resolve it through tenant
403
- * discovery — completes before any storage tenant is known, so its tokens land unprefixed.
404
- * When the app then learns the tenant, from the URL or from the token itself, and sets it, the
405
- * prefixed slot would be empty and the OAuth library would treat the user as signed out, at
406
- * the cost of a silent round trip through identity. Adopting the session avoids that.
407
- *
408
- * Only a session that belongs to `tenantId` is adopted — the access token's `tenant_id`
409
- * claim must match — and only into an empty slot: if any OAuth key already exists under the
410
- * tenant's prefix, even a partial session, nothing is overwritten. Session-scoped keys (nonce,
411
- * PKCE verifier) belong to the finished flow and stay where they are. Apps that never set a
412
- * storage tenant are not affected.
413
- *
414
- * @returns true when a session was moved.
415
- */
416
- adoptUnprefixedSession(tenantId: string): boolean;
417
- /**
418
- * Restores the tenant ID from sessionStorage.
419
- * Call this on app startup when the tenant cannot be determined from the URL
420
- * (e.g., after an OAuth redirect to the root path).
421
- *
422
- * @returns The restored tenant ID, or null if none was persisted.
423
- */
424
- restoreTenantId(): string | null;
425
- /**
426
- * Returns the prefixed key for the given base key.
427
- * When tenantId is null, returns the base key unchanged.
428
- */
429
- prefixKey(key: string): string;
430
- getItem(key: string): string | null;
431
- removeItem(key: string): void;
432
- setItem(key: string, data: string): void;
433
- /**
434
- * Clears all OAuth-related keys for ALL tenants from both
435
- * localStorage and sessionStorage, while leaving non-OAuth data intact.
436
- *
437
- * Used during full logout to ensure no stale tokens remain for any tenant.
438
- */
439
- clearAllTenants(): void;
440
- private clearOAuthKeysFromStorage;
385
+ export declare class TenantAwareOAuthStorage extends OAuthStorage {
386
+ private tenantId;
387
+ /**
388
+ * Sets the tenant ID used to prefix storage keys.
389
+ * Must be called before the OAuthService reads/writes tokens.
390
+ * The tenant ID is persisted in sessionStorage so it survives OAuth redirects.
391
+ *
392
+ * @param tenantId The tenant ID, or null for unprefixed (backwards-compatible) mode.
393
+ */
394
+ setTenantId(tenantId: string | null): void;
395
+ /**
396
+ * Returns the currently configured tenant ID.
397
+ */
398
+ getTenantId(): string | null;
399
+ /**
400
+ * Moves a session that was stored without a tenant prefix into this tenant's slot.
401
+ *
402
+ * A sign-in that starts without a tenant — the app let identity resolve it through tenant
403
+ * discovery — completes before any storage tenant is known, so its tokens land unprefixed.
404
+ * When the app then learns the tenant, from the URL or from the token itself, and sets it, the
405
+ * prefixed slot would be empty and the OAuth library would treat the user as signed out, at
406
+ * the cost of a silent round trip through identity. Adopting the session avoids that.
407
+ *
408
+ * Only a session that belongs to `tenantId` is adopted — the access token's `tenant_id`
409
+ * claim must match — and only into an empty slot: if any OAuth key already exists under the
410
+ * tenant's prefix, even a partial session, nothing is overwritten. Session-scoped keys (nonce,
411
+ * PKCE verifier) belong to the finished flow and stay where they are. Apps that never set a
412
+ * storage tenant are not affected.
413
+ *
414
+ * @returns true when a session was moved.
415
+ */
416
+ adoptUnprefixedSession(tenantId: string): boolean;
417
+ /**
418
+ * Restores the tenant ID from sessionStorage.
419
+ * Call this on app startup when the tenant cannot be determined from the URL
420
+ * (e.g., after an OAuth redirect to the root path).
421
+ *
422
+ * @returns The restored tenant ID, or null if none was persisted.
423
+ */
424
+ restoreTenantId(): string | null;
425
+ /**
426
+ * Returns the prefixed key for the given base key.
427
+ * When tenantId is null, returns the base key unchanged.
428
+ */
429
+ prefixKey(key: string): string;
430
+ getItem(key: string): string | null;
431
+ removeItem(key: string): void;
432
+ setItem(key: string, data: string): void;
433
+ /**
434
+ * Clears all OAuth-related keys for ALL tenants from both
435
+ * localStorage and sessionStorage, while leaving non-OAuth data intact.
436
+ *
437
+ * Used during full logout to ensure no stale tokens remain for any tenant.
438
+ */
439
+ clearAllTenants(): void;
440
+ private clearOAuthKeysFromStorage;
441
441
  }
442
-
443
442
  /**
444
443
  * Minimal JWT payload access for the claims this library routes on: `tenant_id` and
445
444
  * `allowed_tenants`.
@@ -447,26 +446,25 @@ declare class TenantAwareOAuthStorage extends OAuthStorage {
447
446
  * Decoding only, no signature validation. The token was issued to this client by identity and
448
447
  * is used for client-side decisions the backend enforces again on every request.
449
448
  */
450
- declare function decodeJwtPayload(token: string | null | undefined): Record<string, unknown> | null;
449
+ export declare function decodeJwtPayload(token: string | null | undefined): Record<string, unknown> | null;
451
450
  /** The `tenant_id` claim: the tenant the token was issued for, or null. */
452
- declare function tenantIdFromToken(token: string | null | undefined): string | null;
451
+ export declare function tenantIdFromToken(token: string | null | undefined): string | null;
453
452
  /** The `allowed_tenants` claim as a list. A single-valued claim arrives as a plain string. */
454
- declare function allowedTenantsFromToken(token: string | null | undefined): string[];
455
-
453
+ export declare function allowedTenantsFromToken(token: string | null | undefined): string[];
456
454
  /**
457
455
  * Who is signed in and on which tenant — the identity an app may hand to its browser monitoring
458
456
  * (AB#7327). All fields are personal or tenant-scoped data; only an app that opted in by providing a
459
457
  * {@link SessionIdentitySink} ever receives them.
460
458
  */
461
459
  interface SessionIdentity {
462
- /** The `sub` claim of the signed-in user. */
463
- userId: string;
464
- /** Display/user name of the signed-in user, when the identity provider supplies one. */
465
- name: string | null;
466
- /** E-mail address of the signed-in user, when the identity provider supplies one. */
467
- email: string | null;
468
- /** Tenant the current access token was issued for (`tenant_id` claim); null when the token has none. */
469
- tenantId: string | null;
460
+ /** The `sub` claim of the signed-in user. */
461
+ userId: string;
462
+ /** Display/user name of the signed-in user, when the identity provider supplies one. */
463
+ name: string | null;
464
+ /** E-mail address of the signed-in user, when the identity provider supplies one. */
465
+ email: string | null;
466
+ /** Tenant the current access token was issued for (`tenant_id` claim); null when the token has none. */
467
+ tenantId: string | null;
470
468
  }
471
469
  /**
472
470
  * Receiver of the session identity. `AuthorizeService` calls `set` after sign-in and after every tenant
@@ -474,15 +472,14 @@ interface SessionIdentity {
474
472
  * and synchronous; any exception they throw is caught and logged by the service and never reaches auth.
475
473
  */
476
474
  interface SessionIdentitySink {
477
- set(identity: SessionIdentity): void;
478
- clear(): void;
475
+ set(identity: SessionIdentity): void;
476
+ clear(): void;
479
477
  }
480
478
  /**
481
479
  * Optional DI token. Apps that provide it get their sink driven by `AuthorizeService`; apps that do not
482
480
  * see no behaviour change at all. See `provideDash0SessionIdentity()` in `@meshmakers/shared-auth/dash0`.
483
481
  */
484
- declare const SESSION_IDENTITY_SINK: InjectionToken<SessionIdentitySink>;
485
-
482
+ export declare const SESSION_IDENTITY_SINK: InjectionToken<SessionIdentitySink>;
486
483
  /**
487
484
  * Functional HTTP interceptor that adds Bearer token to authorized requests
488
485
  * and injects tenant context (acr_values) into token endpoint requests.
@@ -515,8 +512,7 @@ declare const SESSION_IDENTITY_SINK: InjectionToken<SessionIdentitySink>;
515
512
  * };
516
513
  * ```
517
514
  */
518
- declare const authorizeInterceptor: HttpInterceptorFn;
519
-
515
+ export declare const authorizeInterceptor: HttpInterceptorFn;
520
516
  /**
521
517
  * The two ways a server refuses an authenticated call: the caller is not signed in any more,
522
518
  * or is signed in without the role the route requires.
@@ -544,14 +540,13 @@ type AuthorizationRefusal = 'unauthorized' | 'forbidden';
544
540
  * }
545
541
  * ```
546
542
  */
547
- declare function authorizationRefusal(error: unknown): AuthorizationRefusal | null;
548
-
543
+ export declare function authorizationRefusal(error: unknown): AuthorizationRefusal | null;
549
544
  /**
550
545
  * Path segment of the blocking route a host registers as `/:tenantId/tenant-mismatch`. The guard
551
546
  * redirects there when the token still belongs to another tenant than the route after the switch
552
547
  * attempt (AB#6731); render {@link TenantMismatchComponent} on it.
553
548
  */
554
- declare const TENANT_MISMATCH_PATH = "tenant-mismatch";
549
+ export declare const TENANT_MISMATCH_PATH = "tenant-mismatch";
555
550
  /**
556
551
  * Handles authorization check for route activation.
557
552
  * Redirects to login if not authenticated, or to home if user lacks required roles.
@@ -569,7 +564,7 @@ declare const TENANT_MISMATCH_PATH = "tenant-mismatch";
569
564
  * { path: 'admin', component: AdminComponent, canActivate: [authorizeGuard], data: { roles: ['AdminPanelManagement'] } }
570
565
  * ```
571
566
  */
572
- declare const authorizeGuard: CanActivateFn;
567
+ export declare const authorizeGuard: CanActivateFn;
573
568
  /**
574
569
  * Guard for child routes. Delegates to authorizeGuard.
575
570
  *
@@ -584,7 +579,7 @@ declare const authorizeGuard: CanActivateFn;
584
579
  * }
585
580
  * ```
586
581
  */
587
- declare const authorizeChildGuard: CanActivateFn;
582
+ export declare const authorizeChildGuard: CanActivateFn;
588
583
  /**
589
584
  * Guard for lazy-loaded routes. Checks if user is authenticated.
590
585
  * Replaces the deprecated canLoad guard.
@@ -598,7 +593,7 @@ declare const authorizeChildGuard: CanActivateFn;
598
593
  * }
599
594
  * ```
600
595
  */
601
- declare const authorizeMatchGuard: CanMatchFn;
596
+ export declare const authorizeMatchGuard: CanMatchFn;
602
597
  /**
603
598
  * Guard that always allows deactivation.
604
599
  * Use this as a placeholder or override in specific routes.
@@ -608,8 +603,7 @@ declare const authorizeMatchGuard: CanMatchFn;
608
603
  * { path: 'form', component: FormComponent, canDeactivate: [authorizeDeactivateGuard] }
609
604
  * ```
610
605
  */
611
- declare const authorizeDeactivateGuard: () => boolean;
612
-
606
+ export declare const authorizeDeactivateGuard: () => boolean;
613
607
  /**
614
608
  * Blocking screen shown when the signed-in token belongs to another tenant than the route
615
609
  * (AB#6731). Hosts register it on `/:tenantId/tenant-mismatch` ({@link TENANT_MISMATCH_PATH});
@@ -621,21 +615,20 @@ declare const authorizeDeactivateGuard: () => boolean;
621
615
  * - After that retry the mismatch is final: "not a member, contact your administrator" and only
622
616
  * the way back to a usable tenant remains. There is never an automatic redirect.
623
617
  */
624
- declare class TenantMismatchComponent {
625
- private readonly authorizeService;
626
- private readonly route;
627
- protected readonly routeTenantId: _angular_core.Signal<string>;
628
- protected readonly tokenTenantId: _angular_core.Signal<string | null>;
629
- protected readonly signInButton: _angular_core.Signal<ElementRef<HTMLButtonElement> | undefined>;
630
- protected readonly signedInAs: _angular_core.Signal<string>;
631
- protected readonly retried: _angular_core.Signal<boolean>;
632
- protected readonly otherTenants: _angular_core.Signal<string[]>;
633
- constructor();
634
- protected signIn(): void;
635
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<TenantMismatchComponent, never>;
636
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<TenantMismatchComponent, "mm-tenant-mismatch", never, {}, {}, never, never, true, never>;
618
+ export declare class TenantMismatchComponent {
619
+ private readonly authorizeService;
620
+ private readonly route;
621
+ protected readonly routeTenantId: import("@angular/core").Signal<string>;
622
+ protected readonly tokenTenantId: import("@angular/core").Signal<string | null>;
623
+ protected readonly signInButton: import("@angular/core").Signal<ElementRef<HTMLButtonElement> | undefined>;
624
+ protected readonly signedInAs: import("@angular/core").Signal<string>;
625
+ protected readonly retried: import("@angular/core").Signal<boolean>;
626
+ protected readonly otherTenants: import("@angular/core").Signal<string[]>;
627
+ constructor();
628
+ protected signIn(): void;
629
+ static ɵfac: i0.ɵɵFactoryDeclaration<TenantMismatchComponent, never>;
630
+ static ɵcmp: i0.ɵɵComponentDeclaration<TenantMismatchComponent, "mm-tenant-mismatch", never, {}, {}, never, never, true, never>;
637
631
  }
638
-
639
632
  /**
640
633
  * Types, pure helpers and test helpers for the identity tenant-topology endpoint
641
634
  * `GET {issuer}/api/tenant-topology?scope={rootTenantId}` (AB#7044, client AB#7053).
@@ -644,11 +637,11 @@ declare class TenantMismatchComponent {
644
637
  */
645
638
  /** One tenant below the scope that the signed-in user may use. */
646
639
  interface TenantTopologyNode {
647
- readonly tenantId: string;
648
- /** 1 = direct child of the scope. */
649
- readonly depth: number;
650
- /** The tenant itself has children (they are not listed). */
651
- readonly hasChildren: boolean;
640
+ readonly tenantId: string;
641
+ /** 1 = direct child of the scope. */
642
+ readonly depth: number;
643
+ /** The tenant itself has children (they are not listed). */
644
+ readonly hasChildren: boolean;
652
645
  }
653
646
  /**
654
647
  * Why the topology is unknown. An app maps every one of them to the same degraded mode
@@ -664,33 +657,32 @@ interface TenantTopologyNode {
664
657
  */
665
658
  type TenantTopologyUnknownReason = 'identity-too-old' | 'hierarchy-unreadable' | 'unauthorized' | 'network' | 'rate-limited' | 'invalid-response' | 'not-configured';
666
659
  interface KnownTenantTopology {
667
- readonly topologyKnown: true;
668
- readonly scope: string;
669
- readonly scopeHasChildren: boolean;
670
- readonly tenants: readonly TenantTopologyNode[];
660
+ readonly topologyKnown: true;
661
+ readonly scope: string;
662
+ readonly scopeHasChildren: boolean;
663
+ readonly tenants: readonly TenantTopologyNode[];
671
664
  }
672
665
  interface UnknownTenantTopology {
673
- readonly topologyKnown: false;
674
- readonly reason: TenantTopologyUnknownReason;
675
- readonly tenants: readonly [];
676
- readonly scopeHasChildren: null;
666
+ readonly topologyKnown: false;
667
+ readonly reason: TenantTopologyUnknownReason;
668
+ readonly tenants: readonly [];
669
+ readonly scopeHasChildren: null;
677
670
  }
678
671
  /** Result of `TenantTopologyService.load`. Discriminate on `topologyKnown`. */
679
672
  type TenantTopologyResult = KnownTenantTopology | UnknownTenantTopology;
680
673
  /** Tenants without children of their own: the ones an app can work in. Empty when unknown. */
681
- declare function topologyLeaves(result: TenantTopologyResult): readonly TenantTopologyNode[];
674
+ export declare function topologyLeaves(result: TenantTopologyResult): readonly TenantTopologyNode[];
682
675
  /** Direct children of the scope (depth 1). Empty when unknown. */
683
- declare function topologyDirectChildren(result: TenantTopologyResult): readonly TenantTopologyNode[];
676
+ export declare function topologyDirectChildren(result: TenantTopologyResult): readonly TenantTopologyNode[];
684
677
  /** All tenant ids of the result. Empty when unknown. */
685
- declare function topologyTenantIds(result: TenantTopologyResult): readonly string[];
678
+ export declare function topologyTenantIds(result: TenantTopologyResult): readonly string[];
686
679
  /** Test helper for app specs: a known topology. */
687
- declare function knownTopology(scope: string, nodes: readonly TenantTopologyNode[], scopeHasChildren?: boolean): KnownTenantTopology;
680
+ export declare function knownTopology(scope: string, nodes: readonly TenantTopologyNode[], scopeHasChildren?: boolean): KnownTenantTopology;
688
681
  /** Test helper for app specs: an unknown topology with the given reason. */
689
- declare function unknownTopology(reason: TenantTopologyUnknownReason): UnknownTenantTopology;
690
-
682
+ export declare function unknownTopology(reason: TenantTopologyUnknownReason): UnknownTenantTopology;
691
683
  interface TenantTopologyLoadOptions {
692
- /** Bypass the session cache and ask identity again. */
693
- readonly refresh?: boolean;
684
+ /** Bypass the session cache and ask identity again. */
685
+ readonly refresh?: boolean;
694
686
  }
695
687
  /**
696
688
  * Asks identity which of the signed-in user's tenants lie below an app's root tenant (AB#7053,
@@ -705,33 +697,32 @@ interface TenantTopologyLoadOptions {
705
697
  * host need not list the identity URL in `wellKnownServiceUris`, the header is never duplicated, and
706
698
  * no interceptor refresh or retry can send a second request.
707
699
  */
708
- declare class TenantTopologyService {
709
- private readonly authorizeService;
710
- private readonly http;
711
- private readonly cache;
712
- private readonly inFlight;
713
- /** Bumped on sign-out; a response that started in an older generation is not stored. */
714
- private generation;
715
- constructor();
716
- /**
717
- * Loads the topology below `scope` (the app's root tenant). Never throws, never rejects.
718
- *
719
- * Successful results and `identity-too-old` are cached for the session per scope (case-insensitive)
720
- * and per token tenant + `allowed_tenants`; concurrent calls share one request. Other unknown
721
- * results are not cached.
722
- */
723
- load(scope: string, options?: TenantTopologyLoadOptions): Promise<TenantTopologyResult>;
724
- /** Drops all cached results (sign-out does this automatically). */
725
- clearCache(): void;
726
- private loadCore;
727
- private fetch;
728
- private unknown;
729
- private isCacheable;
730
- private cacheKey;
731
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<TenantTopologyService, never>;
732
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<TenantTopologyService>;
700
+ export declare class TenantTopologyService {
701
+ private readonly authorizeService;
702
+ private readonly http;
703
+ private readonly cache;
704
+ private readonly inFlight;
705
+ /** Bumped on sign-out; a response that started in an older generation is not stored. */
706
+ private generation;
707
+ constructor();
708
+ /**
709
+ * Loads the topology below `scope` (the app's root tenant). Never throws, never rejects.
710
+ *
711
+ * Successful results and `identity-too-old` are cached for the session per scope (case-insensitive)
712
+ * and per token tenant + `allowed_tenants`; concurrent calls share one request. Other unknown
713
+ * results are not cached.
714
+ */
715
+ load(scope: string, options?: TenantTopologyLoadOptions): Promise<TenantTopologyResult>;
716
+ /** Drops all cached results (sign-out does this automatically). */
717
+ clearCache(): void;
718
+ private loadCore;
719
+ private fetch;
720
+ private unknown;
721
+ private isCacheable;
722
+ private cacheKey;
723
+ static ɵfac: i0.ɵɵFactoryDeclaration<TenantTopologyService, never>;
724
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
733
725
  }
734
-
735
726
  /**
736
727
  * Provides all shared-auth dependencies.
737
728
  *
@@ -754,7 +745,5 @@ declare class TenantTopologyService {
754
745
  * Functional guards and interceptors don't need to be provided - they use inject() internally.
755
746
  * For the functional interceptor, use `provideHttpClient(withInterceptors([authorizeInterceptor]))`.
756
747
  */
757
- declare function provideMmSharedAuth(): EnvironmentProviders;
758
-
759
- export { AuthorizeOptions, AuthorizeService, Roles, SESSION_IDENTITY_SINK, TENANT_MISMATCH_PATH, TenantAwareOAuthStorage, TenantMismatchComponent, TenantTopologyService, allowedTenantsFromToken, authorizationRefusal, authorizeChildGuard, authorizeDeactivateGuard, authorizeGuard, authorizeInterceptor, authorizeMatchGuard, decodeJwtPayload, knownTopology, provideMmSharedAuth, tenantIdFromToken, topologyDirectChildren, topologyLeaves, topologyTenantIds, unknownTopology };
760
- export type { AuthorizationRefusal, DiscoveryDocumentRetryOptions, IUser, KnownTenantTopology, SessionIdentity, SessionIdentitySink, TenantTopologyLoadOptions, TenantTopologyNode, TenantTopologyResult, TenantTopologyUnknownReason, UnknownTenantTopology };
748
+ export declare function provideMmSharedAuth(): EnvironmentProviders;
749
+ export type { AuthorizationRefusal, KnownTenantTopology, SessionIdentity, SessionIdentitySink, TenantTopologyLoadOptions, TenantTopologyNode, TenantTopologyResult, TenantTopologyUnknownReason, UnknownTenantTopology };