@dereekb/firebase-server 13.12.8 → 13.13.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.
Files changed (31) hide show
  1. package/mailgun/package.json +9 -9
  2. package/mcp/index.cjs.js +3 -3
  3. package/mcp/index.esm.js +3 -3
  4. package/mcp/package.json +11 -11
  5. package/model/index.cjs.js +209 -0
  6. package/model/index.esm.js +208 -2
  7. package/model/package.json +9 -9
  8. package/model/src/lib/storagefile/storagefile.action.server.d.ts +61 -1
  9. package/oidc/index.cjs.js +1025 -283
  10. package/oidc/index.esm.js +1016 -285
  11. package/oidc/package.json +10 -10
  12. package/oidc/src/lib/controller/oidc.interaction.controller.d.ts +4 -1
  13. package/oidc/src/lib/controller/oidc.provider.controller.d.ts +17 -0
  14. package/oidc/src/lib/oidc.config.d.ts +60 -0
  15. package/oidc/src/lib/service/analytics/index.d.ts +4 -0
  16. package/oidc/src/lib/service/analytics/oidc.analytics.config.d.ts +46 -0
  17. package/oidc/src/lib/service/analytics/oidc.analytics.handler.d.ts +116 -0
  18. package/oidc/src/lib/service/analytics/oidc.analytics.module.d.ts +35 -0
  19. package/oidc/src/lib/service/analytics/oidc.analytics.service.d.ts +23 -0
  20. package/oidc/src/lib/service/index.d.ts +1 -0
  21. package/oidc/src/lib/service/oidc.account.service.d.ts +15 -0
  22. package/oidc/src/lib/service/oidc.client.service.d.ts +4 -0
  23. package/oidc/src/lib/service/oidc.interaction.service.d.ts +2 -2
  24. package/oidc/src/lib/service/oidc.service.d.ts +23 -1
  25. package/oidc/src/lib/service/oidc.session-ttl.d.ts +114 -0
  26. package/package.json +10 -10
  27. package/test/index.cjs.js +11 -3
  28. package/test/index.esm.js +11 -3
  29. package/test/package.json +11 -11
  30. package/twilio/package.json +8 -8
  31. package/zoho/package.json +9 -9
package/oidc/index.esm.js CHANGED
@@ -4,7 +4,7 @@ import { SECONDS_IN_MINUTE, SECONDS_IN_DAY, cachedGetter, unixDateTimeSecondsNum
4
4
  import { generateKeyPairSync, randomBytes } from 'node:crypto';
5
5
  import { resolveEncryptionKey, encryptValue, decryptValue, createAesStringEncryptionProvider, isValidAES256GCMEncryptionSecret } from '@dereekb/nestjs';
6
6
  import { where, iterateFirestoreDocumentSnapshotPairs, firestoreModelIdentity, snapshotConverterFunctions, optionalFirestoreDate, firestoreDate, firestoreEnum, firestorePassThroughField, AbstractFirestoreDocument, createOidcClientParamsType, deleteOidcClientParamsType, deleteOidcTokenParamsType, rotateOidcClientSecretParamsType, updateOidcClientParamsType, firestoreModelKey, oidcEntryIdentity, PUBLIC_PKCE_TOKEN_ENDPOINT_AUTH_METHOD, OIDC_ENTRY_CLIENT_TYPE, oidcEntriesByUserCodeQuery, oidcEntriesByUidQuery, oidcEntriesByGrantIdQuery, oidcEntryFirestoreCollection, callModelOidcScopeForCallType, CALL_MODEL_MISSING_OIDC_SCOPE_ERROR_CODE } from '@dereekb/firebase';
7
- import { firestoreEncryptedField, firebaseServerActionsContext, FirebaseServerEnvService, FIREBASE_FIRESTORE_CONTEXT_TOKEN, FirebaseServerFirestoreContextModule, forbiddenError } from '@dereekb/firebase-server';
7
+ import { firestoreEncryptedField, firebaseServerActionsContext, FirebaseServerEnvService, FirebaseServerAnalyticsService, FIREBASE_FIRESTORE_CONTEXT_TOKEN, FirebaseServerFirestoreContextModule, forbiddenError } from '@dereekb/firebase-server';
8
8
  import { nanoid } from 'nanoid';
9
9
  import { safeToJsDate } from '@dereekb/date';
10
10
  import { makeUrlSearchParamsString } from '@dereekb/util/fetch';
@@ -27,13 +27,13 @@ import { ConfigService, ConfigModule } from '@nestjs/config';
27
27
  return req.auth;
28
28
  });
29
29
 
30
- function _type_of$1(obj) {
30
+ function _type_of$2(obj) {
31
31
  "@swc/helpers - typeof";
32
32
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
33
33
  }
34
34
  function __decorate(decorators, target, key, desc) {
35
35
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
36
- if ((typeof Reflect === "undefined" ? "undefined" : _type_of$1(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
36
+ if ((typeof Reflect === "undefined" ? "undefined" : _type_of$2(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
37
37
  else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
38
38
  return c > 3 && r && Object.defineProperty(target, key, r), r;
39
39
  }
@@ -47,12 +47,12 @@ typeof SuppressedError === "function" ? SuppressedError : function(error, suppre
47
47
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
48
48
  };
49
49
 
50
- function _class_call_check$g(instance, Constructor) {
50
+ function _class_call_check$i(instance, Constructor) {
51
51
  if (!(instance instanceof Constructor)) {
52
52
  throw new TypeError("Cannot call a class as a function");
53
53
  }
54
54
  }
55
- function _defineProperties$d(target, props) {
55
+ function _defineProperties$e(target, props) {
56
56
  for(var i = 0; i < props.length; i++){
57
57
  var descriptor = props[i];
58
58
  descriptor.enumerable = descriptor.enumerable || false;
@@ -61,11 +61,11 @@ function _defineProperties$d(target, props) {
61
61
  Object.defineProperty(target, descriptor.key, descriptor);
62
62
  }
63
63
  }
64
- function _create_class$d(Constructor, protoProps, staticProps) {
65
- if (staticProps) _defineProperties$d(Constructor, staticProps);
64
+ function _create_class$e(Constructor, protoProps, staticProps) {
65
+ if (staticProps) _defineProperties$e(Constructor, staticProps);
66
66
  return Constructor;
67
67
  }
68
- function _define_property$f(obj, key, value) {
68
+ function _define_property$g(obj, key, value) {
69
69
  if (key in obj) {
70
70
  Object.defineProperty(obj, key, {
71
71
  value: value,
@@ -109,6 +109,23 @@ function _define_property$f(obj, key, value) {
109
109
  /**
110
110
  * Default global floor for a client-requested login duration, in seconds. 1 hour.
111
111
  */ var DEFAULT_MIN_REQUESTED_LOGIN_DURATION_SECONDS = 60 * SECONDS_IN_MINUTE;
112
+ /**
113
+ * Default ceiling (seconds) on a login duration for a non-admin user. 45 days.
114
+ *
115
+ * Tier 1 of the tiered ceiling resolved by `resolveTieredServerMaxSeconds`.
116
+ */ var DEFAULT_MAX_NONADMIN_LOGIN_DURATION_SECONDS = 45 * SECONDS_IN_DAY;
117
+ /**
118
+ * Default ceiling (seconds) on a normal (non-service-token) login duration for an admin user. 90 days.
119
+ *
120
+ * Tier 2 of the tiered ceiling resolved by `resolveTieredServerMaxSeconds`.
121
+ */ var DEFAULT_MAX_ADMIN_LOGIN_DURATION_SECONDS = 90 * SECONDS_IN_DAY;
122
+ /**
123
+ * Default ceiling (seconds) on a login duration carrying an admin-only service-token scope. 365 days.
124
+ *
125
+ * Tier 3 of the tiered ceiling resolved by `resolveTieredServerMaxSeconds`. Also matches
126
+ * node-oidc-provider's absolute refresh-token rotation cap (`totalLifetime >= 365.25d`), so a
127
+ * service token issued at this ceiling never rotates.
128
+ */ var DEFAULT_MAX_SERVICE_TOKEN_LOGIN_DURATION_SECONDS = 365 * SECONDS_IN_DAY;
112
129
  /**
113
130
  * Default token lifetimes: 15 min access tokens, 30-day refresh tokens, 30-day sessions/grants, 60 s auth codes.
114
131
  */ var DEFAULT_OIDC_TOKEN_LIFETIMES = {
@@ -126,32 +143,32 @@ function _define_property$f(obj, key, value) {
126
143
  * Used as an abstract class so it can serve as both a type and a NestJS DI token.
127
144
  */ var OidcModuleConfig = /*#__PURE__*/ function() {
128
145
  function OidcModuleConfig() {
129
- _class_call_check$g(this, OidcModuleConfig);
146
+ _class_call_check$i(this, OidcModuleConfig);
130
147
  /**
131
148
  * The OIDC issuer URL (e.g., 'https://accounts.example.com').
132
149
  * Must be the canonical URL where the OIDC provider is accessible.
133
- */ _define_property$f(this, "issuer", void 0);
150
+ */ _define_property$g(this, "issuer", void 0);
134
151
  /**
135
152
  * The path prefix used for OIDC interaction endpoints (login/consent).
136
153
  *
137
154
  * Appended to the base appUrl this is the base frontend interaction path.
138
155
  *
139
156
  * Defaults to '/oauth'.
140
- */ _define_property$f(this, "appOAuthInteractionPath", void 0);
157
+ */ _define_property$g(this, "appOAuthInteractionPath", void 0);
141
158
  /**
142
159
  * Frontend URL for the login interaction page.
143
160
  * The interaction uid will be appended as a query parameter.
144
161
  *
145
162
  * Defaults to `<appOAuthInteractionPath>/login`.
146
- */ _define_property$f(this, "appOAuthLoginUrlPart", void 0);
163
+ */ _define_property$g(this, "appOAuthLoginUrlPart", void 0);
147
164
  /**
148
165
  * Frontend URL for the consent interaction page.
149
166
  *
150
167
  * Defaults to `<appOAuthInteractionPath>/consent`.
151
- */ _define_property$f(this, "appOAuthConsentUrlPart", void 0);
168
+ */ _define_property$g(this, "appOAuthConsentUrlPart", void 0);
152
169
  /**
153
170
  * Token lifetime configuration.
154
- */ _define_property$f(this, "tokenLifetimes", void 0);
171
+ */ _define_property$g(this, "tokenLifetimes", void 0);
155
172
  /**
156
173
  * Maximum login duration (seconds) a client may request via the `dbx_session_ttl` auth-URL param.
157
174
  *
@@ -160,24 +177,43 @@ function _define_property$f(obj, key, value) {
160
177
  * `min(client.dbx_max_session_ttl, this)`.
161
178
  *
162
179
  * Defaults to {@link DEFAULT_MAX_REQUESTED_LOGIN_DURATION_SECONDS} (90 days).
163
- */ _define_property$f(this, "maxRequestedLoginDuration", void 0);
180
+ */ _define_property$g(this, "maxRequestedLoginDuration", void 0);
164
181
  /**
165
182
  * Minimum login duration (seconds) a client may request via the `dbx_session_ttl` auth-URL param.
166
183
  *
167
184
  * Requested values below this floor are clamped up. Prevents pathological 30-second sessions.
168
185
  *
169
186
  * Defaults to {@link DEFAULT_MIN_REQUESTED_LOGIN_DURATION_SECONDS} (1 hour).
170
- */ _define_property$f(this, "minRequestedLoginDuration", void 0);
187
+ */ _define_property$g(this, "minRequestedLoginDuration", void 0);
171
188
  /**
172
189
  * Default login duration (seconds) used when a client does NOT pass the `dbx_session_ttl`
173
190
  * auth-URL param. When undefined, falls back to {@link OidcTokenLifetimes.refreshToken}.
174
- */ _define_property$f(this, "defaultRequestedLoginDuration", void 0);
191
+ */ _define_property$g(this, "defaultRequestedLoginDuration", void 0);
192
+ /**
193
+ * Tiered ceiling (seconds) on the requested login duration for a non-admin user.
194
+ *
195
+ * Used by `resolveTieredServerMaxSeconds` when the resolving user is not an admin; the resolved
196
+ * tier value is used as the `serverMaxSeconds` ceiling (it replaces the flat
197
+ * {@link maxRequestedLoginDuration}, since service-token tokens intentionally exceed it).
198
+ *
199
+ * Defaults to {@link DEFAULT_MAX_NONADMIN_LOGIN_DURATION_SECONDS} (45 days).
200
+ */ _define_property$g(this, "maxRequestedLoginDurationNonAdmin", void 0);
201
+ /**
202
+ * Tiered ceiling (seconds) on a normal (non-service-token) requested login duration for an admin user.
203
+ *
204
+ * Defaults to {@link DEFAULT_MAX_ADMIN_LOGIN_DURATION_SECONDS} (90 days).
205
+ */ _define_property$g(this, "maxRequestedLoginDurationAdmin", void 0);
206
+ /**
207
+ * Tiered ceiling (seconds) on a requested login duration carrying an admin-only service-token scope.
208
+ *
209
+ * Defaults to {@link DEFAULT_MAX_SERVICE_TOKEN_LOGIN_DURATION_SECONDS} (365 days).
210
+ */ _define_property$g(this, "maxRequestedLoginDurationServiceToken", void 0);
175
211
  /**
176
212
  * JWKS service configuration (encryption secret, rotated key max age).
177
- */ _define_property$f(this, "jwksServiceConfig", void 0);
213
+ */ _define_property$g(this, "jwksServiceConfig", void 0);
178
214
  /**
179
215
  * JWKS key converter configuration (encryption secret for Firestore field encryption).
180
- */ _define_property$f(this, "jwksKeyConverterConfig", void 0);
216
+ */ _define_property$g(this, "jwksKeyConverterConfig", void 0);
181
217
  /**
182
218
  * Custom error rendering function for the oidc-provider.
183
219
  *
@@ -187,7 +223,7 @@ function _define_property$f(obj, key, value) {
187
223
  * errors are presented (e.g. redirect to an error page).
188
224
  *
189
225
  * The function signature matches oidc-provider's `renderError` configuration option.
190
- */ _define_property$f(this, "renderError", void 0);
226
+ */ _define_property$g(this, "renderError", void 0);
191
227
  /**
192
228
  * Whether to suppress the oidc-provider "already parsed request body" warning.
193
229
  *
@@ -196,7 +232,7 @@ function _define_property$f(obj, key, value) {
196
232
  * this correctly by falling back to `req.body`, but emits a one-time warning.
197
233
  *
198
234
  * Defaults to `false`.
199
- */ _define_property$f(this, "suppressBodyParserWarning", void 0);
235
+ */ _define_property$g(this, "suppressBodyParserWarning", void 0);
200
236
  /**
201
237
  * Path prefixes that require OAuth bearer token verification.
202
238
  *
@@ -206,7 +242,7 @@ function _define_property$f(obj, key, value) {
206
242
  *
207
243
  * Paths under the global API route prefix should not be included
208
244
  * since those are typically protected by AppCheck.
209
- */ _define_property$f(this, "protectedPaths", void 0);
245
+ */ _define_property$g(this, "protectedPaths", void 0);
210
246
  /**
211
247
  * Map of recognized OAuth resource indicator URLs (RFC 8707) to their
212
248
  * {@link OidcResourceServerInfo}. When non-empty, oidc-provider's
@@ -228,7 +264,7 @@ function _define_property$f(obj, key, value) {
228
264
  * }
229
265
  * }
230
266
  * ```
231
- */ _define_property$f(this, "resourceServers", void 0);
267
+ */ _define_property$g(this, "resourceServers", void 0);
232
268
  /**
233
269
  * When `true`, {@link oidcModuleMetadata} automatically derives a resource-server
234
270
  * entry from `envService.appMcpUrl` and the registered {@link OidcAccountService}'s
@@ -244,7 +280,7 @@ function _define_property$f(obj, key, value) {
244
280
  * Defaults to `false`.
245
281
  *
246
282
  * @see buildFirebaseServerMcpResourceServer
247
- */ _define_property$f(this, "configureMcpResourceServer", void 0);
283
+ */ _define_property$g(this, "configureMcpResourceServer", void 0);
248
284
  /**
249
285
  * Absolute URL of the OAuth 2.0 Protected Resource Metadata document
250
286
  * (RFC 9728) for the resources guarded by {@link protectedPaths}.
@@ -262,7 +298,7 @@ function _define_property$f(obj, key, value) {
262
298
  *
263
299
  * @example
264
300
  * resourceMetadataUrl: 'http://localhost:9902/dereekb-components/us-central1/api/.well-known/oauth-protected-resource'
265
- */ _define_property$f(this, "resourceMetadataUrl", void 0);
301
+ */ _define_property$g(this, "resourceMetadataUrl", void 0);
266
302
  /**
267
303
  * Supported token endpoint authentication methods.
268
304
  *
@@ -270,7 +306,7 @@ function _define_property$f(obj, key, value) {
270
306
  * in the discovery metadata document.
271
307
  *
272
308
  * @see DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS
273
- */ _define_property$f(this, "tokenEndpointAuthMethods", void 0);
309
+ */ _define_property$g(this, "tokenEndpointAuthMethods", void 0);
274
310
  /**
275
311
  * Whether to enable the OIDC dynamic client registration endpoint (`/reg`).
276
312
  *
@@ -278,7 +314,7 @@ function _define_property$f(obj, key, value) {
278
314
  * and manage their registrations via the registration management feature.
279
315
  *
280
316
  * Defaults to `false`.
281
- */ _define_property$f(this, "registrationEnabled", void 0);
317
+ */ _define_property$g(this, "registrationEnabled", void 0);
282
318
  /**
283
319
  * Whether the oidc-provider should trust upstream proxy headers
284
320
  * (`X-Forwarded-Host`, `X-Forwarded-Proto`) when computing the request URL
@@ -297,7 +333,7 @@ function _define_property$f(obj, key, value) {
297
333
  * (which is the Koa `app.proxy` setting).
298
334
  *
299
335
  * Defaults to `'prod_only'` if the environment is `production`, otherwise `false`.
300
- */ _define_property$f(this, "trustProxy", void 0);
336
+ */ _define_property$g(this, "trustProxy", void 0);
301
337
  /**
302
338
  * Whether to trust proxy headers in a non-production environment, such as the local environment.
303
339
  *
@@ -305,9 +341,9 @@ function _define_property$f(obj, key, value) {
305
341
  * `true` will result in errors.
306
342
  *
307
343
  * Defaults to `false`.
308
- */ _define_property$f(this, "trustProxyInNonProduction", void 0);
344
+ */ _define_property$g(this, "trustProxyInNonProduction", void 0);
309
345
  }
310
- _create_class$d(OidcModuleConfig, null, [
346
+ _create_class$e(OidcModuleConfig, null, [
311
347
  {
312
348
  key: "assertValidConfig",
313
349
  value: /**
@@ -351,6 +387,17 @@ function _define_property$f(obj, key, value) {
351
387
  /**
352
388
  * Custom oidc-provider client metadata field for a client's maximum requestable login duration (seconds).
353
389
  */ var DBX_FIREBASE_SERVER_OIDC_MAX_SESSION_TTL_CLIENT_METADATA = 'dbx_max_session_ttl';
390
+ /**
391
+ * Access-token `extra` claim carrying the grant's resolved expiry as unix seconds.
392
+ *
393
+ * Baked on at issuance (`extraTokenClaims`) and read back by `verifyAccessToken` and the
394
+ * `GET /oidc/session` route so clients can surface the session lifetime without decoding the token.
395
+ */ var DBX_FIREBASE_SERVER_OIDC_SESSION_EXPIRES_AT_CLAIM = 'dbx_session_expires_at';
396
+ /**
397
+ * Access-token `extra` claim flagging whether the grant's refresh token rotation is disabled.
398
+ *
399
+ * `true` when the token's scope set intersects {@link OidcProviderConfig.nonRotatingScopes}.
400
+ */ var DBX_FIREBASE_SERVER_OIDC_ROTATION_DISABLED_CLAIM = 'dbx_rotation_disabled';
354
401
  /**
355
402
  * Clamps a requested login duration into the allowed range.
356
403
  *
@@ -378,6 +425,77 @@ function _define_property$f(obj, key, value) {
378
425
  var ceiling = Math.min(input.serverMaxSeconds, (_input_clientMaxSeconds = input.clientMaxSeconds) !== null && _input_clientMaxSeconds !== void 0 ? _input_clientMaxSeconds : Infinity);
379
426
  return Math.max(input.serverMinSeconds, Math.min(raw, ceiling));
380
427
  }
428
+ /**
429
+ * Resolves the tiered server-max ceiling (seconds) used as `serverMaxSeconds` for a login duration.
430
+ *
431
+ * Tiers, highest to lowest priority:
432
+ * 1. Admin + service-token scope → `serviceTokenMax`.
433
+ * 2. Admin (normal) → `adminMax`.
434
+ * 3. Non-admin → `nonAdminMax`.
435
+ *
436
+ * A non-admin should never reach the service-token branch — the consent flow hard-rejects a
437
+ * non-admin requesting a service-token scope before this resolves — but the tiering is defensive:
438
+ * a non-admin always resolves to `nonAdminMax` regardless of `hasServiceScope`.
439
+ *
440
+ * @param input - The tier inputs (admin flag, service-scope flag, and the three tier ceilings).
441
+ * @returns The resolved ceiling in seconds.
442
+ */ function resolveTieredServerMaxSeconds(input) {
443
+ var isAdmin = input.isAdmin, hasServiceScope = input.hasServiceScope, nonAdminMax = input.nonAdminMax, adminMax = input.adminMax, serviceTokenMax = input.serviceTokenMax;
444
+ var result;
445
+ if (!isAdmin) {
446
+ result = nonAdminMax;
447
+ } else if (hasServiceScope) {
448
+ result = serviceTokenMax;
449
+ } else {
450
+ result = adminMax;
451
+ }
452
+ return result;
453
+ }
454
+ // MARK: Refresh token rotation
455
+ /**
456
+ * Absolute cap (seconds) on how long a refresh token may be rotated, after which its TTL is final.
457
+ *
458
+ * Mirrors node-oidc-provider's default `rotateRefreshToken` cap of `365.25 * 24 * 60 * 60`.
459
+ */ var REFRESH_TOKEN_ROTATION_MAX_LIFETIME_SECONDS = 365.25 * 24 * 60 * 60;
460
+ /**
461
+ * Percentage of a refresh token's lifetime that must elapse before the library-default branch rotates it.
462
+ *
463
+ * Mirrors node-oidc-provider's default `rotateRefreshToken` threshold of `70`.
464
+ */ var REFRESH_TOKEN_ROTATION_TTL_PERCENTAGE_THRESHOLD = 70;
465
+ /**
466
+ * Decides whether a refresh token should rotate on exchange.
467
+ *
468
+ * Returns `false` (no rotation) whenever the token's scope set intersects `nonRotatingScopes` — the
469
+ * dbx-components extension point that makes service tokens stable for server env consumption.
470
+ *
471
+ * For every other token this **replicates node-oidc-provider's default `rotateRefreshToken`**
472
+ * (because setting the option disables the library's built-in default, we must reproduce it):
473
+ * 1. `totalLifetime >= 365.25d` → `false` (rotation cap reached; TTL is final).
474
+ * 2. public client (`clientAuthMethod === 'none'`) and not sender-constrained → `true`.
475
+ * 3. otherwise → `ttlPercentagePassed >= 70`.
476
+ *
477
+ * Keep this in sync with `node_modules/oidc-provider/lib/helpers/defaults.js` (`rotateRefreshToken`)
478
+ * across oidc-provider upgrades.
479
+ *
480
+ * @param input - The rotation inputs.
481
+ * @returns Whether the refresh token should rotate.
482
+ */ function shouldRotateRefreshToken(input) {
483
+ var scope = input.scope, nonRotatingScopes = input.nonRotatingScopes, totalLifetimeSeconds = input.totalLifetimeSeconds, clientAuthMethod = input.clientAuthMethod, isSenderConstrained = input.isSenderConstrained, ttlPercentagePassed = input.ttlPercentagePassed;
484
+ var scopeSet = new Set((scope !== null && scope !== void 0 ? scope : '').split(' ').filter(Boolean));
485
+ var result;
486
+ if (nonRotatingScopes.some(function(nonRotatingScope) {
487
+ return scopeSet.has(nonRotatingScope);
488
+ })) {
489
+ result = false;
490
+ } else if (totalLifetimeSeconds >= REFRESH_TOKEN_ROTATION_MAX_LIFETIME_SECONDS) {
491
+ result = false;
492
+ } else if (clientAuthMethod === 'none' && !isSenderConstrained) {
493
+ result = true;
494
+ } else {
495
+ result = ttlPercentagePassed >= REFRESH_TOKEN_ROTATION_TTL_PERCENTAGE_THRESHOLD;
496
+ }
497
+ return result;
498
+ }
381
499
  // MARK: Param parsing
382
500
  /**
383
501
  * Parses a raw `dbx_session_ttl` value (string or number, from URL query / form / persisted interaction params)
@@ -475,7 +593,7 @@ function _define_property$f(obj, key, value) {
475
593
  return jwksKeysWithStatusQuery('rotated');
476
594
  }
477
595
 
478
- function _class_call_check$f(instance, Constructor) {
596
+ function _class_call_check$h(instance, Constructor) {
479
597
  if (!(instance instanceof Constructor)) {
480
598
  throw new TypeError("Cannot call a class as a function");
481
599
  }
@@ -487,7 +605,7 @@ function _class_call_check$f(instance, Constructor) {
487
605
  * Extends both {@link JwksFirestoreCollections} (server-only JWKS keys) and
488
606
  * {@link OidcModelFirestoreCollections} (shared adapter entries).
489
607
  */ var OidcServerFirestoreCollections = function OidcServerFirestoreCollections() {
490
- _class_call_check$f(this, OidcServerFirestoreCollections);
608
+ _class_call_check$h(this, OidcServerFirestoreCollections);
491
609
  }
492
610
  ;
493
611
 
@@ -520,12 +638,12 @@ function _async_to_generator$a(fn) {
520
638
  });
521
639
  };
522
640
  }
523
- function _class_call_check$e(instance, Constructor) {
641
+ function _class_call_check$g(instance, Constructor) {
524
642
  if (!(instance instanceof Constructor)) {
525
643
  throw new TypeError("Cannot call a class as a function");
526
644
  }
527
645
  }
528
- function _defineProperties$c(target, props) {
646
+ function _defineProperties$d(target, props) {
529
647
  for(var i = 0; i < props.length; i++){
530
648
  var descriptor = props[i];
531
649
  descriptor.enumerable = descriptor.enumerable || false;
@@ -534,11 +652,11 @@ function _defineProperties$c(target, props) {
534
652
  Object.defineProperty(target, descriptor.key, descriptor);
535
653
  }
536
654
  }
537
- function _create_class$c(Constructor, protoProps, staticProps) {
538
- if (protoProps) _defineProperties$c(Constructor.prototype, protoProps);
655
+ function _create_class$d(Constructor, protoProps, staticProps) {
656
+ if (protoProps) _defineProperties$d(Constructor.prototype, protoProps);
539
657
  return Constructor;
540
658
  }
541
- function _define_property$e(obj, key, value) {
659
+ function _define_property$f(obj, key, value) {
542
660
  if (key in obj) {
543
661
  Object.defineProperty(obj, key, {
544
662
  value: value,
@@ -551,7 +669,7 @@ function _define_property$e(obj, key, value) {
551
669
  }
552
670
  return obj;
553
671
  }
554
- function _object_spread$6(target) {
672
+ function _object_spread$7(target) {
555
673
  for(var i = 1; i < arguments.length; i++){
556
674
  var source = arguments[i] != null ? arguments[i] : {};
557
675
  var ownKeys = Object.keys(source);
@@ -561,7 +679,7 @@ function _object_spread$6(target) {
561
679
  }));
562
680
  }
563
681
  ownKeys.forEach(function(key) {
564
- _define_property$e(target, key, source[key]);
682
+ _define_property$f(target, key, source[key]);
565
683
  });
566
684
  }
567
685
  return target;
@@ -686,24 +804,24 @@ function _ts_generator$a(thisArg, body) {
686
804
  }
687
805
  // MARK: Config
688
806
  var JwksServiceConfig = function JwksServiceConfig() {
689
- _class_call_check$e(this, JwksServiceConfig);
807
+ _class_call_check$g(this, JwksServiceConfig);
690
808
  };
691
809
  /**
692
810
  * If provided, the JwksService will write the JWKS to this file when keys are rotated.
693
811
  */ var JwksServiceStorageConfig = function JwksServiceStorageConfig() {
694
- _class_call_check$e(this, JwksServiceStorageConfig);
812
+ _class_call_check$g(this, JwksServiceStorageConfig);
695
813
  };
696
814
  var DEFAULT_ROTATED_KEY_MAX_AGE = 30 * 24 * 60 * 60; // 30 days
697
815
  // MARK: Service
698
816
  var JwksService = /*#__PURE__*/ function() {
699
817
  function JwksService(config, collections, storageConfig) {
700
818
  var _this = this;
701
- _class_call_check$e(this, JwksService);
819
+ _class_call_check$g(this, JwksService);
702
820
  var _config_rotatedKeyMaxAge, _config_enableSaveJwksToStorage, _config_serveJwksFromStorage;
703
- _define_property$e(this, "config", void 0);
704
- _define_property$e(this, "collections", void 0);
705
- _define_property$e(this, "storageConfig", void 0);
706
- _define_property$e(this, "_jwksStoragePublicUrl", cachedGetter(function() {
821
+ _define_property$f(this, "config", void 0);
822
+ _define_property$f(this, "collections", void 0);
823
+ _define_property$f(this, "storageConfig", void 0);
824
+ _define_property$f(this, "_jwksStoragePublicUrl", cachedGetter(function() {
707
825
  return _async_to_generator$a(function() {
708
826
  var _this, _this_storageConfig, result, _file;
709
827
  return _ts_generator$a(this, function(_state) {
@@ -752,13 +870,13 @@ var JwksService = /*#__PURE__*/ function() {
752
870
  });
753
871
  }).call(_this);
754
872
  }));
755
- _define_property$e(this, "rotatedKeyMaxAge", void 0);
873
+ _define_property$f(this, "rotatedKeyMaxAge", void 0);
756
874
  /**
757
875
  * Whether the JWKS is served from a public storage URL rather than the built-in endpoint.
758
- */ _define_property$e(this, "serveJwksFromStorage", void 0);
876
+ */ _define_property$f(this, "serveJwksFromStorage", void 0);
759
877
  /**
760
878
  * Whether the JWKS should be saved to storage when keys are rotated.
761
- */ _define_property$e(this, "saveJwksToStorage", void 0);
879
+ */ _define_property$f(this, "saveJwksToStorage", void 0);
762
880
  this.config = config;
763
881
  this.collections = collections;
764
882
  this.storageConfig = storageConfig;
@@ -767,7 +885,7 @@ var JwksService = /*#__PURE__*/ function() {
767
885
  this.saveJwksToStorage = (_config_enableSaveJwksToStorage = config.enableSaveJwksToStorage) !== null && _config_enableSaveJwksToStorage !== void 0 ? _config_enableSaveJwksToStorage : hasStorageFile;
768
886
  this.serveJwksFromStorage = (_config_serveJwksFromStorage = config.serveJwksFromStorage) !== null && _config_serveJwksFromStorage !== void 0 ? _config_serveJwksFromStorage : this.saveJwksToStorage;
769
887
  }
770
- _create_class$c(JwksService, [
888
+ _create_class$d(JwksService, [
771
889
  {
772
890
  key: "jwksKeyCollection",
773
891
  get: function get() {
@@ -802,13 +920,13 @@ var JwksService = /*#__PURE__*/ function() {
802
920
  }
803
921
  }), publicKey = _generateKeyPairSync.publicKey, privateKey = _generateKeyPairSync.privateKey;
804
922
  kid = randomBytes(16).toString('hex');
805
- publicJwk = _object_spread_props$3(_object_spread$6({}, publicKey), {
923
+ publicJwk = _object_spread_props$3(_object_spread$7({}, publicKey), {
806
924
  kid: kid,
807
925
  kty: 'RSA',
808
926
  alg: 'RS256',
809
927
  use: 'sig'
810
928
  });
811
- privateJwk = _object_spread_props$3(_object_spread$6({}, privateKey), {
929
+ privateJwk = _object_spread_props$3(_object_spread$7({}, privateKey), {
812
930
  kid: kid,
813
931
  kty: 'RSA',
814
932
  alg: 'RS256',
@@ -1226,12 +1344,12 @@ function _async_to_generator$9(fn) {
1226
1344
  });
1227
1345
  };
1228
1346
  }
1229
- function _class_call_check$d(instance, Constructor) {
1347
+ function _class_call_check$f(instance, Constructor) {
1230
1348
  if (!(instance instanceof Constructor)) {
1231
1349
  throw new TypeError("Cannot call a class as a function");
1232
1350
  }
1233
1351
  }
1234
- function _defineProperties$b(target, props) {
1352
+ function _defineProperties$c(target, props) {
1235
1353
  for(var i = 0; i < props.length; i++){
1236
1354
  var descriptor = props[i];
1237
1355
  descriptor.enumerable = descriptor.enumerable || false;
@@ -1240,11 +1358,11 @@ function _defineProperties$b(target, props) {
1240
1358
  Object.defineProperty(target, descriptor.key, descriptor);
1241
1359
  }
1242
1360
  }
1243
- function _create_class$b(Constructor, protoProps, staticProps) {
1244
- if (protoProps) _defineProperties$b(Constructor.prototype, protoProps);
1361
+ function _create_class$c(Constructor, protoProps, staticProps) {
1362
+ if (protoProps) _defineProperties$c(Constructor.prototype, protoProps);
1245
1363
  return Constructor;
1246
1364
  }
1247
- function _define_property$d(obj, key, value) {
1365
+ function _define_property$e(obj, key, value) {
1248
1366
  if (key in obj) {
1249
1367
  Object.defineProperty(obj, key, {
1250
1368
  value: value,
@@ -1399,7 +1517,7 @@ function _ts_generator$9(thisArg, body) {
1399
1517
  * };
1400
1518
  * ```
1401
1519
  */ var OidcAccountServiceDelegate = function OidcAccountServiceDelegate() {
1402
- _class_call_check$d(this, OidcAccountServiceDelegate);
1520
+ _class_call_check$f(this, OidcAccountServiceDelegate);
1403
1521
  };
1404
1522
  // MARK: User Context
1405
1523
  /**
@@ -1408,15 +1526,15 @@ function _ts_generator$9(thisArg, body) {
1408
1526
  * Created by {@link OidcAccountService.userContext} for a specific user ID.
1409
1527
  */ var OidcAccountServiceUserContext = /*#__PURE__*/ function() {
1410
1528
  function OidcAccountServiceUserContext(_service, _uid) {
1411
- _class_call_check$d(this, OidcAccountServiceUserContext);
1412
- _define_property$d(this, "_service", void 0);
1413
- _define_property$d(this, "_uid", void 0);
1414
- _define_property$d(this, "authUserContext", void 0);
1529
+ _class_call_check$f(this, OidcAccountServiceUserContext);
1530
+ _define_property$e(this, "_service", void 0);
1531
+ _define_property$e(this, "_uid", void 0);
1532
+ _define_property$e(this, "authUserContext", void 0);
1415
1533
  this._service = _service;
1416
1534
  this._uid = _uid;
1417
1535
  this.authUserContext = this._service.authService.userContext(this._uid);
1418
1536
  }
1419
- _create_class$b(OidcAccountServiceUserContext, [
1537
+ _create_class$c(OidcAccountServiceUserContext, [
1420
1538
  {
1421
1539
  key: "uid",
1422
1540
  get: function get() {
@@ -1491,13 +1609,13 @@ function _ts_generator$9(thisArg, body) {
1491
1609
  * Register it as a provider using the `OidcAccountService` class as the injection token.
1492
1610
  */ var OidcAccountService = /*#__PURE__*/ function() {
1493
1611
  function OidcAccountService(authService, delegate) {
1494
- _class_call_check$d(this, OidcAccountService);
1495
- _define_property$d(this, "authService", void 0);
1496
- _define_property$d(this, "delegate", void 0);
1612
+ _class_call_check$f(this, OidcAccountService);
1613
+ _define_property$e(this, "authService", void 0);
1614
+ _define_property$e(this, "delegate", void 0);
1497
1615
  this.authService = authService;
1498
1616
  this.delegate = delegate;
1499
1617
  }
1500
- _create_class$b(OidcAccountService, [
1618
+ _create_class$c(OidcAccountService, [
1501
1619
  {
1502
1620
  key: "providerConfig",
1503
1621
  get: /**
@@ -1524,22 +1642,22 @@ function _ts_generator$9(thisArg, body) {
1524
1642
  }
1525
1643
  ();
1526
1644
 
1527
- function _assert_this_initialized(self) {
1645
+ function _assert_this_initialized$1(self) {
1528
1646
  if (self === void 0) {
1529
1647
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1530
1648
  }
1531
1649
  return self;
1532
1650
  }
1533
- function _call_super(_this, derived, args) {
1534
- derived = _get_prototype_of(derived);
1535
- return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
1651
+ function _call_super$1(_this, derived, args) {
1652
+ derived = _get_prototype_of$1(derived);
1653
+ return _possible_constructor_return$1(_this, _is_native_reflect_construct$1() ? Reflect.construct(derived, args || [], _get_prototype_of$1(_this).constructor) : derived.apply(_this, args));
1536
1654
  }
1537
- function _class_call_check$c(instance, Constructor) {
1655
+ function _class_call_check$e(instance, Constructor) {
1538
1656
  if (!(instance instanceof Constructor)) {
1539
1657
  throw new TypeError("Cannot call a class as a function");
1540
1658
  }
1541
1659
  }
1542
- function _defineProperties$a(target, props) {
1660
+ function _defineProperties$b(target, props) {
1543
1661
  for(var i = 0; i < props.length; i++){
1544
1662
  var descriptor = props[i];
1545
1663
  descriptor.enumerable = descriptor.enumerable || false;
@@ -1548,17 +1666,17 @@ function _defineProperties$a(target, props) {
1548
1666
  Object.defineProperty(target, descriptor.key, descriptor);
1549
1667
  }
1550
1668
  }
1551
- function _create_class$a(Constructor, protoProps, staticProps) {
1552
- if (protoProps) _defineProperties$a(Constructor.prototype, protoProps);
1669
+ function _create_class$b(Constructor, protoProps, staticProps) {
1670
+ if (protoProps) _defineProperties$b(Constructor.prototype, protoProps);
1553
1671
  return Constructor;
1554
1672
  }
1555
- function _get_prototype_of(o) {
1556
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1673
+ function _get_prototype_of$1(o) {
1674
+ _get_prototype_of$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
1557
1675
  return o.__proto__ || Object.getPrototypeOf(o);
1558
1676
  };
1559
- return _get_prototype_of(o);
1677
+ return _get_prototype_of$1(o);
1560
1678
  }
1561
- function _inherits(subClass, superClass) {
1679
+ function _inherits$1(subClass, superClass) {
1562
1680
  if (typeof superClass !== "function" && superClass !== null) {
1563
1681
  throw new TypeError("Super expression must either be null or a function");
1564
1682
  }
@@ -1569,30 +1687,30 @@ function _inherits(subClass, superClass) {
1569
1687
  configurable: true
1570
1688
  }
1571
1689
  });
1572
- if (superClass) _set_prototype_of(subClass, superClass);
1690
+ if (superClass) _set_prototype_of$1(subClass, superClass);
1573
1691
  }
1574
- function _possible_constructor_return(self, call) {
1575
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
1692
+ function _possible_constructor_return$1(self, call) {
1693
+ if (call && (_type_of$1(call) === "object" || typeof call === "function")) {
1576
1694
  return call;
1577
1695
  }
1578
- return _assert_this_initialized(self);
1696
+ return _assert_this_initialized$1(self);
1579
1697
  }
1580
- function _set_prototype_of(o, p) {
1581
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1698
+ function _set_prototype_of$1(o, p) {
1699
+ _set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
1582
1700
  o.__proto__ = p;
1583
1701
  return o;
1584
1702
  };
1585
- return _set_prototype_of(o, p);
1703
+ return _set_prototype_of$1(o, p);
1586
1704
  }
1587
- function _type_of(obj) {
1705
+ function _type_of$1(obj) {
1588
1706
  "@swc/helpers - typeof";
1589
1707
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
1590
1708
  }
1591
- function _is_native_reflect_construct() {
1709
+ function _is_native_reflect_construct$1() {
1592
1710
  try {
1593
1711
  var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
1594
1712
  } catch (_) {}
1595
- return (_is_native_reflect_construct = function() {
1713
+ return (_is_native_reflect_construct$1 = function() {
1596
1714
  return !!result;
1597
1715
  })();
1598
1716
  }
@@ -1602,7 +1720,7 @@ function _is_native_reflect_construct() {
1602
1720
  *
1603
1721
  * Implementations provide concrete collection instances wired to a specific {@link FirestoreContext}.
1604
1722
  */ var JwksFirestoreCollections = function JwksFirestoreCollections() {
1605
- _class_call_check$c(this, JwksFirestoreCollections);
1723
+ _class_call_check$e(this, JwksFirestoreCollections);
1606
1724
  };
1607
1725
  // MARK: Identity
1608
1726
  /**
@@ -1613,12 +1731,12 @@ function _is_native_reflect_construct() {
1613
1731
  /**
1614
1732
  * Firestore document wrapper for {@link JwksKey}.
1615
1733
  */ var JwksKeyDocument = /*#__PURE__*/ function(AbstractFirestoreDocument) {
1616
- _inherits(JwksKeyDocument, AbstractFirestoreDocument);
1734
+ _inherits$1(JwksKeyDocument, AbstractFirestoreDocument);
1617
1735
  function JwksKeyDocument() {
1618
- _class_call_check$c(this, JwksKeyDocument);
1619
- return _call_super(this, JwksKeyDocument, arguments);
1736
+ _class_call_check$e(this, JwksKeyDocument);
1737
+ return _call_super$1(this, JwksKeyDocument, arguments);
1620
1738
  }
1621
- _create_class$a(JwksKeyDocument, [
1739
+ _create_class$b(JwksKeyDocument, [
1622
1740
  {
1623
1741
  key: "modelIdentity",
1624
1742
  get: function get() {
@@ -1710,7 +1828,7 @@ function _async_to_generator$8(fn) {
1710
1828
  });
1711
1829
  };
1712
1830
  }
1713
- function _class_call_check$b(instance, Constructor) {
1831
+ function _class_call_check$d(instance, Constructor) {
1714
1832
  if (!(instance instanceof Constructor)) {
1715
1833
  throw new TypeError("Cannot call a class as a function");
1716
1834
  }
@@ -1820,7 +1938,7 @@ function _ts_generator$8(thisArg, body) {
1820
1938
  *
1821
1939
  * @see {@link oidcModelServerActions} for the concrete implementation factory.
1822
1940
  */ var OidcModelServerActions = function OidcModelServerActions() {
1823
- _class_call_check$b(this, OidcModelServerActions);
1941
+ _class_call_check$d(this, OidcModelServerActions);
1824
1942
  };
1825
1943
  /**
1826
1944
  * Creates a concrete {@link OidcModelServerActions} implementation wired to the provided context.
@@ -2062,12 +2180,12 @@ function _async_to_generator$7(fn) {
2062
2180
  });
2063
2181
  };
2064
2182
  }
2065
- function _class_call_check$a(instance, Constructor) {
2183
+ function _class_call_check$c(instance, Constructor) {
2066
2184
  if (!(instance instanceof Constructor)) {
2067
2185
  throw new TypeError("Cannot call a class as a function");
2068
2186
  }
2069
2187
  }
2070
- function _defineProperties$9(target, props) {
2188
+ function _defineProperties$a(target, props) {
2071
2189
  for(var i = 0; i < props.length; i++){
2072
2190
  var descriptor = props[i];
2073
2191
  descriptor.enumerable = descriptor.enumerable || false;
@@ -2076,11 +2194,11 @@ function _defineProperties$9(target, props) {
2076
2194
  Object.defineProperty(target, descriptor.key, descriptor);
2077
2195
  }
2078
2196
  }
2079
- function _create_class$9(Constructor, protoProps, staticProps) {
2080
- if (protoProps) _defineProperties$9(Constructor.prototype, protoProps);
2197
+ function _create_class$a(Constructor, protoProps, staticProps) {
2198
+ if (protoProps) _defineProperties$a(Constructor.prototype, protoProps);
2081
2199
  return Constructor;
2082
2200
  }
2083
- function _define_property$c(obj, key, value) {
2201
+ function _define_property$d(obj, key, value) {
2084
2202
  if (key in obj) {
2085
2203
  Object.defineProperty(obj, key, {
2086
2204
  value: value,
@@ -2093,7 +2211,7 @@ function _define_property$c(obj, key, value) {
2093
2211
  }
2094
2212
  return obj;
2095
2213
  }
2096
- function _object_spread$5(target) {
2214
+ function _object_spread$6(target) {
2097
2215
  for(var i = 1; i < arguments.length; i++){
2098
2216
  var source = arguments[i] != null ? arguments[i] : {};
2099
2217
  var ownKeys = Object.keys(source);
@@ -2103,7 +2221,7 @@ function _object_spread$5(target) {
2103
2221
  }));
2104
2222
  }
2105
2223
  ownKeys.forEach(function(key) {
2106
- _define_property$c(target, key, source[key]);
2224
+ _define_property$d(target, key, source[key]);
2107
2225
  });
2108
2226
  }
2109
2227
  return target;
@@ -2232,13 +2350,17 @@ function _ts_generator$7(thisArg, body) {
2232
2350
  *
2233
2351
  * Mirrors the oidc-provider `registration.js` flow to ensure all provider
2234
2352
  * validation and lifecycle hooks run.
2353
+ *
2354
+ * Client create/update/rotate/delete are driven by callModel functions, so their
2355
+ * analytics are captured by the callModel analytics layer (`OnCallModelAnalyticsService`)
2356
+ * with the acting user — not by the OIDC analytics service.
2235
2357
  */ var OidcClientService = /*#__PURE__*/ function() {
2236
2358
  function OidcClientService(oidcService) {
2237
- _class_call_check$a(this, OidcClientService);
2238
- _define_property$c(this, "oidcService", void 0);
2359
+ _class_call_check$c(this, OidcClientService);
2360
+ _define_property$d(this, "oidcService", void 0);
2239
2361
  this.oidcService = oidcService;
2240
2362
  }
2241
- _create_class$9(OidcClientService, [
2363
+ _create_class$a(OidcClientService, [
2242
2364
  {
2243
2365
  key: "createClient",
2244
2366
  value: /**
@@ -2376,7 +2498,7 @@ function _ts_generator$7(thisArg, body) {
2376
2498
  if (!existing) {
2377
2499
  throw new Error('Client not found.');
2378
2500
  }
2379
- updatedMetadata = _object_spread$5({}, existing);
2501
+ updatedMetadata = _object_spread$6({}, existing);
2380
2502
  updatedMetadata.client_name = params.client_name;
2381
2503
  updatedMetadata.redirect_uris = params.redirect_uris;
2382
2504
  if (params.logo_uri !== undefined) {
@@ -2450,7 +2572,7 @@ function _ts_generator$7(thisArg, body) {
2450
2572
  throw new Error('Cannot rotate a client secret for a public PKCE client (token_endpoint_auth_method "none"). Public clients have no secret.');
2451
2573
  }
2452
2574
  newSecret = randomBytes(64).toString('base64url');
2453
- updatedMetadata = _object_spread_props$2(_object_spread$5({}, existing), {
2575
+ updatedMetadata = _object_spread_props$2(_object_spread$6({}, existing), {
2454
2576
  client_secret: newSecret,
2455
2577
  client_secret_expires_at: 0
2456
2578
  });
@@ -2527,7 +2649,7 @@ function _ts_generator$7(thisArg, body) {
2527
2649
  }
2528
2650
  ();
2529
2651
 
2530
- function _define_property$b(obj, key, value) {
2652
+ function _define_property$c(obj, key, value) {
2531
2653
  if (key in obj) {
2532
2654
  Object.defineProperty(obj, key, {
2533
2655
  value: value,
@@ -2540,7 +2662,7 @@ function _define_property$b(obj, key, value) {
2540
2662
  }
2541
2663
  return obj;
2542
2664
  }
2543
- function _object_spread$4(target) {
2665
+ function _object_spread$5(target) {
2544
2666
  for(var i = 1; i < arguments.length; i++){
2545
2667
  var source = arguments[i] != null ? arguments[i] : {};
2546
2668
  var ownKeys = Object.keys(source);
@@ -2550,7 +2672,7 @@ function _object_spread$4(target) {
2550
2672
  }));
2551
2673
  }
2552
2674
  ownKeys.forEach(function(key) {
2553
- _define_property$b(target, key, source[key]);
2675
+ _define_property$c(target, key, source[key]);
2554
2676
  });
2555
2677
  }
2556
2678
  return target;
@@ -2582,7 +2704,7 @@ function _object_spread_props$1(target, source) {
2582
2704
  * @param oidcService - The core OIDC service for grant revocation.
2583
2705
  * @returns The configured OidcModelServerActions instance.
2584
2706
  */ function oidcModelServerActionsFactory(oidcClientService, oidcService) {
2585
- var context = _object_spread_props$1(_object_spread$4({}, firebaseServerActionsContext()), {
2707
+ var context = _object_spread_props$1(_object_spread$5({}, firebaseServerActionsContext()), {
2586
2708
  oidcClientService: oidcClientService,
2587
2709
  oidcService: oidcService
2588
2710
  });
@@ -2647,12 +2769,12 @@ function _async_to_generator$6(fn) {
2647
2769
  });
2648
2770
  };
2649
2771
  }
2650
- function _class_call_check$9(instance, Constructor) {
2772
+ function _class_call_check$b(instance, Constructor) {
2651
2773
  if (!(instance instanceof Constructor)) {
2652
2774
  throw new TypeError("Cannot call a class as a function");
2653
2775
  }
2654
2776
  }
2655
- function _defineProperties$8(target, props) {
2777
+ function _defineProperties$9(target, props) {
2656
2778
  for(var i = 0; i < props.length; i++){
2657
2779
  var descriptor = props[i];
2658
2780
  descriptor.enumerable = descriptor.enumerable || false;
@@ -2661,11 +2783,11 @@ function _defineProperties$8(target, props) {
2661
2783
  Object.defineProperty(target, descriptor.key, descriptor);
2662
2784
  }
2663
2785
  }
2664
- function _create_class$8(Constructor, protoProps, staticProps) {
2665
- if (protoProps) _defineProperties$8(Constructor.prototype, protoProps);
2786
+ function _create_class$9(Constructor, protoProps, staticProps) {
2787
+ if (protoProps) _defineProperties$9(Constructor.prototype, protoProps);
2666
2788
  return Constructor;
2667
2789
  }
2668
- function _define_property$a(obj, key, value) {
2790
+ function _define_property$b(obj, key, value) {
2669
2791
  if (key in obj) {
2670
2792
  Object.defineProperty(obj, key, {
2671
2793
  value: value,
@@ -2686,7 +2808,7 @@ function _instanceof$2(left, right) {
2686
2808
  return left instanceof right;
2687
2809
  }
2688
2810
  }
2689
- function _object_spread$3(target) {
2811
+ function _object_spread$4(target) {
2690
2812
  for(var i = 1; i < arguments.length; i++){
2691
2813
  var source = arguments[i] != null ? arguments[i] : {};
2692
2814
  var ownKeys = Object.keys(source);
@@ -2696,7 +2818,7 @@ function _object_spread$3(target) {
2696
2818
  }));
2697
2819
  }
2698
2820
  ownKeys.forEach(function(key) {
2699
- _define_property$a(target, key, source[key]);
2821
+ _define_property$b(target, key, source[key]);
2700
2822
  });
2701
2823
  }
2702
2824
  return target;
@@ -2830,13 +2952,13 @@ var GRANTABLE_MODELS = new Set(GRANTABLE_MODEL_NAMES);
2830
2952
  */ function createAdapterFactory(collections, encryptionService) {
2831
2953
  var FirestoreAdapter = /*#__PURE__*/ function() {
2832
2954
  function FirestoreAdapter(name) {
2833
- _class_call_check$9(this, FirestoreAdapter);
2834
- _define_property$a(this, "name", void 0);
2835
- _define_property$a(this, "collection", void 0);
2955
+ _class_call_check$b(this, FirestoreAdapter);
2956
+ _define_property$b(this, "name", void 0);
2957
+ _define_property$b(this, "collection", void 0);
2836
2958
  this.name = name;
2837
2959
  this.collection = collections.oidcEntryCollection;
2838
2960
  }
2839
- _create_class$8(FirestoreAdapter, [
2961
+ _create_class$9(FirestoreAdapter, [
2840
2962
  {
2841
2963
  key: "upsert",
2842
2964
  value: function upsert(id, payload, expiresIn) {
@@ -2867,7 +2989,7 @@ var GRANTABLE_MODELS = new Set(GRANTABLE_MODEL_NAMES);
2867
2989
  } else if (createdAtIso) {
2868
2990
  createdAt = safeToJsDate(createdAtIso);
2869
2991
  }
2870
- data = _object_spread$3({
2992
+ data = _object_spread$4({
2871
2993
  type: this.name,
2872
2994
  payload: encryptionService.encryptAdapterPayload(payload),
2873
2995
  o: o,
@@ -3101,20 +3223,20 @@ var GRANTABLE_MODELS = new Set(GRANTABLE_MODEL_NAMES);
3101
3223
  return FirestoreAdapter;
3102
3224
  }
3103
3225
 
3104
- function _array_like_to_array$4(arr, len) {
3226
+ function _array_like_to_array$5(arr, len) {
3105
3227
  if (len == null || len > arr.length) len = arr.length;
3106
3228
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3107
3229
  return arr2;
3108
3230
  }
3109
- function _array_without_holes$3(arr) {
3110
- if (Array.isArray(arr)) return _array_like_to_array$4(arr);
3231
+ function _array_without_holes$5(arr) {
3232
+ if (Array.isArray(arr)) return _array_like_to_array$5(arr);
3111
3233
  }
3112
- function _class_call_check$8(instance, Constructor) {
3234
+ function _class_call_check$a(instance, Constructor) {
3113
3235
  if (!(instance instanceof Constructor)) {
3114
3236
  throw new TypeError("Cannot call a class as a function");
3115
3237
  }
3116
3238
  }
3117
- function _defineProperties$7(target, props) {
3239
+ function _defineProperties$8(target, props) {
3118
3240
  for(var i = 0; i < props.length; i++){
3119
3241
  var descriptor = props[i];
3120
3242
  descriptor.enumerable = descriptor.enumerable || false;
@@ -3123,11 +3245,11 @@ function _defineProperties$7(target, props) {
3123
3245
  Object.defineProperty(target, descriptor.key, descriptor);
3124
3246
  }
3125
3247
  }
3126
- function _create_class$7(Constructor, protoProps, staticProps) {
3127
- if (protoProps) _defineProperties$7(Constructor.prototype, protoProps);
3248
+ function _create_class$8(Constructor, protoProps, staticProps) {
3249
+ if (protoProps) _defineProperties$8(Constructor.prototype, protoProps);
3128
3250
  return Constructor;
3129
3251
  }
3130
- function _define_property$9(obj, key, value) {
3252
+ function _define_property$a(obj, key, value) {
3131
3253
  if (key in obj) {
3132
3254
  Object.defineProperty(obj, key, {
3133
3255
  value: value,
@@ -3140,22 +3262,22 @@ function _define_property$9(obj, key, value) {
3140
3262
  }
3141
3263
  return obj;
3142
3264
  }
3143
- function _iterable_to_array$3(iter) {
3265
+ function _iterable_to_array$5(iter) {
3144
3266
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3145
3267
  }
3146
- function _non_iterable_spread$3() {
3268
+ function _non_iterable_spread$5() {
3147
3269
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3148
3270
  }
3149
- function _to_consumable_array$3(arr) {
3150
- return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$3();
3271
+ function _to_consumable_array$5(arr) {
3272
+ return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$5();
3151
3273
  }
3152
- function _unsupported_iterable_to_array$4(o, minLen) {
3274
+ function _unsupported_iterable_to_array$5(o, minLen) {
3153
3275
  if (!o) return;
3154
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
3276
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
3155
3277
  var n = Object.prototype.toString.call(o).slice(8, -1);
3156
3278
  if (n === "Object" && o.constructor) n = o.constructor.name;
3157
3279
  if (n === "Map" || n === "Set") return Array.from(n);
3158
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
3280
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
3159
3281
  }
3160
3282
  // MARK: Encrypted Fields
3161
3283
  /**
@@ -3177,16 +3299,16 @@ function _unsupported_iterable_to_array$4(o, minLen) {
3177
3299
  * the OIDC model server actions.
3178
3300
  */ var OidcEncryptionService = /*#__PURE__*/ function() {
3179
3301
  function OidcEncryptionService(config) {
3180
- _class_call_check$8(this, OidcEncryptionService);
3181
- _define_property$9(this, "provider", void 0);
3182
- _define_property$9(this, "adapterPayloadEncryptor", void 0);
3302
+ _class_call_check$a(this, OidcEncryptionService);
3303
+ _define_property$a(this, "provider", void 0);
3304
+ _define_property$a(this, "adapterPayloadEncryptor", void 0);
3183
3305
  this.provider = createAesStringEncryptionProvider(config.jwksKeyConverterConfig.encryptionSecret);
3184
3306
  this.adapterPayloadEncryptor = selectiveFieldEncryptor({
3185
3307
  provider: this.provider,
3186
- fields: _to_consumable_array$3(OIDC_ENCRYPTED_PAYLOAD_FIELDS)
3308
+ fields: _to_consumable_array$5(OIDC_ENCRYPTED_PAYLOAD_FIELDS)
3187
3309
  });
3188
3310
  }
3189
- _create_class$7(OidcEncryptionService, [
3311
+ _create_class$8(OidcEncryptionService, [
3190
3312
  {
3191
3313
  /**
3192
3314
  * Encrypts sensitive fields in an adapter payload and returns it as a {@link JsonSerializableObject}
@@ -3219,20 +3341,20 @@ OidcEncryptionService = __decorate([
3219
3341
  __param(0, Inject(OidcModuleConfig))
3220
3342
  ], OidcEncryptionService);
3221
3343
 
3222
- function _array_like_to_array$3(arr, len) {
3344
+ function _array_like_to_array$4(arr, len) {
3223
3345
  if (len == null || len > arr.length) len = arr.length;
3224
3346
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3225
3347
  return arr2;
3226
3348
  }
3227
- function _array_without_holes$2(arr) {
3228
- if (Array.isArray(arr)) return _array_like_to_array$3(arr);
3349
+ function _array_without_holes$4(arr) {
3350
+ if (Array.isArray(arr)) return _array_like_to_array$4(arr);
3229
3351
  }
3230
- function _class_call_check$7(instance, Constructor) {
3352
+ function _class_call_check$9(instance, Constructor) {
3231
3353
  if (!(instance instanceof Constructor)) {
3232
3354
  throw new TypeError("Cannot call a class as a function");
3233
3355
  }
3234
3356
  }
3235
- function _defineProperties$6(target, props) {
3357
+ function _defineProperties$7(target, props) {
3236
3358
  for(var i = 0; i < props.length; i++){
3237
3359
  var descriptor = props[i];
3238
3360
  descriptor.enumerable = descriptor.enumerable || false;
@@ -3241,11 +3363,11 @@ function _defineProperties$6(target, props) {
3241
3363
  Object.defineProperty(target, descriptor.key, descriptor);
3242
3364
  }
3243
3365
  }
3244
- function _create_class$6(Constructor, protoProps, staticProps) {
3245
- if (protoProps) _defineProperties$6(Constructor.prototype, protoProps);
3366
+ function _create_class$7(Constructor, protoProps, staticProps) {
3367
+ if (protoProps) _defineProperties$7(Constructor.prototype, protoProps);
3246
3368
  return Constructor;
3247
3369
  }
3248
- function _define_property$8(obj, key, value) {
3370
+ function _define_property$9(obj, key, value) {
3249
3371
  if (key in obj) {
3250
3372
  Object.defineProperty(obj, key, {
3251
3373
  value: value,
@@ -3258,22 +3380,22 @@ function _define_property$8(obj, key, value) {
3258
3380
  }
3259
3381
  return obj;
3260
3382
  }
3261
- function _iterable_to_array$2(iter) {
3383
+ function _iterable_to_array$4(iter) {
3262
3384
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3263
3385
  }
3264
- function _non_iterable_spread$2() {
3386
+ function _non_iterable_spread$4() {
3265
3387
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3266
3388
  }
3267
- function _to_consumable_array$2(arr) {
3268
- return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$2();
3389
+ function _to_consumable_array$4(arr) {
3390
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$4();
3269
3391
  }
3270
- function _unsupported_iterable_to_array$3(o, minLen) {
3392
+ function _unsupported_iterable_to_array$4(o, minLen) {
3271
3393
  if (!o) return;
3272
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
3394
+ if (typeof o === "string") return _array_like_to_array$4(o, minLen);
3273
3395
  var n = Object.prototype.toString.call(o).slice(8, -1);
3274
3396
  if (n === "Object" && o.constructor) n = o.constructor.name;
3275
3397
  if (n === "Map" || n === "Set") return Array.from(n);
3276
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
3398
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
3277
3399
  }
3278
3400
  // MARK: Routes
3279
3401
  /**
@@ -3321,36 +3443,36 @@ var DEFAULT_OIDC_CODE_CHALLENGE_METHODS = [
3321
3443
  * Injected into {@link OidcService} and {@link OidcWellKnownController}.
3322
3444
  */ var OidcProviderConfigService = /*#__PURE__*/ function() {
3323
3445
  function OidcProviderConfigService(config, accountService, envService) {
3324
- _class_call_check$7(this, OidcProviderConfigService);
3446
+ _class_call_check$9(this, OidcProviderConfigService);
3325
3447
  var _this_config_tokenEndpointAuthMethods;
3326
- _define_property$8(this, "config", void 0);
3327
- _define_property$8(this, "routes", DEFAULT_OIDC_ROUTES);
3448
+ _define_property$9(this, "config", void 0);
3449
+ _define_property$9(this, "routes", DEFAULT_OIDC_ROUTES);
3328
3450
  /**
3329
3451
  * If the OIDC registration route is enabled.
3330
- */ _define_property$8(this, "oidcRegistrationRouteEnabled", void 0);
3452
+ */ _define_property$9(this, "oidcRegistrationRouteEnabled", void 0);
3331
3453
  /**
3332
3454
  * The url to the front-end login page.
3333
- */ _define_property$8(this, "appLoginUrl", void 0);
3455
+ */ _define_property$9(this, "appLoginUrl", void 0);
3334
3456
  /**
3335
3457
  * The url to the front-end consent page.
3336
- */ _define_property$8(this, "appConsentUrl", void 0);
3458
+ */ _define_property$9(this, "appConsentUrl", void 0);
3337
3459
  /**
3338
3460
  * The app-provided provider config from the delegate.
3339
- */ _define_property$8(this, "providerConfig", void 0);
3461
+ */ _define_property$9(this, "providerConfig", void 0);
3340
3462
  /**
3341
3463
  * Scopes derived from the claims configuration keys.
3342
- */ _define_property$8(this, "scopesSupported", void 0);
3464
+ */ _define_property$9(this, "scopesSupported", void 0);
3343
3465
  /**
3344
3466
  * Flat list of all unique claim names from the claims configuration.
3345
- */ _define_property$8(this, "claimsSupported", void 0);
3467
+ */ _define_property$9(this, "claimsSupported", void 0);
3346
3468
  /**
3347
3469
  * Token endpoint authentication methods from config or defaults.
3348
- */ _define_property$8(this, "tokenEndpointAuthMethodsSupported", void 0);
3470
+ */ _define_property$9(this, "tokenEndpointAuthMethodsSupported", void 0);
3349
3471
  this.config = config;
3350
3472
  this.providerConfig = accountService.providerConfig;
3351
3473
  this.scopesSupported = Object.keys(this.providerConfig.claims);
3352
3474
  this.claimsSupported = Array.from(new Set(Object.values(this.providerConfig.claims).flat()));
3353
- this.tokenEndpointAuthMethodsSupported = (_this_config_tokenEndpointAuthMethods = this.config.tokenEndpointAuthMethods) !== null && _this_config_tokenEndpointAuthMethods !== void 0 ? _this_config_tokenEndpointAuthMethods : _to_consumable_array$2(DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS);
3475
+ this.tokenEndpointAuthMethodsSupported = (_this_config_tokenEndpointAuthMethods = this.config.tokenEndpointAuthMethods) !== null && _this_config_tokenEndpointAuthMethods !== void 0 ? _this_config_tokenEndpointAuthMethods : _to_consumable_array$4(DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS);
3354
3476
  var appUrl = envService.appUrl;
3355
3477
  this.appLoginUrl = websiteUrlFromPaths(appUrl, [
3356
3478
  this.config.appOAuthInteractionPath,
@@ -3362,7 +3484,7 @@ var DEFAULT_OIDC_CODE_CHALLENGE_METHODS = [
3362
3484
  ]);
3363
3485
  this.oidcRegistrationRouteEnabled = config.registrationEnabled === true;
3364
3486
  }
3365
- _create_class$6(OidcProviderConfigService, [
3487
+ _create_class$7(OidcProviderConfigService, [
3366
3488
  {
3367
3489
  /**
3368
3490
  * Builds the OpenID Connect Discovery metadata document.
@@ -3383,16 +3505,16 @@ var DEFAULT_OIDC_CODE_CHALLENGE_METHODS = [
3383
3505
  jwks_uri: jwksUri !== null && jwksUri !== void 0 ? jwksUri : "".concat(issuer).concat(routes.jwks),
3384
3506
  registration_endpoint: this.oidcRegistrationRouteEnabled ? "".concat(issuer).concat(routes.registration) : undefined,
3385
3507
  scopes_supported: this.scopesSupported,
3386
- response_types_supported: _to_consumable_array$2(providerConfig.responseTypes),
3508
+ response_types_supported: _to_consumable_array$4(providerConfig.responseTypes),
3387
3509
  response_modes_supported: [
3388
3510
  'query'
3389
3511
  ],
3390
- grant_types_supported: _to_consumable_array$2(providerConfig.grantTypes),
3391
- subject_types_supported: _to_consumable_array$2(DEFAULT_OIDC_SUBJECT_TYPES),
3392
- id_token_signing_alg_values_supported: _to_consumable_array$2(DEFAULT_OIDC_ID_TOKEN_SIGNING_ALG_VALUES),
3393
- token_endpoint_auth_methods_supported: _to_consumable_array$2(this.tokenEndpointAuthMethodsSupported),
3512
+ grant_types_supported: _to_consumable_array$4(providerConfig.grantTypes),
3513
+ subject_types_supported: _to_consumable_array$4(DEFAULT_OIDC_SUBJECT_TYPES),
3514
+ id_token_signing_alg_values_supported: _to_consumable_array$4(DEFAULT_OIDC_ID_TOKEN_SIGNING_ALG_VALUES),
3515
+ token_endpoint_auth_methods_supported: _to_consumable_array$4(this.tokenEndpointAuthMethodsSupported),
3394
3516
  claims_supported: this.claimsSupported,
3395
- code_challenge_methods_supported: _to_consumable_array$2(DEFAULT_OIDC_CODE_CHALLENGE_METHODS)
3517
+ code_challenge_methods_supported: _to_consumable_array$4(DEFAULT_OIDC_CODE_CHALLENGE_METHODS)
3396
3518
  };
3397
3519
  }
3398
3520
  }
@@ -3406,13 +3528,13 @@ OidcProviderConfigService = __decorate([
3406
3528
  __param(2, Inject(FirebaseServerEnvService))
3407
3529
  ], OidcProviderConfigService);
3408
3530
 
3409
- function _array_like_to_array$2(arr, len) {
3531
+ function _array_like_to_array$3(arr, len) {
3410
3532
  if (len == null || len > arr.length) len = arr.length;
3411
3533
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
3412
3534
  return arr2;
3413
3535
  }
3414
- function _array_without_holes$1(arr) {
3415
- if (Array.isArray(arr)) return _array_like_to_array$2(arr);
3536
+ function _array_without_holes$3(arr) {
3537
+ if (Array.isArray(arr)) return _array_like_to_array$3(arr);
3416
3538
  }
3417
3539
  function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
3418
3540
  try {
@@ -3443,12 +3565,12 @@ function _async_to_generator$5(fn) {
3443
3565
  });
3444
3566
  };
3445
3567
  }
3446
- function _class_call_check$6(instance, Constructor) {
3568
+ function _class_call_check$8(instance, Constructor) {
3447
3569
  if (!(instance instanceof Constructor)) {
3448
3570
  throw new TypeError("Cannot call a class as a function");
3449
3571
  }
3450
3572
  }
3451
- function _defineProperties$5(target, props) {
3573
+ function _defineProperties$6(target, props) {
3452
3574
  for(var i = 0; i < props.length; i++){
3453
3575
  var descriptor = props[i];
3454
3576
  descriptor.enumerable = descriptor.enumerable || false;
@@ -3457,11 +3579,11 @@ function _defineProperties$5(target, props) {
3457
3579
  Object.defineProperty(target, descriptor.key, descriptor);
3458
3580
  }
3459
3581
  }
3460
- function _create_class$5(Constructor, protoProps, staticProps) {
3461
- if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
3582
+ function _create_class$6(Constructor, protoProps, staticProps) {
3583
+ if (protoProps) _defineProperties$6(Constructor.prototype, protoProps);
3462
3584
  return Constructor;
3463
3585
  }
3464
- function _define_property$7(obj, key, value) {
3586
+ function _define_property$8(obj, key, value) {
3465
3587
  if (key in obj) {
3466
3588
  Object.defineProperty(obj, key, {
3467
3589
  value: value,
@@ -3474,13 +3596,13 @@ function _define_property$7(obj, key, value) {
3474
3596
  }
3475
3597
  return obj;
3476
3598
  }
3477
- function _iterable_to_array$1(iter) {
3599
+ function _iterable_to_array$3(iter) {
3478
3600
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3479
3601
  }
3480
- function _non_iterable_spread$1() {
3602
+ function _non_iterable_spread$3() {
3481
3603
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3482
3604
  }
3483
- function _object_spread$2(target) {
3605
+ function _object_spread$3(target) {
3484
3606
  for(var i = 1; i < arguments.length; i++){
3485
3607
  var source = arguments[i] != null ? arguments[i] : {};
3486
3608
  var ownKeys = Object.keys(source);
@@ -3490,7 +3612,7 @@ function _object_spread$2(target) {
3490
3612
  }));
3491
3613
  }
3492
3614
  ownKeys.forEach(function(key) {
3493
- _define_property$7(target, key, source[key]);
3615
+ _define_property$8(target, key, source[key]);
3494
3616
  });
3495
3617
  }
3496
3618
  return target;
@@ -3550,16 +3672,16 @@ function _object_without_properties_loose(source, excluded) {
3550
3672
  }
3551
3673
  return target;
3552
3674
  }
3553
- function _to_consumable_array$1(arr) {
3554
- return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$1();
3675
+ function _to_consumable_array$3(arr) {
3676
+ return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$3();
3555
3677
  }
3556
- function _unsupported_iterable_to_array$2(o, minLen) {
3678
+ function _unsupported_iterable_to_array$3(o, minLen) {
3557
3679
  if (!o) return;
3558
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
3680
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
3559
3681
  var n = Object.prototype.toString.call(o).slice(8, -1);
3560
3682
  if (n === "Object" && o.constructor) n = o.constructor.name;
3561
3683
  if (n === "Map" || n === "Set") return Array.from(n);
3562
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
3684
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
3563
3685
  }
3564
3686
  function _ts_generator$5(thisArg, body) {
3565
3687
  var f, y, t, _ = {
@@ -3667,14 +3789,14 @@ function _ts_generator$5(thisArg, body) {
3667
3789
  */ var OidcService = /*#__PURE__*/ function() {
3668
3790
  function OidcService(config, providerConfigService, jwksService, accountService, collections, encryptionService) {
3669
3791
  var _this = this;
3670
- _class_call_check$6(this, OidcService);
3671
- _define_property$7(this, "config", void 0);
3672
- _define_property$7(this, "providerConfigService", void 0);
3673
- _define_property$7(this, "jwksService", void 0);
3674
- _define_property$7(this, "accountService", void 0);
3675
- _define_property$7(this, "collections", void 0);
3676
- _define_property$7(this, "encryptionService", void 0);
3677
- _define_property$7(this, "_getProvider", cachedGetter(function() {
3792
+ _class_call_check$8(this, OidcService);
3793
+ _define_property$8(this, "config", void 0);
3794
+ _define_property$8(this, "providerConfigService", void 0);
3795
+ _define_property$8(this, "jwksService", void 0);
3796
+ _define_property$8(this, "accountService", void 0);
3797
+ _define_property$8(this, "collections", void 0);
3798
+ _define_property$8(this, "encryptionService", void 0);
3799
+ _define_property$8(this, "_getProvider", cachedGetter(function() {
3678
3800
  return _this._buildProvider();
3679
3801
  }));
3680
3802
  this.config = config;
@@ -3684,7 +3806,7 @@ function _ts_generator$5(thisArg, body) {
3684
3806
  this.collections = collections;
3685
3807
  this.encryptionService = encryptionService;
3686
3808
  }
3687
- _create_class$5(OidcService, [
3809
+ _create_class$6(OidcService, [
3688
3810
  {
3689
3811
  /**
3690
3812
  * Returns the oidc-provider instance, initializing it on first access.
@@ -3706,14 +3828,27 @@ function _ts_generator$5(thisArg, body) {
3706
3828
  *
3707
3829
  * Mirrors the resolution used by the `Grant`/`Session` TTL functions in {@link buildProviderConfiguration}.
3708
3830
  *
3831
+ * The `serverMaxSeconds` ceiling is tiered by {@link resolveTieredServerMaxSeconds}: a non-admin
3832
+ * caps at the non-admin tier, an admin at the admin tier, and an admin whose grant carries a
3833
+ * service-token scope at the (highest) service-token tier. This tiered value replaces the flat
3834
+ * {@link OidcModuleConfig.maxRequestedLoginDuration} ceiling so a service token can intentionally
3835
+ * exceed it.
3836
+ *
3709
3837
  * @param requestedRawTtl - The raw `dbx_session_ttl` value from `interaction.params`, if any.
3710
3838
  * @param clientPayload - The persisted client metadata, used to read the per-client `dbx_max_session_ttl` cap.
3839
+ * @param tier - Whether the resolving user is an admin and whether the grant carries a service-token scope.
3711
3840
  * @returns The resolved Grant TTL in seconds.
3712
3841
  */ key: "resolveLoginDurationForGrant",
3713
- value: function resolveLoginDurationForGrant(requestedRawTtl, clientPayload) {
3714
- var _config_maxRequestedLoginDuration, _config_minRequestedLoginDuration, _config_defaultRequestedLoginDuration;
3842
+ value: function resolveLoginDurationForGrant(requestedRawTtl, clientPayload, tier) {
3843
+ var _config_maxRequestedLoginDurationNonAdmin, _config_maxRequestedLoginDurationAdmin, _config_maxRequestedLoginDurationServiceToken, _config_minRequestedLoginDuration, _config_defaultRequestedLoginDuration;
3715
3844
  var config = this.config;
3716
- var serverMaxSeconds = (_config_maxRequestedLoginDuration = config.maxRequestedLoginDuration) !== null && _config_maxRequestedLoginDuration !== void 0 ? _config_maxRequestedLoginDuration : DEFAULT_MAX_REQUESTED_LOGIN_DURATION_SECONDS;
3845
+ var serverMaxSeconds = resolveTieredServerMaxSeconds({
3846
+ isAdmin: tier.isAdmin,
3847
+ hasServiceScope: tier.hasServiceScope,
3848
+ nonAdminMax: (_config_maxRequestedLoginDurationNonAdmin = config.maxRequestedLoginDurationNonAdmin) !== null && _config_maxRequestedLoginDurationNonAdmin !== void 0 ? _config_maxRequestedLoginDurationNonAdmin : DEFAULT_MAX_NONADMIN_LOGIN_DURATION_SECONDS,
3849
+ adminMax: (_config_maxRequestedLoginDurationAdmin = config.maxRequestedLoginDurationAdmin) !== null && _config_maxRequestedLoginDurationAdmin !== void 0 ? _config_maxRequestedLoginDurationAdmin : DEFAULT_MAX_ADMIN_LOGIN_DURATION_SECONDS,
3850
+ serviceTokenMax: (_config_maxRequestedLoginDurationServiceToken = config.maxRequestedLoginDurationServiceToken) !== null && _config_maxRequestedLoginDurationServiceToken !== void 0 ? _config_maxRequestedLoginDurationServiceToken : DEFAULT_MAX_SERVICE_TOKEN_LOGIN_DURATION_SECONDS
3851
+ });
3717
3852
  var serverMinSeconds = (_config_minRequestedLoginDuration = config.minRequestedLoginDuration) !== null && _config_minRequestedLoginDuration !== void 0 ? _config_minRequestedLoginDuration : DEFAULT_MIN_REQUESTED_LOGIN_DURATION_SECONDS;
3718
3853
  var defaultSeconds = (_config_defaultRequestedLoginDuration = config.defaultRequestedLoginDuration) !== null && _config_defaultRequestedLoginDuration !== void 0 ? _config_defaultRequestedLoginDuration : config.tokenLifetimes.grant;
3719
3854
  return resolveLoginDurationSeconds({
@@ -3760,7 +3895,7 @@ function _ts_generator$5(thisArg, body) {
3760
3895
  // (e.g., `a` for admin, `o` for onboarded) based on the granted scopes.
3761
3896
  // Read the account claims baked into the token at issuance time via extraAccessTokenClaims.
3762
3897
  accountClaims = (_accessToken_extra = accessToken.extra) !== null && _accessToken_extra !== void 0 ? _accessToken_extra : {};
3763
- token = _object_spread_props(_object_spread$2({}, accountClaims), {
3898
+ token = _object_spread_props(_object_spread$3({}, accountClaims), {
3764
3899
  // Standard JWT claims — sourced from the access token
3765
3900
  aud: firstValue(accessToken.aud),
3766
3901
  iss: this.config.issuer,
@@ -3783,7 +3918,7 @@ function _ts_generator$5(thisArg, body) {
3783
3918
  uid: accessToken.accountId,
3784
3919
  token: token,
3785
3920
  rawToken: rawToken,
3786
- oidcValidatedToken: _object_spread$2({
3921
+ oidcValidatedToken: _object_spread$3({
3787
3922
  sub: accessToken.accountId,
3788
3923
  scope: accessToken.scope,
3789
3924
  client_id: accessToken.clientId
@@ -3937,10 +4072,10 @@ function _ts_generator$5(thisArg, body) {
3937
4072
  defaultSeconds: overrideDefaultSeconds !== null && overrideDefaultSeconds !== void 0 ? overrideDefaultSeconds : perModelDefaultSeconds
3938
4073
  });
3939
4074
  };
3940
- return _object_spread_props(_object_spread$2({
3941
- routes: _object_spread$2({}, this.providerConfigService.routes),
3942
- claims: _object_spread$2({}, providerConfig.claims),
3943
- responseTypes: _to_consumable_array$1(providerConfig.responseTypes),
4075
+ return _object_spread_props(_object_spread$3({
4076
+ routes: _object_spread$3({}, this.providerConfigService.routes),
4077
+ claims: _object_spread$3({}, providerConfig.claims),
4078
+ responseTypes: _to_consumable_array$3(providerConfig.responseTypes),
3944
4079
  pkce: {
3945
4080
  required: function required() {
3946
4081
  return true;
@@ -3975,7 +4110,7 @@ function _ts_generator$5(thisArg, body) {
3975
4110
  }
3976
4111
  return [
3977
4112
  2,
3978
- _object_spread$2({
4113
+ _object_spread$3({
3979
4114
  scope: info.scope
3980
4115
  }, info.audience === undefined ? {} : {
3981
4116
  audience: info.audience
@@ -4069,7 +4204,7 @@ function _ts_generator$5(thisArg, body) {
4069
4204
  logo_uri: client.logo_uri,
4070
4205
  scopes: scopes
4071
4206
  };
4072
- paramsToEncode = _object_spread$2({}, paramsToEncode, interactionLoginDetails);
4207
+ paramsToEncode = _object_spread$3({}, paramsToEncode, interactionLoginDetails);
4073
4208
  }
4074
4209
  _state.label = 3;
4075
4210
  case 3:
@@ -4091,11 +4226,29 @@ function _ts_generator$5(thisArg, body) {
4091
4226
  }, config.renderError ? {
4092
4227
  renderError: config.renderError
4093
4228
  } : {}), {
4229
+ // Setting `rotateRefreshToken` disables oidc-provider's built-in default, so we both honor the
4230
+ // dbx-components `nonRotatingScopes` extension (service tokens never rotate, keeping a stable
4231
+ // refresh token for server env consumption) AND replicate the library default for every other
4232
+ // grant. See `shouldRotateRefreshToken` — keep it in sync on oidc-provider upgrades.
4233
+ rotateRefreshToken: function rotateRefreshToken(ctx) {
4234
+ var _providerConfig_nonRotatingScopes, _ref, _ref1, _ref2;
4235
+ var _refreshToken_totalLifetime, _refreshToken_isSenderConstrained, _refreshToken_ttlPercentagePassed;
4236
+ var refreshToken = ctx.oidc.entities.RefreshToken;
4237
+ var client = ctx.oidc.entities.Client;
4238
+ return shouldRotateRefreshToken({
4239
+ scope: refreshToken === null || refreshToken === void 0 ? void 0 : refreshToken.scope,
4240
+ nonRotatingScopes: (_providerConfig_nonRotatingScopes = providerConfig.nonRotatingScopes) !== null && _providerConfig_nonRotatingScopes !== void 0 ? _providerConfig_nonRotatingScopes : [],
4241
+ totalLifetimeSeconds: (_ref = refreshToken === null || refreshToken === void 0 ? void 0 : (_refreshToken_totalLifetime = refreshToken.totalLifetime) === null || _refreshToken_totalLifetime === void 0 ? void 0 : _refreshToken_totalLifetime.call(refreshToken)) !== null && _ref !== void 0 ? _ref : 0,
4242
+ clientAuthMethod: client === null || client === void 0 ? void 0 : client.clientAuthMethod,
4243
+ isSenderConstrained: (_ref1 = refreshToken === null || refreshToken === void 0 ? void 0 : (_refreshToken_isSenderConstrained = refreshToken.isSenderConstrained) === null || _refreshToken_isSenderConstrained === void 0 ? void 0 : _refreshToken_isSenderConstrained.call(refreshToken)) !== null && _ref1 !== void 0 ? _ref1 : false,
4244
+ ttlPercentagePassed: (_ref2 = refreshToken === null || refreshToken === void 0 ? void 0 : (_refreshToken_ttlPercentagePassed = refreshToken.ttlPercentagePassed) === null || _refreshToken_ttlPercentagePassed === void 0 ? void 0 : _refreshToken_ttlPercentagePassed.call(refreshToken)) !== null && _ref2 !== void 0 ? _ref2 : 0
4245
+ });
4246
+ },
4094
4247
  // Bake account claims into the access token at issuance time so they're
4095
4248
  // available via `accessToken.extra` during verification without an extra DB call.
4096
4249
  extraTokenClaims: function extraTokenClaims(_ctx, token) {
4097
4250
  return _async_to_generator$5(function() {
4098
- var accountId, scope, result, account, claims, extraClaims;
4251
+ var accountId, scope, result, account, claims, extraClaims, _providerConfig_nonRotatingScopes, nonRotatingScopes, scopeSet, provider, grant;
4099
4252
  return _ts_generator$5(this, function(_state) {
4100
4253
  switch(_state.label){
4101
4254
  case 0:
@@ -4126,9 +4279,40 @@ function _ts_generator$5(thisArg, body) {
4126
4279
  "sub"
4127
4280
  ]);
4128
4281
  // Filter out undefined values — the Firestore adapter cannot serialize them.
4129
- result = filterUndefinedValues(extraClaims);
4282
+ Object.assign(result, filterUndefinedValues(extraClaims));
4130
4283
  _state.label = 3;
4131
4284
  case 3:
4285
+ // Surface the resolved session lifetime + rotation status so clients (e.g. the CLI) can show
4286
+ // "valid until <date>, rotation: disabled" without decoding the opaque access token. These ride
4287
+ // on `accessToken.extra` and are read back by `verifyAccessToken` and the `GET /oidc/session` route.
4288
+ if (scope != null) {
4289
+ nonRotatingScopes = (_providerConfig_nonRotatingScopes = providerConfig.nonRotatingScopes) !== null && _providerConfig_nonRotatingScopes !== void 0 ? _providerConfig_nonRotatingScopes : [];
4290
+ scopeSet = new Set(scope.split(' ').filter(Boolean));
4291
+ result[DBX_FIREBASE_SERVER_OIDC_ROTATION_DISABLED_CLAIM] = nonRotatingScopes.some(function(nonRotatingScope) {
4292
+ return scopeSet.has(nonRotatingScope);
4293
+ });
4294
+ }
4295
+ if (!token.grantId) return [
4296
+ 3,
4297
+ 6
4298
+ ];
4299
+ return [
4300
+ 4,
4301
+ this.getProvider()
4302
+ ];
4303
+ case 4:
4304
+ provider = _state.sent();
4305
+ return [
4306
+ 4,
4307
+ provider.Grant.find(token.grantId)
4308
+ ];
4309
+ case 5:
4310
+ grant = _state.sent();
4311
+ if ((grant === null || grant === void 0 ? void 0 : grant.exp) != null && Number.isFinite(grant.exp)) {
4312
+ result[DBX_FIREBASE_SERVER_OIDC_SESSION_EXPIRES_AT_CLAIM] = grant.exp;
4313
+ }
4314
+ _state.label = 6;
4315
+ case 6:
4132
4316
  return [
4133
4317
  2,
4134
4318
  result
@@ -4187,7 +4371,7 @@ function _ts_generator$5(thisArg, body) {
4187
4371
  ];
4188
4372
  case 4:
4189
4373
  _ref = _state.sent(), ProviderClass = _ref.default;
4190
- provider = new ProviderClass(config.issuer, _object_spread_props(_object_spread$2({}, providerConfiguration), {
4374
+ provider = new ProviderClass(config.issuer, _object_spread_props(_object_spread$3({}, providerConfiguration), {
4191
4375
  adapter: adapterFactory,
4192
4376
  findAccount: findAccount,
4193
4377
  jwks: {
@@ -4225,12 +4409,12 @@ OidcService = __decorate([
4225
4409
  __param(5, Inject(OidcEncryptionService))
4226
4410
  ], OidcService);
4227
4411
 
4228
- function _class_call_check$5(instance, Constructor) {
4412
+ function _class_call_check$7(instance, Constructor) {
4229
4413
  if (!(instance instanceof Constructor)) {
4230
4414
  throw new TypeError("Cannot call a class as a function");
4231
4415
  }
4232
4416
  }
4233
- function _define_property$6(obj, key, value) {
4417
+ function _define_property$7(obj, key, value) {
4234
4418
  if (key in obj) {
4235
4419
  Object.defineProperty(obj, key, {
4236
4420
  value: value,
@@ -4268,14 +4452,14 @@ function _define_property$6(obj, key, value) {
4268
4452
  * export class MyApiModule {}
4269
4453
  * ```
4270
4454
  */ var OidcAuthMiddlewareConfig = function OidcAuthMiddlewareConfig() {
4271
- _class_call_check$5(this, OidcAuthMiddlewareConfig);
4455
+ _class_call_check$7(this, OidcAuthMiddlewareConfig);
4272
4456
  /**
4273
4457
  * Path prefixes that require OAuth bearer token verification.
4274
4458
  *
4275
4459
  * Only requests matching one of these prefixes will be checked.
4276
4460
  * Paths under the global API route prefix should not be included
4277
4461
  * since those are protected by AppCheck.
4278
- */ _define_property$6(this, "protectedPaths", void 0);
4462
+ */ _define_property$7(this, "protectedPaths", void 0);
4279
4463
  /**
4280
4464
  * Absolute URL of the OAuth 2.0 Protected Resource Metadata document
4281
4465
  * (RFC 9728). When set, included as the `resource_metadata` parameter
@@ -4283,7 +4467,7 @@ function _define_property$6(obj, key, value) {
4283
4467
  * clients can locate the discovery doc explicitly rather than relying on
4284
4468
  * origin-rooted path-walkback (which fails when the function isn't
4285
4469
  * mounted at `/` — e.g. behind the Firebase Functions emulator URL prefix).
4286
- */ _define_property$6(this, "resourceMetadataUrl", void 0);
4470
+ */ _define_property$7(this, "resourceMetadataUrl", void 0);
4287
4471
  };
4288
4472
  // MARK: WWW-Authenticate
4289
4473
  /**
@@ -4423,12 +4607,12 @@ function _async_to_generator$4(fn) {
4423
4607
  });
4424
4608
  };
4425
4609
  }
4426
- function _class_call_check$4(instance, Constructor) {
4610
+ function _class_call_check$6(instance, Constructor) {
4427
4611
  if (!(instance instanceof Constructor)) {
4428
4612
  throw new TypeError("Cannot call a class as a function");
4429
4613
  }
4430
4614
  }
4431
- function _defineProperties$4(target, props) {
4615
+ function _defineProperties$5(target, props) {
4432
4616
  for(var i = 0; i < props.length; i++){
4433
4617
  var descriptor = props[i];
4434
4618
  descriptor.enumerable = descriptor.enumerable || false;
@@ -4437,11 +4621,11 @@ function _defineProperties$4(target, props) {
4437
4621
  Object.defineProperty(target, descriptor.key, descriptor);
4438
4622
  }
4439
4623
  }
4440
- function _create_class$4(Constructor, protoProps, staticProps) {
4441
- if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
4624
+ function _create_class$5(Constructor, protoProps, staticProps) {
4625
+ if (protoProps) _defineProperties$5(Constructor.prototype, protoProps);
4442
4626
  return Constructor;
4443
4627
  }
4444
- function _define_property$5(obj, key, value) {
4628
+ function _define_property$6(obj, key, value) {
4445
4629
  if (key in obj) {
4446
4630
  Object.defineProperty(obj, key, {
4447
4631
  value: value,
@@ -4591,14 +4775,14 @@ function _ts_generator$4(thisArg, body) {
4591
4775
  * @throws {UnauthorizedException} When the Authorization header is missing, malformed, or the token is invalid/expired.
4592
4776
  */ var OidcAuthBearerTokenMiddleware = /*#__PURE__*/ function() {
4593
4777
  function OidcAuthBearerTokenMiddleware(oidcService, config) {
4594
- _class_call_check$4(this, OidcAuthBearerTokenMiddleware);
4595
- _define_property$5(this, "oidcService", void 0);
4596
- _define_property$5(this, "config", void 0);
4597
- _define_property$5(this, "logger", new Logger('OidcAuthBearerTokenMiddleware'));
4778
+ _class_call_check$6(this, OidcAuthBearerTokenMiddleware);
4779
+ _define_property$6(this, "oidcService", void 0);
4780
+ _define_property$6(this, "config", void 0);
4781
+ _define_property$6(this, "logger", new Logger('OidcAuthBearerTokenMiddleware'));
4598
4782
  this.oidcService = oidcService;
4599
4783
  this.config = config;
4600
4784
  }
4601
- _create_class$4(OidcAuthBearerTokenMiddleware, [
4785
+ _create_class$5(OidcAuthBearerTokenMiddleware, [
4602
4786
  {
4603
4787
  key: "use",
4604
4788
  value: function use(req, res, next) {
@@ -4719,19 +4903,328 @@ OidcAuthBearerTokenMiddleware = __decorate([
4719
4903
  });
4720
4904
  }
4721
4905
 
4722
- // MARK: Scopes
4723
4906
  /**
4724
- * Reads the set of OIDC scopes carried by a callable request's bearer token.
4907
+ * Default prefix prepended to every resolved OIDC analytics event name forwarded
4908
+ * to the downstream analytics pipeline (e.g. `'OIDC ' + 'Login'` → `'OIDC Login'`).
4909
+ */ var DEFAULT_OIDC_ANALYTICS_EVENT_NAME_PREFIX = 'OIDC ';
4910
+ /**
4911
+ * Default per-type downstream event name parts (the {@link DEFAULT_OIDC_ANALYTICS_EVENT_NAME_PREFIX}
4912
+ * is prepended at send time).
4913
+ */ var DEFAULT_OIDC_ANALYTICS_EVENT_NAMES = {
4914
+ login: 'Login',
4915
+ consent: 'Consent'
4916
+ };
4917
+ /**
4918
+ * NestJS injection token for the optional {@link FirebaseServerOidcAnalyticsConfig} provider.
4725
4919
  *
4726
- * The `ModelApiCallModelDispatchService` builds a synthetic `CallableRequest` with
4727
- * `auth.token = oidcValidatedToken ?? {}`, so the OIDC scope string lives at
4728
- * `request.auth.token.scope` for OIDC callers and is `undefined` for non-OIDC
4729
- * (regular Firebase ID-token) callers.
4920
+ * @example
4921
+ * ```typescript
4922
+ * @Module(appOidcAnalyticsModuleMetadata({ oidcAnalyticsConfig: { eventNamePrefix: 'OIDC ', logEvents: true } }))
4923
+ * export class AppOidcAnalyticsModule {}
4924
+ * ```
4925
+ */ var FIREBASE_SERVER_OIDC_ANALYTICS_CONFIG = 'FIREBASE_SERVER_OIDC_ANALYTICS_CONFIG';
4926
+
4927
+ function _class_call_check$5(instance, Constructor) {
4928
+ if (!(instance instanceof Constructor)) {
4929
+ throw new TypeError("Cannot call a class as a function");
4930
+ }
4931
+ }
4932
+ /**
4933
+ * Abstract analytics service that apps implement to process OIDC analytics events.
4730
4934
  *
4731
- * Returning `undefined` for non-OIDC callers lets callers (e.g. `oidcCallModelScopePreAssert`)
4732
- * skip scope enforcement instead of falsely treating the missing claim as "no scopes granted".
4935
+ * Analogous to the MCP `McpAnalyticsService` but scoped to the OIDC/OAuth transport.
4936
+ * Apps extend this class and provide it via {@link OIDC_ANALYTICS_SERVICE}.
4937
+ */ var OidcAnalyticsService = function OidcAnalyticsService() {
4938
+ _class_call_check$5(this, OidcAnalyticsService);
4939
+ };
4940
+ /**
4941
+ * Injection token for the OIDC analytics service.
4733
4942
  *
4734
- * The parameter is intentionally typed as `unknown` because `DecodedIdToken` (Firebase
4943
+ * Apps provide this (typically via {@link appOidcAnalyticsModuleMetadata} on a `@Global()`
4944
+ * module) to enable analytics in the OIDC dispatch chain. When absent, the OIDC emitters
4945
+ * fall back to {@link noopOidcAnalyticsService}.
4946
+ */ var OIDC_ANALYTICS_SERVICE = 'OIDC_ANALYTICS_SERVICE';
4947
+ /**
4948
+ * Creates a no-op {@link OidcAnalyticsService} that silently discards all events.
4949
+ *
4950
+ * Used as the default fallback by the OIDC emitters when no analytics service is registered.
4951
+ *
4952
+ * @returns An {@link OidcAnalyticsService} that discards all analytics events.
4953
+ * @__NO_SIDE_EFFECTS__
4954
+ */ function noopOidcAnalyticsService() {
4955
+ return {
4956
+ handleOidcAnalyticsEvent: function handleOidcAnalyticsEvent() {
4957
+ return undefined;
4958
+ }
4959
+ };
4960
+ }
4961
+ /**
4962
+ * Forwards an {@link OidcAnalyticsEvent} to the given service, fail-soft.
4963
+ *
4964
+ * A throwing analytics handler must never break the underlying OIDC operation, so the
4965
+ * handler invocation is wrapped — on error a warning is logged and the error is swallowed.
4966
+ * Mirrors the MCP `_emitMcpAnalytics` discipline, factored to a free function because the
4967
+ * OIDC events fire from several emitters.
4968
+ *
4969
+ * @param service - The analytics service to forward to.
4970
+ * @param event - The event to emit.
4971
+ * @param logger - The emitter's logger, used to warn when the handler throws.
4972
+ */ function emitOidcAnalyticsEvent(service, event, logger) {
4973
+ try {
4974
+ service.handleOidcAnalyticsEvent(event);
4975
+ } catch (error) {
4976
+ logger.warn("OIDC analytics handler threw for event ".concat(event.type, "; ignoring: ").concat(error));
4977
+ }
4978
+ }
4979
+
4980
+ function _assert_this_initialized(self) {
4981
+ if (self === void 0) {
4982
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4983
+ }
4984
+ return self;
4985
+ }
4986
+ function _call_super(_this, derived, args) {
4987
+ derived = _get_prototype_of(derived);
4988
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
4989
+ }
4990
+ function _class_call_check$4(instance, Constructor) {
4991
+ if (!(instance instanceof Constructor)) {
4992
+ throw new TypeError("Cannot call a class as a function");
4993
+ }
4994
+ }
4995
+ function _defineProperties$4(target, props) {
4996
+ for(var i = 0; i < props.length; i++){
4997
+ var descriptor = props[i];
4998
+ descriptor.enumerable = descriptor.enumerable || false;
4999
+ descriptor.configurable = true;
5000
+ if ("value" in descriptor) descriptor.writable = true;
5001
+ Object.defineProperty(target, descriptor.key, descriptor);
5002
+ }
5003
+ }
5004
+ function _create_class$4(Constructor, protoProps, staticProps) {
5005
+ if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
5006
+ return Constructor;
5007
+ }
5008
+ function _define_property$5(obj, key, value) {
5009
+ if (key in obj) {
5010
+ Object.defineProperty(obj, key, {
5011
+ value: value,
5012
+ enumerable: true,
5013
+ configurable: true,
5014
+ writable: true
5015
+ });
5016
+ } else {
5017
+ obj[key] = value;
5018
+ }
5019
+ return obj;
5020
+ }
5021
+ function _get_prototype_of(o) {
5022
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
5023
+ return o.__proto__ || Object.getPrototypeOf(o);
5024
+ };
5025
+ return _get_prototype_of(o);
5026
+ }
5027
+ function _inherits(subClass, superClass) {
5028
+ if (typeof superClass !== "function" && superClass !== null) {
5029
+ throw new TypeError("Super expression must either be null or a function");
5030
+ }
5031
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
5032
+ constructor: {
5033
+ value: subClass,
5034
+ writable: true,
5035
+ configurable: true
5036
+ }
5037
+ });
5038
+ if (superClass) _set_prototype_of(subClass, superClass);
5039
+ }
5040
+ function _object_spread$2(target) {
5041
+ for(var i = 1; i < arguments.length; i++){
5042
+ var source = arguments[i] != null ? arguments[i] : {};
5043
+ var ownKeys = Object.keys(source);
5044
+ if (typeof Object.getOwnPropertySymbols === "function") {
5045
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
5046
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
5047
+ }));
5048
+ }
5049
+ ownKeys.forEach(function(key) {
5050
+ _define_property$5(target, key, source[key]);
5051
+ });
5052
+ }
5053
+ return target;
5054
+ }
5055
+ function _possible_constructor_return(self, call) {
5056
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
5057
+ return call;
5058
+ }
5059
+ return _assert_this_initialized(self);
5060
+ }
5061
+ function _set_prototype_of(o, p) {
5062
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
5063
+ o.__proto__ = p;
5064
+ return o;
5065
+ };
5066
+ return _set_prototype_of(o, p);
5067
+ }
5068
+ function _type_of(obj) {
5069
+ "@swc/helpers - typeof";
5070
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
5071
+ }
5072
+ function _is_native_reflect_construct() {
5073
+ try {
5074
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
5075
+ } catch (_) {}
5076
+ return (_is_native_reflect_construct = function() {
5077
+ return !!result;
5078
+ })();
5079
+ }
5080
+ var FirebaseServerOidcAnalyticsService_1;
5081
+ /**
5082
+ * Reusable {@link OidcAnalyticsService} that forwards each high-level OIDC event to the app's
5083
+ * {@link FirebaseServerAnalyticsService}, so OIDC-transport analytics feed the same downstream
5084
+ * pipeline (e.g. Segment) as model and MCP analytics.
5085
+ *
5086
+ * Each {@link OidcAnalyticsEvent.type} resolves to a distinct downstream event name
5087
+ * (`eventNamePrefix` + per-type name, e.g. `'OIDC Login'`). Registered globally via
5088
+ * {@link appOidcAnalyticsModuleMetadata}; tuned via {@link FirebaseServerOidcAnalyticsConfig}.
5089
+ * When no analytics service is available the call is a no-op aside from the optional log line.
5090
+ */ var FirebaseServerOidcAnalyticsService = FirebaseServerOidcAnalyticsService_1 = /*#__PURE__*/ function(OidcAnalyticsService) {
5091
+ _inherits(FirebaseServerOidcAnalyticsService, OidcAnalyticsService);
5092
+ function FirebaseServerOidcAnalyticsService(firebaseServerEnvService, analyticsService, config) {
5093
+ _class_call_check$4(this, FirebaseServerOidcAnalyticsService);
5094
+ var _this;
5095
+ var _ref, _ref1;
5096
+ _this = _call_super(this, FirebaseServerOidcAnalyticsService), _define_property$5(_this, "firebaseServerEnvService", void 0), _define_property$5(_this, "analyticsService", void 0), _define_property$5(_this, "_logger", new Logger(FirebaseServerOidcAnalyticsService_1.name)), _define_property$5(_this, "_eventNamePrefix", void 0), _define_property$5(_this, "_eventNames", void 0), _define_property$5(_this, "_logEvents", void 0);
5097
+ _this.firebaseServerEnvService = firebaseServerEnvService;
5098
+ _this.analyticsService = analyticsService;
5099
+ _this._eventNamePrefix = (_ref = config === null || config === void 0 ? void 0 : config.eventNamePrefix) !== null && _ref !== void 0 ? _ref : DEFAULT_OIDC_ANALYTICS_EVENT_NAME_PREFIX;
5100
+ _this._eventNames = _object_spread$2({}, DEFAULT_OIDC_ANALYTICS_EVENT_NAMES, config === null || config === void 0 ? void 0 : config.eventNames);
5101
+ _this._logEvents = (_ref1 = config === null || config === void 0 ? void 0 : config.logEvents) !== null && _ref1 !== void 0 ? _ref1 : !_this.firebaseServerEnvService.isProduction;
5102
+ return _this;
5103
+ }
5104
+ _create_class$4(FirebaseServerOidcAnalyticsService, [
5105
+ {
5106
+ key: "handleOidcAnalyticsEvent",
5107
+ value: function handleOidcAnalyticsEvent(event) {
5108
+ var _this__eventNames_event_type;
5109
+ var name = "".concat(this._eventNamePrefix).concat((_this__eventNames_event_type = this._eventNames[event.type]) !== null && _this__eventNames_event_type !== void 0 ? _this__eventNames_event_type : event.type);
5110
+ if (this._logEvents) {
5111
+ var uidSuffix = event.uid ? " uid=".concat(event.uid) : '';
5112
+ var durationSuffix = event.durationMs != null ? " (".concat(event.durationMs, "ms)") : '';
5113
+ var outcome = event.isSuccessful ? 'Succeeded' : 'Failed';
5114
+ var reasonSuffix = event.reason ? " reason=".concat(event.reason) : '';
5115
+ this._logger.log("".concat(name, " ").concat(outcome).concat(uidSuffix).concat(reasonSuffix).concat(durationSuffix));
5116
+ }
5117
+ if (this.analyticsService != null) {
5118
+ var _event_clientId, _event_serviceToken, _event_isAdmin, _event_denied, _event_reason;
5119
+ // Drop undefined values so the downstream payload stays clean.
5120
+ var data = filterUndefinedValues({
5121
+ clientId: (_event_clientId = event.clientId) !== null && _event_clientId !== void 0 ? _event_clientId : undefined,
5122
+ scopes: event.scopes != null && event.scopes.length > 0 ? event.scopes.join(' ') : undefined,
5123
+ serviceToken: (_event_serviceToken = event.serviceToken) !== null && _event_serviceToken !== void 0 ? _event_serviceToken : undefined,
5124
+ isAdmin: (_event_isAdmin = event.isAdmin) !== null && _event_isAdmin !== void 0 ? _event_isAdmin : undefined,
5125
+ denied: (_event_denied = event.denied) !== null && _event_denied !== void 0 ? _event_denied : undefined,
5126
+ reason: (_event_reason = event.reason) !== null && _event_reason !== void 0 ? _event_reason : undefined,
5127
+ success: event.isSuccessful
5128
+ });
5129
+ this.analyticsService.sendEventData(event.uid, name, data);
5130
+ }
5131
+ }
5132
+ }
5133
+ ]);
5134
+ return FirebaseServerOidcAnalyticsService;
5135
+ }(OidcAnalyticsService);
5136
+ FirebaseServerOidcAnalyticsService = FirebaseServerOidcAnalyticsService_1 = __decorate([
5137
+ Injectable(),
5138
+ __param(0, Inject(FirebaseServerEnvService)),
5139
+ __param(1, Optional()),
5140
+ __param(1, Inject(FirebaseServerAnalyticsService)),
5141
+ __param(2, Optional()),
5142
+ __param(2, Inject(FIREBASE_SERVER_OIDC_ANALYTICS_CONFIG))
5143
+ ], FirebaseServerOidcAnalyticsService);
5144
+
5145
+ function _array_like_to_array$2(arr, len) {
5146
+ if (len == null || len > arr.length) len = arr.length;
5147
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5148
+ return arr2;
5149
+ }
5150
+ function _array_without_holes$2(arr) {
5151
+ if (Array.isArray(arr)) return _array_like_to_array$2(arr);
5152
+ }
5153
+ function _iterable_to_array$2(iter) {
5154
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
5155
+ }
5156
+ function _non_iterable_spread$2() {
5157
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5158
+ }
5159
+ function _to_consumable_array$2(arr) {
5160
+ return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$2();
5161
+ }
5162
+ function _unsupported_iterable_to_array$2(o, minLen) {
5163
+ if (!o) return;
5164
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
5165
+ var n = Object.prototype.toString.call(o).slice(8, -1);
5166
+ if (n === "Object" && o.constructor) n = o.constructor.name;
5167
+ if (n === "Map" || n === "Set") return Array.from(n);
5168
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
5169
+ }
5170
+ /**
5171
+ * Generates NestJS module metadata that registers {@link FirebaseServerOidcAnalyticsService} as the
5172
+ * OIDC analytics consumer, aliased to {@link OIDC_ANALYTICS_SERVICE}.
5173
+ *
5174
+ * Mirrors the convention used by `appMcpAnalyticsModuleMetadata`. Requires no dependency module —
5175
+ * `FirebaseServerAnalyticsService` is resolved optionally and is expected to be supplied globally by
5176
+ * the app's analytics module.
5177
+ *
5178
+ * Decorate a `@Global()` module with the result so the `OIDC_ANALYTICS_SERVICE` token is visible to
5179
+ * the OIDC controllers and services provided by the app's OIDC module.
5180
+ *
5181
+ * @param config - Optional metadata + analytics config to merge in.
5182
+ * @returns NestJS module metadata providing + exporting the OIDC analytics service and token.
5183
+ *
5184
+ * @example
5185
+ * ```typescript
5186
+ * @Global()
5187
+ * @Module(appOidcAnalyticsModuleMetadata())
5188
+ * export class AppOidcAnalyticsModule {}
5189
+ * ```
5190
+ */ function appOidcAnalyticsModuleMetadata() {
5191
+ var config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
5192
+ var oidcAnalyticsConfig = config.oidcAnalyticsConfig, imports = config.imports, exports = config.exports, providers = config.providers;
5193
+ var configProviders = oidcAnalyticsConfig ? [
5194
+ {
5195
+ provide: FIREBASE_SERVER_OIDC_ANALYTICS_CONFIG,
5196
+ useValue: oidcAnalyticsConfig
5197
+ }
5198
+ ] : [];
5199
+ return {
5200
+ imports: _to_consumable_array$2(imports !== null && imports !== void 0 ? imports : []),
5201
+ exports: [
5202
+ OIDC_ANALYTICS_SERVICE,
5203
+ FirebaseServerOidcAnalyticsService
5204
+ ].concat(_to_consumable_array$2(exports !== null && exports !== void 0 ? exports : [])),
5205
+ providers: [
5206
+ FirebaseServerOidcAnalyticsService,
5207
+ {
5208
+ provide: OIDC_ANALYTICS_SERVICE,
5209
+ useExisting: FirebaseServerOidcAnalyticsService
5210
+ }
5211
+ ].concat(_to_consumable_array$2(configProviders), _to_consumable_array$2(providers !== null && providers !== void 0 ? providers : []))
5212
+ };
5213
+ }
5214
+
5215
+ // MARK: Scopes
5216
+ /**
5217
+ * Reads the set of OIDC scopes carried by a callable request's bearer token.
5218
+ *
5219
+ * The `ModelApiCallModelDispatchService` builds a synthetic `CallableRequest` with
5220
+ * `auth.token = oidcValidatedToken ?? {}`, so the OIDC scope string lives at
5221
+ * `request.auth.token.scope` for OIDC callers and is `undefined` for non-OIDC
5222
+ * (regular Firebase ID-token) callers.
5223
+ *
5224
+ * Returning `undefined` for non-OIDC callers lets callers (e.g. `oidcCallModelScopePreAssert`)
5225
+ * skip scope enforcement instead of falsely treating the missing claim as "no scopes granted".
5226
+ *
5227
+ * The parameter is intentionally typed as `unknown` because `DecodedIdToken` (Firebase
4735
5228
  * Auth's typed token shape) does not declare a `scope` field, while OIDC bearer-token
4736
5229
  * callers attach one at runtime. Reading is done defensively.
4737
5230
  *
@@ -5017,7 +5510,7 @@ function _ts_generator$3(thisArg, body) {
5017
5510
  * @param result - The interaction results to apply.
5018
5511
  * @param options - Optional settings for merging with the last submission.
5019
5512
  * @param options.mergeWithLastSubmission - Whether to merge with the last submission (defaults to true)
5020
- * @returns The `returnTo` URL that the client should redirect to.
5513
+ * @returns The interaction that was completed. It includes the returnTo property for the next step of the interaction.
5021
5514
  */ function finishInteractionByUid(uid, result, options) {
5022
5515
  return _async_to_generator$3(function() {
5023
5516
  var _ref, interaction, mergeWithLastSubmission;
@@ -5044,7 +5537,7 @@ function _ts_generator$3(thisArg, body) {
5044
5537
  _state.sent();
5045
5538
  return [
5046
5539
  2,
5047
- interaction.returnTo
5540
+ interaction
5048
5541
  ];
5049
5542
  }
5050
5543
  });
@@ -5134,6 +5627,9 @@ function _array_like_to_array$1(arr, len) {
5134
5627
  function _array_with_holes(arr) {
5135
5628
  if (Array.isArray(arr)) return arr;
5136
5629
  }
5630
+ function _array_without_holes$1(arr) {
5631
+ if (Array.isArray(arr)) return _array_like_to_array$1(arr);
5632
+ }
5137
5633
  function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
5138
5634
  try {
5139
5635
  var info = gen[key](arg);
@@ -5202,6 +5698,9 @@ function _instanceof(left, right) {
5202
5698
  return left instanceof right;
5203
5699
  }
5204
5700
  }
5701
+ function _iterable_to_array$1(iter) {
5702
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
5703
+ }
5205
5704
  function _iterable_to_array_limit(arr, i) {
5206
5705
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
5207
5706
  if (_i == null) return;
@@ -5229,9 +5728,15 @@ function _iterable_to_array_limit(arr, i) {
5229
5728
  function _non_iterable_rest() {
5230
5729
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5231
5730
  }
5731
+ function _non_iterable_spread$1() {
5732
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5733
+ }
5232
5734
  function _sliced_to_array(arr, i) {
5233
5735
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest();
5234
5736
  }
5737
+ function _to_consumable_array$1(arr) {
5738
+ return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread$1();
5739
+ }
5235
5740
  function _unsupported_iterable_to_array$1(o, minLen) {
5236
5741
  if (!o) return;
5237
5742
  if (typeof o === "string") return _array_like_to_array$1(o, minLen);
@@ -5339,6 +5844,7 @@ function _ts_generator$2(thisArg, body) {
5339
5844
  };
5340
5845
  }
5341
5846
  }
5847
+ var OidcInteractionController_1;
5342
5848
  /**
5343
5849
  * OIDC scopes that the server always grants on consent when they were
5344
5850
  * requested, regardless of whether the frontend included them in
@@ -5357,17 +5863,20 @@ function _ts_generator$2(thisArg, body) {
5357
5863
  * The POST endpoints are called by the frontend app. They verify the user's
5358
5864
  * Firebase Auth ID token and bypass the oidc-provider interaction cookie
5359
5865
  * (which is scoped to the frontend path set by `interactions.url`).
5360
- */ var OidcInteractionController = /*#__PURE__*/ function() {
5361
- function OidcInteractionController(oidcInteractionService, oidcProviderConfigService, accountService, oidcService) {
5866
+ */ var OidcInteractionController = OidcInteractionController_1 = /*#__PURE__*/ function() {
5867
+ function OidcInteractionController(oidcInteractionService, oidcProviderConfigService, accountService, oidcService, analytics) {
5362
5868
  _class_call_check$2(this, OidcInteractionController);
5363
5869
  _define_property$3(this, "oidcInteractionService", void 0);
5364
5870
  _define_property$3(this, "oidcProviderConfigService", void 0);
5365
5871
  _define_property$3(this, "accountService", void 0);
5366
5872
  _define_property$3(this, "oidcService", void 0);
5873
+ _define_property$3(this, "_logger", new Logger(OidcInteractionController_1.name));
5874
+ _define_property$3(this, "_analytics", void 0);
5367
5875
  this.oidcInteractionService = oidcInteractionService;
5368
5876
  this.oidcProviderConfigService = oidcProviderConfigService;
5369
5877
  this.accountService = accountService;
5370
5878
  this.oidcService = oidcService;
5879
+ this._analytics = analytics !== null && analytics !== void 0 ? analytics : noopOidcAnalyticsService();
5371
5880
  }
5372
5881
  _create_class$2(OidcInteractionController, [
5373
5882
  {
@@ -5433,23 +5942,45 @@ function _ts_generator$2(thisArg, body) {
5433
5942
  * @throws {HttpException} HTTP 400 when the login interaction cannot be completed.
5434
5943
  */ function postLogin(uid, body, res) {
5435
5944
  return _async_to_generator$2(function() {
5436
- var accountId, redirectTo;
5945
+ var startedAt, accountId, err, interaction, err1;
5437
5946
  return _ts_generator$2(this, function(_state) {
5438
5947
  switch(_state.label){
5439
5948
  case 0:
5949
+ startedAt = Date.now();
5950
+ _state.label = 1;
5951
+ case 1:
5952
+ _state.trys.push([
5953
+ 1,
5954
+ 3,
5955
+ ,
5956
+ 4
5957
+ ]);
5440
5958
  return [
5441
5959
  4,
5442
5960
  this._verifyIdToken(body.idToken)
5443
5961
  ];
5444
- case 1:
5445
- accountId = _state.sent();
5446
- _state.label = 2;
5447
5962
  case 2:
5963
+ accountId = _state.sent();
5964
+ return [
5965
+ 3,
5966
+ 4
5967
+ ];
5968
+ case 3:
5969
+ err = _state.sent();
5970
+ emitOidcAnalyticsEvent(this._analytics, {
5971
+ type: 'login',
5972
+ isSuccessful: false,
5973
+ reason: 'invalid_id_token',
5974
+ error: err,
5975
+ durationMs: Date.now() - startedAt
5976
+ }, this._logger);
5977
+ throw err;
5978
+ case 4:
5448
5979
  _state.trys.push([
5449
- 2,
5450
5980
  4,
5981
+ 6,
5451
5982
  ,
5452
- 5
5983
+ 7
5453
5984
  ]);
5454
5985
  return [
5455
5986
  4,
@@ -5461,19 +5992,33 @@ function _ts_generator$2(thisArg, body) {
5461
5992
  mergeWithLastSubmission: false
5462
5993
  })
5463
5994
  ];
5464
- case 3:
5465
- redirectTo = _state.sent();
5995
+ case 5:
5996
+ interaction = _state.sent();
5997
+ emitOidcAnalyticsEvent(this._analytics, {
5998
+ type: 'login',
5999
+ isSuccessful: true,
6000
+ uid: accountId,
6001
+ durationMs: Date.now() - startedAt
6002
+ }, this._logger);
5466
6003
  res.json({
5467
- redirectTo: redirectTo
6004
+ redirectTo: interaction.returnTo
5468
6005
  });
5469
6006
  return [
5470
6007
  3,
5471
- 5
6008
+ 7
5472
6009
  ];
5473
- case 4:
5474
- _state.sent();
6010
+ case 6:
6011
+ err1 = _state.sent();
6012
+ emitOidcAnalyticsEvent(this._analytics, {
6013
+ type: 'login',
6014
+ isSuccessful: false,
6015
+ uid: accountId,
6016
+ reason: 'login_interaction_failed',
6017
+ error: err1,
6018
+ durationMs: Date.now() - startedAt
6019
+ }, this._logger);
5475
6020
  throw new HttpException('Login interaction failed', HttpStatus.BAD_REQUEST);
5476
- case 5:
6021
+ case 7:
5477
6022
  return [
5478
6023
  2
5479
6024
  ];
@@ -5496,10 +6041,11 @@ function _ts_generator$2(thisArg, body) {
5496
6041
  * @throws {HttpException} HTTP 400 when the consent interaction cannot be completed.
5497
6042
  */ function postConsent(uid, body, res) {
5498
6043
  return _async_to_generator$2(function() {
5499
- var _ref, _ref1, _prompt_details_missingOIDCScope, _prompt_details_missingOIDCClaims, _prompt_details_missingResourceScopes, redirectTo, interaction, prompt, params, session, clientId, requestedRawTtl, clientPayload, clientMaxSessionTtl, expiresInSeconds, grant, encounteredOIDCScopes, missingOIDCScope, _resolveEffectiveSubset, granted, rejected, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, value, encounteredOIDCClaims, missingOIDCClaims, _resolveEffectiveSubset1, granted1, rejected1, missingResourceScopes, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, _step_value, indicator, scopes, _body_grantedResourceScopes, requestedSubset, encounteredResourceScopes, _resolveEffectiveSubset2, granted2, rejected2, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, value1, grantId, redirectTo1, err;
6044
+ var startedAt, clientId, accountId, _ref, _prompt_details_missingOIDCScope, _this_accountService_providerConfig_adminOnlyScopes, _ref1, _ref2, _prompt_details_missingOIDCClaims, _prompt_details_missingResourceScopes, _this_accountService_delegate_isAdminUser, _this_accountService_delegate, _ref3, redirectTo, interaction, prompt, params, session, missingOIDCScope, existingGrant, _tmp, encounteredOIDCScopes, requestedOIDCScopeSet, adminOnlyScopes, requestsServiceToken, isAdmin, _tmp1, _ref4, redirectTo1, requestedRawTtl, clientPayload, clientMaxSessionTtl, expiresInSeconds, grant, _tmp2, _resolveEffectiveSubset, granted, rejected, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, value, encounteredOIDCClaims, missingOIDCClaims, _resolveEffectiveSubset1, granted1, rejected1, missingResourceScopes, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, _step_value, indicator, scopes, _body_grantedResourceScopes, requestedSubset, encounteredResourceScopes, _resolveEffectiveSubset2, granted2, rejected2, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, value1, grantId, _ref5, redirectTo2, err;
5500
6045
  return _ts_generator$2(this, function(_state) {
5501
6046
  switch(_state.label){
5502
6047
  case 0:
6048
+ startedAt = Date.now();
5503
6049
  return [
5504
6050
  4,
5505
6051
  this._verifyIdToken(body.idToken)
@@ -5510,9 +6056,9 @@ function _ts_generator$2(thisArg, body) {
5510
6056
  case 2:
5511
6057
  _state.trys.push([
5512
6058
  2,
5513
- 10,
6059
+ 20,
5514
6060
  ,
5515
- 11
6061
+ 21
5516
6062
  ]);
5517
6063
  if (!!body.approved) return [
5518
6064
  3,
@@ -5528,7 +6074,7 @@ function _ts_generator$2(thisArg, body) {
5528
6074
  })
5529
6075
  ];
5530
6076
  case 3:
5531
- redirectTo = _state.sent();
6077
+ _ref3 = _state.sent(), redirectTo = _ref3.returnTo;
5532
6078
  res.json({
5533
6079
  redirectTo: redirectTo
5534
6080
  });
@@ -5544,35 +6090,131 @@ function _ts_generator$2(thisArg, body) {
5544
6090
  interaction = _state.sent();
5545
6091
  prompt = interaction.prompt, params = interaction.params, session = interaction.session;
5546
6092
  clientId = params.client_id;
6093
+ accountId = (_ref = session === null || session === void 0 ? void 0 : session.accountId) !== null && _ref !== void 0 ? _ref : '';
6094
+ missingOIDCScope = (_prompt_details_missingOIDCScope = prompt.details.missingOIDCScope) !== null && _prompt_details_missingOIDCScope !== void 0 ? _prompt_details_missingOIDCScope : [];
6095
+ if (!interaction.grantId) return [
6096
+ 3,
6097
+ 7
6098
+ ];
6099
+ return [
6100
+ 4,
6101
+ this.oidcInteractionService.findOrCreateGrant(interaction.grantId, accountId, clientId)
6102
+ ];
6103
+ case 6:
6104
+ _tmp = _state.sent();
6105
+ return [
6106
+ 3,
6107
+ 8
6108
+ ];
6109
+ case 7:
6110
+ _tmp = undefined;
6111
+ _state.label = 8;
6112
+ case 8:
6113
+ existingGrant = _tmp;
6114
+ // Encountered = scopes/claims already granted (or rejected) on the existing Grant. oidc-provider
6115
+ // excludes these from `missingOIDCScope` etc. when the consent prompt is re-shown via `prompt=consent`,
6116
+ // but the consent UI sources its checkbox list from the auth URL's `scope=` param (the full request set)
6117
+ // and re-submits them all. We accept already-encountered values as silent no-ops so a re-consent on a
6118
+ // client the user has previously authorized doesn't fail validation.
6119
+ encounteredOIDCScopes = existingGrant ? existingGrant.getOIDCScopeEncountered().split(' ').filter(Boolean) : [];
6120
+ // Admin-only scope gate. The requested OIDC scope set is `missingOIDCScope ∪ encounteredOIDCScopes`
6121
+ // (a fresh consent has everything in `missing`; a re-consent may carry already-granted scopes in
6122
+ // `encountered`). If that set intersects the provider's `adminOnlyScopes` and the resolving user is
6123
+ // not an admin, hard-reject with `access_denied` rather than silently dropping the scope.
6124
+ requestedOIDCScopeSet = new Set(_to_consumable_array$1(missingOIDCScope).concat(_to_consumable_array$1(encounteredOIDCScopes)));
6125
+ adminOnlyScopes = (_this_accountService_providerConfig_adminOnlyScopes = this.accountService.providerConfig.adminOnlyScopes) !== null && _this_accountService_providerConfig_adminOnlyScopes !== void 0 ? _this_accountService_providerConfig_adminOnlyScopes : [];
6126
+ requestsServiceToken = adminOnlyScopes.some(function(scope) {
6127
+ return requestedOIDCScopeSet.has(scope);
6128
+ });
6129
+ if (!accountId) return [
6130
+ 3,
6131
+ 10
6132
+ ];
6133
+ return [
6134
+ 4,
6135
+ (_ref1 = (_this_accountService_delegate_isAdminUser = (_this_accountService_delegate = this.accountService.delegate).isAdminUser) === null || _this_accountService_delegate_isAdminUser === void 0 ? void 0 : _this_accountService_delegate_isAdminUser.call(_this_accountService_delegate, this.accountService.userContext(accountId).authUserContext)) !== null && _ref1 !== void 0 ? _ref1 : false
6136
+ ];
6137
+ case 9:
6138
+ _tmp1 = _state.sent();
6139
+ return [
6140
+ 3,
6141
+ 11
6142
+ ];
6143
+ case 10:
6144
+ _tmp1 = false;
6145
+ _state.label = 11;
6146
+ case 11:
6147
+ isAdmin = _tmp1;
6148
+ if (!(requestsServiceToken && !isAdmin)) return [
6149
+ 3,
6150
+ 13
6151
+ ];
6152
+ return [
6153
+ 4,
6154
+ this.oidcInteractionService.finishInteractionByUid(uid, {
6155
+ error: 'access_denied',
6156
+ error_description: 'token.service is restricted to admins.'
6157
+ }, {
6158
+ mergeWithLastSubmission: true
6159
+ })
6160
+ ];
6161
+ case 12:
6162
+ _ref4 = _state.sent(), redirectTo1 = _ref4.returnTo;
6163
+ emitOidcAnalyticsEvent(this._analytics, {
6164
+ type: 'consent',
6165
+ isSuccessful: false,
6166
+ uid: accountId,
6167
+ clientId: clientId,
6168
+ serviceToken: true,
6169
+ isAdmin: false,
6170
+ reason: 'service_token_non_admin',
6171
+ durationMs: Date.now() - startedAt
6172
+ }, this._logger);
6173
+ res.json({
6174
+ redirectTo: redirectTo1
6175
+ });
6176
+ return [
6177
+ 2
6178
+ ];
6179
+ case 13:
5547
6180
  // Resolve the requested login duration up-front. The configured Grant TTL function (in
5548
6181
  // OidcService.buildProviderConfiguration) only fires when oidc-provider's koa middleware
5549
6182
  // drives `grant.save()`, so its `ctx.oidc.params` lookup of `dbx_session_ttl` returns
5550
6183
  // undefined when the consent submit runs in this controller. We pre-set `expiresIn` on
5551
- // newly-created grants so they persist with the correct TTL.
6184
+ // newly-created grants so they persist with the correct (tiered) TTL.
5552
6185
  requestedRawTtl = params[DBX_FIREBASE_SERVER_OIDC_SESSION_TTL_PARAM];
5553
6186
  return [
5554
6187
  4,
5555
6188
  this.oidcService.findClientPayload(clientId)
5556
6189
  ];
5557
- case 6:
6190
+ case 14:
5558
6191
  clientPayload = _state.sent();
5559
- clientMaxSessionTtl = (_ref = clientPayload === null || clientPayload === void 0 ? void 0 : clientPayload.dbx_max_session_ttl) !== null && _ref !== void 0 ? _ref : undefined;
6192
+ clientMaxSessionTtl = (_ref2 = clientPayload === null || clientPayload === void 0 ? void 0 : clientPayload.dbx_max_session_ttl) !== null && _ref2 !== void 0 ? _ref2 : undefined;
5560
6193
  expiresInSeconds = this.oidcService.resolveLoginDurationForGrant(requestedRawTtl, {
5561
6194
  dbx_max_session_ttl: clientMaxSessionTtl
6195
+ }, {
6196
+ isAdmin: isAdmin,
6197
+ hasServiceScope: requestsServiceToken
5562
6198
  });
6199
+ if (!(existingGrant !== null && existingGrant !== void 0)) return [
6200
+ 3,
6201
+ 15
6202
+ ];
6203
+ _tmp2 = existingGrant;
6204
+ return [
6205
+ 3,
6206
+ 17
6207
+ ];
6208
+ case 15:
5563
6209
  return [
5564
6210
  4,
5565
- this.oidcInteractionService.findOrCreateGrant(interaction.grantId, (_ref1 = session === null || session === void 0 ? void 0 : session.accountId) !== null && _ref1 !== void 0 ? _ref1 : '', clientId, expiresInSeconds)
6211
+ this.oidcInteractionService.findOrCreateGrant(interaction.grantId, accountId, clientId, expiresInSeconds)
5566
6212
  ];
5567
- case 7:
5568
- grant = _state.sent();
5569
- // Encountered = scopes/claims already granted (or rejected) on the existing Grant. oidc-provider
5570
- // excludes these from `missingOIDCScope` etc. when the consent prompt is re-shown via `prompt=consent`,
5571
- // but the consent UI sources its checkbox list from the auth URL's `scope=` param (the full request set)
5572
- // and re-submits them all. We accept already-encountered values as silent no-ops so a re-consent on a
5573
- // client the user has previously authorized doesn't fail validation.
5574
- encounteredOIDCScopes = grant.getOIDCScopeEncountered().split(' ').filter(Boolean);
5575
- missingOIDCScope = (_prompt_details_missingOIDCScope = prompt.details.missingOIDCScope) !== null && _prompt_details_missingOIDCScope !== void 0 ? _prompt_details_missingOIDCScope : [];
6213
+ case 16:
6214
+ _tmp2 = _state.sent();
6215
+ _state.label = 17;
6216
+ case 17:
6217
+ grant = _tmp2;
5576
6218
  if (missingOIDCScope.length > 0) {
5577
6219
  _resolveEffectiveSubset = resolveEffectiveSubset({
5578
6220
  missing: missingOIDCScope,
@@ -5674,7 +6316,7 @@ function _ts_generator$2(thisArg, body) {
5674
6316
  4,
5675
6317
  grant.save()
5676
6318
  ];
5677
- case 8:
6319
+ case 18:
5678
6320
  grantId = _state.sent();
5679
6321
  return [
5680
6322
  4,
@@ -5686,22 +6328,41 @@ function _ts_generator$2(thisArg, body) {
5686
6328
  mergeWithLastSubmission: true
5687
6329
  })
5688
6330
  ];
5689
- case 9:
5690
- redirectTo1 = _state.sent();
6331
+ case 19:
6332
+ _ref5 = _state.sent(), redirectTo2 = _ref5.returnTo;
6333
+ emitOidcAnalyticsEvent(this._analytics, {
6334
+ type: 'consent',
6335
+ isSuccessful: true,
6336
+ uid: accountId,
6337
+ clientId: clientId,
6338
+ scopes: Array.from(requestedOIDCScopeSet),
6339
+ serviceToken: requestsServiceToken,
6340
+ isAdmin: isAdmin,
6341
+ durationMs: Date.now() - startedAt
6342
+ }, this._logger);
5691
6343
  res.json({
5692
- redirectTo: redirectTo1
6344
+ redirectTo: redirectTo2
5693
6345
  });
5694
6346
  return [
5695
6347
  3,
5696
- 11
6348
+ 21
5697
6349
  ];
5698
- case 10:
6350
+ case 20:
5699
6351
  err = _state.sent();
6352
+ emitOidcAnalyticsEvent(this._analytics, {
6353
+ type: 'consent',
6354
+ isSuccessful: false,
6355
+ uid: accountId,
6356
+ clientId: clientId,
6357
+ reason: 'consent_interaction_failed',
6358
+ error: err,
6359
+ durationMs: Date.now() - startedAt
6360
+ }, this._logger);
5700
6361
  if (_instanceof(err, HttpException)) {
5701
6362
  throw err;
5702
6363
  }
5703
6364
  throw new HttpException('Consent interaction failed', HttpStatus.BAD_REQUEST);
5704
- case 11:
6365
+ case 21:
5705
6366
  return [
5706
6367
  2
5707
6368
  ];
@@ -5776,12 +6437,14 @@ __decorate([
5776
6437
  __param(1, Body()),
5777
6438
  __param(2, Res())
5778
6439
  ], OidcInteractionController.prototype, "postConsent", null);
5779
- OidcInteractionController = __decorate([
6440
+ OidcInteractionController = OidcInteractionController_1 = __decorate([
5780
6441
  Controller('interaction'),
5781
6442
  __param(0, Inject(OidcInteractionService)),
5782
6443
  __param(1, Inject(OidcProviderConfigService)),
5783
6444
  __param(2, Inject(OidcAccountService)),
5784
- __param(3, Inject(OidcService))
6445
+ __param(3, Inject(OidcService)),
6446
+ __param(4, Optional()),
6447
+ __param(4, Inject(OIDC_ANALYTICS_SERVICE))
5785
6448
  ], OidcInteractionController);
5786
6449
  /**
5787
6450
  * Resolves the effective set to grant — and the complementary set to
@@ -6092,6 +6755,69 @@ function _ts_generator$1(thisArg, body) {
6092
6755
  }));
6093
6756
  }
6094
6757
  },
6758
+ {
6759
+ key: "getSession",
6760
+ value: /**
6761
+ * GET /oidc/session.
6762
+ *
6763
+ * Read route that verifies the presented bearer access token and returns its resolved session
6764
+ * lifetime metadata: `{ sub, scope, expiresAt, rotationDisabled }`. `expiresAt` is the grant's
6765
+ * expiry (unix seconds) and `rotationDisabled` flags a non-rotating (service) token. The values
6766
+ * are sourced from the access token's baked-in `extra` claims (see `extraTokenClaims`), so this
6767
+ * does not require decoding the opaque token client-side — cleaner than userinfo, which does not
6768
+ * echo access-token `extra`.
6769
+ *
6770
+ * Declared ahead of the `@All('{*path}')` catch-all so it is matched here rather than proxied to
6771
+ * the oidc-provider callback (mirrors `GET /oidc/login/client`).
6772
+ *
6773
+ * @param req - Inbound request; the `Authorization: Bearer <token>` header is read for the access token.
6774
+ * @param res - Express response used to send the session JSON (401 when the token is missing/invalid).
6775
+ */ function getSession(req, res) {
6776
+ return _async_to_generator$1(function() {
6777
+ var _exec_, _exec, rawAuthHeader, authHeader, bearer, handled, authData, _token_scope, _token_DBX_FIREBASE_SERVER_OIDC_SESSION_EXPIRES_AT_CLAIM, _token_DBX_FIREBASE_SERVER_OIDC_ROTATION_DISABLED_CLAIM, token;
6778
+ return _ts_generator$1(this, function(_state) {
6779
+ switch(_state.label){
6780
+ case 0:
6781
+ rawAuthHeader = req.headers['authorization'];
6782
+ authHeader = Array.isArray(rawAuthHeader) ? rawAuthHeader[0] : rawAuthHeader;
6783
+ bearer = (_exec = /^Bearer\s+(.+)$/i.exec(authHeader !== null && authHeader !== void 0 ? authHeader : '')) === null || _exec === void 0 ? void 0 : (_exec_ = _exec[1]) === null || _exec_ === void 0 ? void 0 : _exec_.trim();
6784
+ handled = false;
6785
+ if (!bearer) return [
6786
+ 3,
6787
+ 2
6788
+ ];
6789
+ return [
6790
+ 4,
6791
+ this.oidcService.verifyAccessToken(bearer)
6792
+ ];
6793
+ case 1:
6794
+ authData = _state.sent();
6795
+ if (authData) {
6796
+ token = authData.token;
6797
+ res.json({
6798
+ sub: authData.uid,
6799
+ scope: (_token_scope = token['scope']) !== null && _token_scope !== void 0 ? _token_scope : null,
6800
+ expiresAt: (_token_DBX_FIREBASE_SERVER_OIDC_SESSION_EXPIRES_AT_CLAIM = token[DBX_FIREBASE_SERVER_OIDC_SESSION_EXPIRES_AT_CLAIM]) !== null && _token_DBX_FIREBASE_SERVER_OIDC_SESSION_EXPIRES_AT_CLAIM !== void 0 ? _token_DBX_FIREBASE_SERVER_OIDC_SESSION_EXPIRES_AT_CLAIM : null,
6801
+ rotationDisabled: (_token_DBX_FIREBASE_SERVER_OIDC_ROTATION_DISABLED_CLAIM = token[DBX_FIREBASE_SERVER_OIDC_ROTATION_DISABLED_CLAIM]) !== null && _token_DBX_FIREBASE_SERVER_OIDC_ROTATION_DISABLED_CLAIM !== void 0 ? _token_DBX_FIREBASE_SERVER_OIDC_ROTATION_DISABLED_CLAIM : false
6802
+ });
6803
+ handled = true;
6804
+ }
6805
+ _state.label = 2;
6806
+ case 2:
6807
+ if (!handled) {
6808
+ res.status(HttpStatus.UNAUTHORIZED).json({
6809
+ error: 'invalid_token',
6810
+ error_description: 'Missing or invalid bearer access token.'
6811
+ });
6812
+ }
6813
+ return [
6814
+ 2
6815
+ ];
6816
+ }
6817
+ });
6818
+ }).call(this);
6819
+ }
6820
+ },
6095
6821
  {
6096
6822
  key: "handleOidcRequest",
6097
6823
  value: function handleOidcRequest(req, res) {
@@ -6125,6 +6851,11 @@ __decorate([
6125
6851
  __param(0, Req()),
6126
6852
  __param(1, Res())
6127
6853
  ], OidcProviderController.prototype, "redirectToClientLogin", null);
6854
+ __decorate([
6855
+ Get('session'),
6856
+ __param(0, Req()),
6857
+ __param(1, Res())
6858
+ ], OidcProviderController.prototype, "getSession", null);
6128
6859
  __decorate([
6129
6860
  All('{*path}'),
6130
6861
  __param(0, Req()),
@@ -6833,4 +7564,4 @@ function _unsupported_iterable_to_array(o, minLen) {
6833
7564
  return fn;
6834
7565
  }
6835
7566
 
6836
- export { DEFAULT_APP_OAUTH_CONSENT_PATH_PART, DEFAULT_APP_OAUTH_INTERACTION_PATH, DEFAULT_APP_OAUTH_LOGIN_PATH_PART, DEFAULT_MAX_REQUESTED_LOGIN_DURATION_SECONDS, DEFAULT_MIN_REQUESTED_LOGIN_DURATION_SECONDS, DEFAULT_OIDC_CODE_CHALLENGE_METHODS, DEFAULT_OIDC_ID_TOKEN_SIGNING_ALG_VALUES, DEFAULT_OIDC_ISSUER_PATH, DEFAULT_OIDC_ROUTES, DEFAULT_OIDC_SUBJECT_TYPES, DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS, DEFAULT_OIDC_TOKEN_LIFETIMES, DEFAULT_ROTATED_KEY_MAX_AGE, FIREBASE_SERVER_OIDC_ROUTES_FOR_GLOBAL_ROUTE_EXCLUDE, GRANTABLE_MODEL_NAMES, JwksFirestoreCollections, JwksKeyDocument, JwksService, JwksServiceConfig, JwksServiceStorageConfig, OIDC_ENCRYPTED_PAYLOAD_FIELDS, OIDC_JSON_RENDER_ERROR_FUNCTION, OIDC_JWKS_ENCRYPTION_SECRET_ENV_KEY, OidcAccountService, OidcAccountServiceDelegate, OidcAccountServiceUserContext, OidcAuth, OidcAuthBearerTokenMiddleware, OidcAuthMiddlewareConfig, OidcClientService, OidcEncryptionService, OidcInteractionController, OidcInteractionService, OidcModelServerActions, OidcModuleConfig, OidcProviderConfigService, OidcProviderController, OidcServerFirestoreCollections, OidcService, OidcWellKnownController, activeJwksKeysQuery, allOidcScopesStringForProviderConfig, appOidcModelModuleMetadata, applyOidcAuthMiddleware, applyOidcCorsMiddleware, buildBearerChallenge, buildFirebaseServerMcpResourceServer, createAdapterFactory, createOidcClientFactory, deleteOidcClientFactory, deleteOidcTokenFactory, deriveResourceMetadataUrlFromEnv, getOidcScopesFromRequest, jwksKeyCollectionReference, jwksKeyConverter, jwksKeyFirestoreCollection, jwksKeyIdentity, jwksKeysWithStatusQuery, nonRetiredJwksKeysQuery, oidcCallModelScopePreAssert, oidcFirestoreCollectionsFactory, oidcModelServerActions, oidcModelServerActionsFactory, oidcModuleConfigFactory, oidcModuleMetadata, resolveEffectiveSubset, rotateOidcClientSecretFactory, rotatedJwksKeysQuery, updateOidcClientFactory };
7567
+ export { DEFAULT_APP_OAUTH_CONSENT_PATH_PART, DEFAULT_APP_OAUTH_INTERACTION_PATH, DEFAULT_APP_OAUTH_LOGIN_PATH_PART, DEFAULT_MAX_ADMIN_LOGIN_DURATION_SECONDS, DEFAULT_MAX_NONADMIN_LOGIN_DURATION_SECONDS, DEFAULT_MAX_REQUESTED_LOGIN_DURATION_SECONDS, DEFAULT_MAX_SERVICE_TOKEN_LOGIN_DURATION_SECONDS, DEFAULT_MIN_REQUESTED_LOGIN_DURATION_SECONDS, DEFAULT_OIDC_ANALYTICS_EVENT_NAMES, DEFAULT_OIDC_ANALYTICS_EVENT_NAME_PREFIX, DEFAULT_OIDC_CODE_CHALLENGE_METHODS, DEFAULT_OIDC_ID_TOKEN_SIGNING_ALG_VALUES, DEFAULT_OIDC_ISSUER_PATH, DEFAULT_OIDC_ROUTES, DEFAULT_OIDC_SUBJECT_TYPES, DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS, DEFAULT_OIDC_TOKEN_LIFETIMES, DEFAULT_ROTATED_KEY_MAX_AGE, FIREBASE_SERVER_OIDC_ANALYTICS_CONFIG, FIREBASE_SERVER_OIDC_ROUTES_FOR_GLOBAL_ROUTE_EXCLUDE, FirebaseServerOidcAnalyticsService, GRANTABLE_MODEL_NAMES, JwksFirestoreCollections, JwksKeyDocument, JwksService, JwksServiceConfig, JwksServiceStorageConfig, OIDC_ANALYTICS_SERVICE, OIDC_ENCRYPTED_PAYLOAD_FIELDS, OIDC_JSON_RENDER_ERROR_FUNCTION, OIDC_JWKS_ENCRYPTION_SECRET_ENV_KEY, OidcAccountService, OidcAccountServiceDelegate, OidcAccountServiceUserContext, OidcAnalyticsService, OidcAuth, OidcAuthBearerTokenMiddleware, OidcAuthMiddlewareConfig, OidcClientService, OidcEncryptionService, OidcInteractionController, OidcInteractionService, OidcModelServerActions, OidcModuleConfig, OidcProviderConfigService, OidcProviderController, OidcServerFirestoreCollections, OidcService, OidcWellKnownController, activeJwksKeysQuery, allOidcScopesStringForProviderConfig, appOidcAnalyticsModuleMetadata, appOidcModelModuleMetadata, applyOidcAuthMiddleware, applyOidcCorsMiddleware, buildBearerChallenge, buildFirebaseServerMcpResourceServer, createAdapterFactory, createOidcClientFactory, deleteOidcClientFactory, deleteOidcTokenFactory, deriveResourceMetadataUrlFromEnv, emitOidcAnalyticsEvent, getOidcScopesFromRequest, jwksKeyCollectionReference, jwksKeyConverter, jwksKeyFirestoreCollection, jwksKeyIdentity, jwksKeysWithStatusQuery, nonRetiredJwksKeysQuery, noopOidcAnalyticsService, oidcCallModelScopePreAssert, oidcFirestoreCollectionsFactory, oidcModelServerActions, oidcModelServerActionsFactory, oidcModuleConfigFactory, oidcModuleMetadata, resolveEffectiveSubset, rotateOidcClientSecretFactory, rotatedJwksKeysQuery, updateOidcClientFactory };