@dereekb/firebase-server 13.11.3 → 13.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mailgun/package.json +9 -9
- package/model/package.json +9 -9
- package/oidc/index.cjs.js +643 -53
- package/oidc/index.esm.js +641 -55
- package/oidc/package.json +10 -10
- package/oidc/src/lib/controller/oidc.interaction.controller.d.ts +3 -1
- package/oidc/src/lib/model/oidc/oidcmodel.action.server.d.ts +22 -1
- package/oidc/src/lib/model/oidc/oidcmodel.module.d.ts +6 -3
- package/oidc/src/lib/oidc.config.d.ts +82 -6
- package/oidc/src/lib/oidc.module.d.ts +1 -1
- package/oidc/src/lib/service/oidc.adapter.service.d.ts +5 -0
- package/oidc/src/lib/service/oidc.interaction.service.d.ts +7 -1
- package/oidc/src/lib/service/oidc.service.d.ts +31 -1
- package/oidc/src/lib/service/oidc.session-ttl.d.ts +85 -0
- package/package.json +10 -10
- package/test/package.json +11 -11
- package/zoho/package.json +9 -9
package/oidc/index.esm.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { createParamDecorator, Injectable, Inject, Optional, Logger, UnauthorizedException, Get, Param, Req, Res, Post, HttpCode, HttpStatus, Body, Controller, HttpException, All } from '@nestjs/common';
|
|
2
|
+
import { errors } from 'oidc-provider';
|
|
3
|
+
import { SECONDS_IN_MINUTE, SECONDS_IN_DAY, cachedGetter, unixDateTimeSecondsNumberToDate, unixDateTimeSecondsNumberForNow, selectiveFieldEncryptor, filterUndefinedValues, websiteUrlFromPaths, firstValue, hasHttpPrefix } from '@dereekb/util';
|
|
2
4
|
import { generateKeyPairSync, randomBytes } from 'node:crypto';
|
|
3
5
|
import { resolveEncryptionKey, encryptValue, decryptValue, createAesStringEncryptionProvider, isValidAES256GCMEncryptionSecret } from '@dereekb/nestjs';
|
|
4
|
-
import { where, iterateFirestoreDocumentSnapshotPairs, firestoreModelIdentity, snapshotConverterFunctions, optionalFirestoreDate, firestoreDate, firestoreEnum, firestorePassThroughField, AbstractFirestoreDocument, createOidcClientParamsType, deleteOidcClientParamsType, rotateOidcClientSecretParamsType, updateOidcClientParamsType, firestoreModelKey, oidcEntryIdentity, OIDC_ENTRY_CLIENT_TYPE, oidcEntriesByUserCodeQuery, oidcEntriesByUidQuery, oidcEntriesByGrantIdQuery, oidcEntryFirestoreCollection, callModelOidcScopeForCallType, CALL_MODEL_MISSING_OIDC_SCOPE_ERROR_CODE } from '@dereekb/firebase';
|
|
5
|
-
import { cachedGetter, unixDateTimeSecondsNumberToDate, unixDateTimeSecondsNumberForNow, selectiveFieldEncryptor, filterUndefinedValues, websiteUrlFromPaths, firstValue, hasHttpPrefix } from '@dereekb/util';
|
|
6
|
+
import { where, iterateFirestoreDocumentSnapshotPairs, firestoreModelIdentity, snapshotConverterFunctions, optionalFirestoreDate, firestoreDate, firestoreEnum, firestorePassThroughField, AbstractFirestoreDocument, createOidcClientParamsType, deleteOidcClientParamsType, deleteOidcTokenParamsType, rotateOidcClientSecretParamsType, updateOidcClientParamsType, firestoreModelKey, oidcEntryIdentity, OIDC_ENTRY_CLIENT_TYPE, oidcEntriesByUserCodeQuery, oidcEntriesByUidQuery, oidcEntriesByGrantIdQuery, oidcEntryFirestoreCollection, callModelOidcScopeForCallType, CALL_MODEL_MISSING_OIDC_SCOPE_ERROR_CODE } from '@dereekb/firebase';
|
|
6
7
|
import { firestoreEncryptedField, firebaseServerActionsContext, FirebaseServerEnvService, FIREBASE_FIRESTORE_CONTEXT_TOKEN, FirebaseServerFirestoreContextModule, forbiddenError } from '@dereekb/firebase-server';
|
|
7
8
|
import { nanoid } from 'nanoid';
|
|
9
|
+
import { safeToJsDate } from '@dereekb/date';
|
|
8
10
|
import { makeUrlSearchParamsString } from '@dereekb/util/fetch';
|
|
9
11
|
import { ConfigService, ConfigModule } from '@nestjs/config';
|
|
10
12
|
|
|
@@ -77,12 +79,20 @@ function _define_property$f(obj, key, value) {
|
|
|
77
79
|
return obj;
|
|
78
80
|
}
|
|
79
81
|
/**
|
|
80
|
-
* Default
|
|
82
|
+
* Default global ceiling for a client-requested login duration, in seconds. 90 days.
|
|
83
|
+
*/ var DEFAULT_MAX_REQUESTED_LOGIN_DURATION_SECONDS = 90 * SECONDS_IN_DAY;
|
|
84
|
+
/**
|
|
85
|
+
* Default global floor for a client-requested login duration, in seconds. 1 hour.
|
|
86
|
+
*/ var DEFAULT_MIN_REQUESTED_LOGIN_DURATION_SECONDS = 60 * SECONDS_IN_MINUTE;
|
|
87
|
+
/**
|
|
88
|
+
* Default token lifetimes: 15 min access tokens, 30-day refresh tokens, 30-day sessions/grants, 60 s auth codes.
|
|
81
89
|
*/ var DEFAULT_OIDC_TOKEN_LIFETIMES = {
|
|
82
|
-
accessToken:
|
|
83
|
-
idToken:
|
|
84
|
-
refreshToken: 30 *
|
|
85
|
-
authorizationCode:
|
|
90
|
+
accessToken: 15 * SECONDS_IN_MINUTE,
|
|
91
|
+
idToken: 60 * SECONDS_IN_MINUTE,
|
|
92
|
+
refreshToken: 30 * SECONDS_IN_DAY,
|
|
93
|
+
authorizationCode: SECONDS_IN_MINUTE,
|
|
94
|
+
session: 30 * SECONDS_IN_DAY,
|
|
95
|
+
grant: 30 * SECONDS_IN_DAY
|
|
86
96
|
};
|
|
87
97
|
// MARK: Config
|
|
88
98
|
/**
|
|
@@ -118,6 +128,26 @@ function _define_property$f(obj, key, value) {
|
|
|
118
128
|
* Token lifetime configuration.
|
|
119
129
|
*/ _define_property$f(this, "tokenLifetimes", void 0);
|
|
120
130
|
/**
|
|
131
|
+
* Maximum login duration (seconds) a client may request via the `dbx_session_ttl` auth-URL param.
|
|
132
|
+
*
|
|
133
|
+
* Acts as the global server cap for any per-request duration. A registered client can declare its own
|
|
134
|
+
* lower ceiling via the `dbx_max_session_ttl` client metadata field; the effective ceiling is
|
|
135
|
+
* `min(client.dbx_max_session_ttl, this)`.
|
|
136
|
+
*
|
|
137
|
+
* Defaults to {@link DEFAULT_MAX_REQUESTED_LOGIN_DURATION_SECONDS} (90 days).
|
|
138
|
+
*/ _define_property$f(this, "maxRequestedLoginDuration", void 0);
|
|
139
|
+
/**
|
|
140
|
+
* Minimum login duration (seconds) a client may request via the `dbx_session_ttl` auth-URL param.
|
|
141
|
+
*
|
|
142
|
+
* Requested values below this floor are clamped up. Prevents pathological 30-second sessions.
|
|
143
|
+
*
|
|
144
|
+
* Defaults to {@link DEFAULT_MIN_REQUESTED_LOGIN_DURATION_SECONDS} (1 hour).
|
|
145
|
+
*/ _define_property$f(this, "minRequestedLoginDuration", void 0);
|
|
146
|
+
/**
|
|
147
|
+
* Default login duration (seconds) used when a client does NOT pass the `dbx_session_ttl`
|
|
148
|
+
* auth-URL param. When undefined, falls back to {@link OidcTokenLifetimes.refreshToken}.
|
|
149
|
+
*/ _define_property$f(this, "defaultRequestedLoginDuration", void 0);
|
|
150
|
+
/**
|
|
121
151
|
* JWKS service configuration (encryption secret, rotated key max age).
|
|
122
152
|
*/ _define_property$f(this, "jwksServiceConfig", void 0);
|
|
123
153
|
/**
|
|
@@ -166,6 +196,33 @@ function _define_property$f(obj, key, value) {
|
|
|
166
196
|
*
|
|
167
197
|
* Defaults to `false`.
|
|
168
198
|
*/ _define_property$f(this, "registrationEnabled", void 0);
|
|
199
|
+
/**
|
|
200
|
+
* Whether the oidc-provider should trust upstream proxy headers
|
|
201
|
+
* (`X-Forwarded-Host`, `X-Forwarded-Proto`) when computing the request URL
|
|
202
|
+
* used to build resume/return URLs and discovery metadata absolute paths.
|
|
203
|
+
*
|
|
204
|
+
* Required when running behind a reverse proxy such as Firebase Hosting →
|
|
205
|
+
* Cloud Run / Cloud Functions, where the request `Host` header is the
|
|
206
|
+
* underlying Cloud Run host (e.g. `api-xxxxx-uc.a.run.app`) and not the
|
|
207
|
+
* canonical issuer host. Without this, the interaction `returnTo` URL is
|
|
208
|
+
* built off the Cloud Run host and the browser is redirected away from the
|
|
209
|
+
* issuer's domain after login — causing the interaction cookies (scoped to
|
|
210
|
+
* the canonical host) to be missing on the resume request and producing
|
|
211
|
+
* "authorization request has expired".
|
|
212
|
+
*
|
|
213
|
+
* Maps to `provider.proxy = <value>` on the underlying oidc-provider
|
|
214
|
+
* (which is the Koa `app.proxy` setting).
|
|
215
|
+
*
|
|
216
|
+
* Defaults to `'prod_only'` if the environment is `production`, otherwise `false`.
|
|
217
|
+
*/ _define_property$f(this, "trustProxy", void 0);
|
|
218
|
+
/**
|
|
219
|
+
* Whether to trust proxy headers in a non-production environment, such as the local environment.
|
|
220
|
+
*
|
|
221
|
+
* The dev environment typically does not require proxy headers, and setting
|
|
222
|
+
* `true` will result in errors.
|
|
223
|
+
*
|
|
224
|
+
* Defaults to `false`.
|
|
225
|
+
*/ _define_property$f(this, "trustProxyInNonProduction", void 0);
|
|
169
226
|
}
|
|
170
227
|
_create_class$d(OidcModuleConfig, null, [
|
|
171
228
|
{
|
|
@@ -203,6 +260,95 @@ function _define_property$f(obj, key, value) {
|
|
|
203
260
|
}
|
|
204
261
|
();
|
|
205
262
|
|
|
263
|
+
/**
|
|
264
|
+
* Custom OIDC auth-URL parameter clients use to request a non-default login duration.
|
|
265
|
+
*
|
|
266
|
+
* Value is integer seconds. Subject to per-client and global server caps via {@link resolveLoginDurationSeconds}.
|
|
267
|
+
*/ var DBX_FIREBASE_SERVER_OIDC_SESSION_TTL_PARAM = 'dbx_session_ttl';
|
|
268
|
+
/**
|
|
269
|
+
* Custom oidc-provider client metadata field for a client's maximum requestable login duration (seconds).
|
|
270
|
+
*/ var DBX_FIREBASE_SERVER_OIDC_MAX_SESSION_TTL_CLIENT_METADATA = 'dbx_max_session_ttl';
|
|
271
|
+
/**
|
|
272
|
+
* Clamps a requested login duration into the allowed range.
|
|
273
|
+
*
|
|
274
|
+
* Resolution order:
|
|
275
|
+
* 1. Pick the requested value, falling back to the configured default when omitted.
|
|
276
|
+
* 2. Compute the effective ceiling as `min(serverMax, clientMax-or-Infinity)`.
|
|
277
|
+
* 3. Clamp the value to `[serverMin, ceiling]`.
|
|
278
|
+
*
|
|
279
|
+
* @param input - The clamp inputs (requested value, client cap, server bounds, default).
|
|
280
|
+
* @returns The clamped duration in seconds.
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```typescript
|
|
284
|
+
* resolveLoginDurationSeconds({
|
|
285
|
+
* requestedSeconds: 60 * 24 * 60 * 60, // 60 days
|
|
286
|
+
* clientMaxSeconds: 30 * 24 * 60 * 60, // 30 days client cap
|
|
287
|
+
* serverMaxSeconds: 90 * 24 * 60 * 60, // 90 days global cap
|
|
288
|
+
* serverMinSeconds: 60 * 60, // 1 hour floor
|
|
289
|
+
* defaultSeconds: 30 * 24 * 60 * 60
|
|
290
|
+
* }); // → 30 * 24 * 60 * 60 (clamped to client max)
|
|
291
|
+
* ```
|
|
292
|
+
*/ function resolveLoginDurationSeconds(input) {
|
|
293
|
+
var _input_requestedSeconds, _input_clientMaxSeconds;
|
|
294
|
+
var raw = (_input_requestedSeconds = input.requestedSeconds) !== null && _input_requestedSeconds !== void 0 ? _input_requestedSeconds : input.defaultSeconds;
|
|
295
|
+
var ceiling = Math.min(input.serverMaxSeconds, (_input_clientMaxSeconds = input.clientMaxSeconds) !== null && _input_clientMaxSeconds !== void 0 ? _input_clientMaxSeconds : Infinity);
|
|
296
|
+
return Math.max(input.serverMinSeconds, Math.min(raw, ceiling));
|
|
297
|
+
}
|
|
298
|
+
// MARK: Param parsing
|
|
299
|
+
/**
|
|
300
|
+
* Parses a raw `dbx_session_ttl` value (string or number, from URL query / form / persisted interaction params)
|
|
301
|
+
* into a positive integer number of seconds. Returns `undefined` when missing or invalid so the caller falls
|
|
302
|
+
* back to a default.
|
|
303
|
+
*
|
|
304
|
+
* @param raw - The raw value to parse.
|
|
305
|
+
* @returns The parsed positive integer seconds, or `undefined` when absent/invalid.
|
|
306
|
+
*/ function parseRequestedSessionTtlSeconds(raw) {
|
|
307
|
+
var result;
|
|
308
|
+
if (typeof raw === 'string' && raw.length > 0) {
|
|
309
|
+
var parsed = Number(raw);
|
|
310
|
+
if (Number.isFinite(parsed) && Number.isInteger(parsed) && parsed > 0) {
|
|
311
|
+
result = parsed;
|
|
312
|
+
}
|
|
313
|
+
} else if (typeof raw === 'number' && Number.isFinite(raw) && Number.isInteger(raw) && raw > 0) {
|
|
314
|
+
result = raw;
|
|
315
|
+
}
|
|
316
|
+
return result;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Reads {@link DBX_FIREBASE_SERVER_OIDC_SESSION_TTL_PARAM} from a KoaContextWithOIDC and parses it to a positive integer
|
|
320
|
+
* number of seconds. Returns `undefined` when missing or invalid (so the caller falls back to a default).
|
|
321
|
+
*
|
|
322
|
+
* @param ctx - The OIDC Koa context, or undefined.
|
|
323
|
+
* @returns The parsed positive integer seconds, or `undefined` when absent/invalid.
|
|
324
|
+
*/ function readRequestedSessionTtlSeconds(ctx) {
|
|
325
|
+
var _ctx_oidc;
|
|
326
|
+
var params = ctx === null || ctx === void 0 ? void 0 : (_ctx_oidc = ctx.oidc) === null || _ctx_oidc === void 0 ? void 0 : _ctx_oidc.params;
|
|
327
|
+
var raw = params != null ? params[DBX_FIREBASE_SERVER_OIDC_SESSION_TTL_PARAM] : undefined;
|
|
328
|
+
return parseRequestedSessionTtlSeconds(raw);
|
|
329
|
+
}
|
|
330
|
+
// MARK: Grant remaining time
|
|
331
|
+
/**
|
|
332
|
+
* Inspects oidc-provider entities on the context to find the resolved Grant expiry.
|
|
333
|
+
*
|
|
334
|
+
* Returns the remaining seconds until the Grant expires, or `undefined` when no Grant is bound to the context.
|
|
335
|
+
*
|
|
336
|
+
* @param ctx - The OIDC Koa context, or undefined.
|
|
337
|
+
* @returns The remaining seconds until grant expiry, or `undefined` when no grant is bound or it has expired.
|
|
338
|
+
*/ function readRemainingGrantSeconds(ctx) {
|
|
339
|
+
var _ctx_oidc_entities, _ctx_oidc;
|
|
340
|
+
var grant = ctx === null || ctx === void 0 ? void 0 : (_ctx_oidc = ctx.oidc) === null || _ctx_oidc === void 0 ? void 0 : (_ctx_oidc_entities = _ctx_oidc.entities) === null || _ctx_oidc_entities === void 0 ? void 0 : _ctx_oidc_entities.Grant;
|
|
341
|
+
var result;
|
|
342
|
+
if ((grant === null || grant === void 0 ? void 0 : grant.exp) != null && Number.isFinite(grant.exp)) {
|
|
343
|
+
var now = Math.floor(Date.now() / 1000);
|
|
344
|
+
var remaining = grant.exp - now;
|
|
345
|
+
if (remaining > 0) {
|
|
346
|
+
result = remaining;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return result;
|
|
350
|
+
}
|
|
351
|
+
|
|
206
352
|
/**
|
|
207
353
|
* Query for JwksKey documents with a specific status.
|
|
208
354
|
*
|
|
@@ -1607,7 +1753,8 @@ function _ts_generator$8(thisArg, body) {
|
|
|
1607
1753
|
createOidcClient: createOidcClientFactory(context),
|
|
1608
1754
|
updateOidcClient: updateOidcClientFactory(context),
|
|
1609
1755
|
rotateOidcClientSecret: rotateOidcClientSecretFactory(context),
|
|
1610
|
-
deleteOidcClient: deleteOidcClientFactory(context)
|
|
1756
|
+
deleteOidcClient: deleteOidcClientFactory(context),
|
|
1757
|
+
deleteOidcToken: deleteOidcTokenFactory(context)
|
|
1611
1758
|
};
|
|
1612
1759
|
}
|
|
1613
1760
|
// MARK: Actions
|
|
@@ -1746,6 +1893,59 @@ function _ts_generator$8(thisArg, body) {
|
|
|
1746
1893
|
})();
|
|
1747
1894
|
});
|
|
1748
1895
|
}
|
|
1896
|
+
/**
|
|
1897
|
+
* Factory for the `deleteOidcToken` action.
|
|
1898
|
+
*
|
|
1899
|
+
* Asserts the target {@link OidcEntryDocument} is of type `Grant`, then delegates to
|
|
1900
|
+
* {@link OidcService.revokeGrant} so all grantable token entries (`AccessToken`,
|
|
1901
|
+
* `RefreshToken`, `AuthorizationCode`, `DeviceCode`, `BackchannelAuthenticationRequest`)
|
|
1902
|
+
* sharing the grant id are deleted along with the Grant entry itself.
|
|
1903
|
+
*
|
|
1904
|
+
* Per-user authorization (this user owns this Grant) is enforced upstream via the
|
|
1905
|
+
* model permission service before this action runs.
|
|
1906
|
+
*
|
|
1907
|
+
* @param context - the OIDC model server actions context
|
|
1908
|
+
* @returns a transform function factory for revoking OIDC grants
|
|
1909
|
+
*/ function deleteOidcTokenFactory(context) {
|
|
1910
|
+
var oidcService = context.oidcService, firebaseServerActionTransformFunctionFactory = context.firebaseServerActionTransformFunctionFactory;
|
|
1911
|
+
return firebaseServerActionTransformFunctionFactory(deleteOidcTokenParamsType, function(_params) {
|
|
1912
|
+
return _async_to_generator$8(function() {
|
|
1913
|
+
return _ts_generator$8(this, function(_state) {
|
|
1914
|
+
return [
|
|
1915
|
+
2,
|
|
1916
|
+
function(document) {
|
|
1917
|
+
return _async_to_generator$8(function() {
|
|
1918
|
+
var data;
|
|
1919
|
+
return _ts_generator$8(this, function(_state) {
|
|
1920
|
+
switch(_state.label){
|
|
1921
|
+
case 0:
|
|
1922
|
+
return [
|
|
1923
|
+
4,
|
|
1924
|
+
document.snapshotData()
|
|
1925
|
+
];
|
|
1926
|
+
case 1:
|
|
1927
|
+
data = _state.sent();
|
|
1928
|
+
if ((data === null || data === void 0 ? void 0 : data.type) !== 'Grant') {
|
|
1929
|
+
throw new Error('Only Grant entries can be revoked through this endpoint.');
|
|
1930
|
+
}
|
|
1931
|
+
return [
|
|
1932
|
+
4,
|
|
1933
|
+
oidcService.revokeGrant(document.id)
|
|
1934
|
+
];
|
|
1935
|
+
case 2:
|
|
1936
|
+
_state.sent();
|
|
1937
|
+
return [
|
|
1938
|
+
2
|
|
1939
|
+
];
|
|
1940
|
+
}
|
|
1941
|
+
});
|
|
1942
|
+
})();
|
|
1943
|
+
}
|
|
1944
|
+
];
|
|
1945
|
+
});
|
|
1946
|
+
})();
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1749
1949
|
|
|
1750
1950
|
function asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1751
1951
|
try {
|
|
@@ -2005,6 +2205,9 @@ function _ts_generator$7(thisArg, body) {
|
|
|
2005
2205
|
if (params.jwks_uri) {
|
|
2006
2206
|
properties.jwks_uri = params.jwks_uri;
|
|
2007
2207
|
}
|
|
2208
|
+
if (params.dbx_max_session_ttl != null) {
|
|
2209
|
+
properties.dbx_max_session_ttl = params.dbx_max_session_ttl;
|
|
2210
|
+
}
|
|
2008
2211
|
// Merge any pre-validated metadata (e.g., inline jwks for private_key_jwt in tests)
|
|
2009
2212
|
if (validatedMetadata === null || validatedMetadata === void 0 ? void 0 : validatedMetadata.jwks) {
|
|
2010
2213
|
properties.jwks = validatedMetadata.jwks;
|
|
@@ -2062,7 +2265,7 @@ function _ts_generator$7(thisArg, body) {
|
|
|
2062
2265
|
* @throws When the client is not found.
|
|
2063
2266
|
*/ function updateClient(clientId, params) {
|
|
2064
2267
|
return _async_to_generator$7(function() {
|
|
2065
|
-
var provider, ProviderClient, existing, updatedMetadata, _params_logo_uri, _params_client_uri, client;
|
|
2268
|
+
var provider, ProviderClient, existing, updatedMetadata, _params_logo_uri, _params_client_uri, _params_dbx_max_session_ttl, client;
|
|
2066
2269
|
return _ts_generator$7(this, function(_state) {
|
|
2067
2270
|
switch(_state.label){
|
|
2068
2271
|
case 0:
|
|
@@ -2091,6 +2294,9 @@ function _ts_generator$7(thisArg, body) {
|
|
|
2091
2294
|
if (params.client_uri !== undefined) {
|
|
2092
2295
|
updatedMetadata.client_uri = (_params_client_uri = params.client_uri) !== null && _params_client_uri !== void 0 ? _params_client_uri : undefined;
|
|
2093
2296
|
}
|
|
2297
|
+
if (params.dbx_max_session_ttl !== undefined) {
|
|
2298
|
+
updatedMetadata.dbx_max_session_ttl = (_params_dbx_max_session_ttl = params.dbx_max_session_ttl) !== null && _params_dbx_max_session_ttl !== void 0 ? _params_dbx_max_session_ttl : undefined;
|
|
2299
|
+
}
|
|
2094
2300
|
// Mirrors oidc-provider's lib/helpers/add_client.js: re-validates and persists.
|
|
2095
2301
|
return [
|
|
2096
2302
|
4,
|
|
@@ -2273,13 +2479,15 @@ function _object_spread_props$1(target, source) {
|
|
|
2273
2479
|
}
|
|
2274
2480
|
// MARK: Provider Factories
|
|
2275
2481
|
/**
|
|
2276
|
-
* Factory that creates an {@link OidcModelServerActions} instance from the injected
|
|
2482
|
+
* Factory that creates an {@link OidcModelServerActions} instance from the injected services.
|
|
2277
2483
|
*
|
|
2278
|
-
* @param oidcClientService - the OIDC client service
|
|
2484
|
+
* @param oidcClientService - the OIDC client service for client CRUD actions
|
|
2485
|
+
* @param oidcService - the core OIDC service for grant revocation
|
|
2279
2486
|
* @returns the configured OidcModelServerActions instance
|
|
2280
|
-
*/ function oidcModelServerActionsFactory(oidcClientService) {
|
|
2487
|
+
*/ function oidcModelServerActionsFactory(oidcClientService, oidcService) {
|
|
2281
2488
|
var context = _object_spread_props$1(_object_spread$4({}, firebaseServerActionsContext()), {
|
|
2282
|
-
oidcClientService: oidcClientService
|
|
2489
|
+
oidcClientService: oidcClientService,
|
|
2490
|
+
oidcService: oidcService
|
|
2283
2491
|
});
|
|
2284
2492
|
return oidcModelServerActions(context);
|
|
2285
2493
|
}
|
|
@@ -2305,7 +2513,8 @@ function _object_spread_props$1(target, source) {
|
|
|
2305
2513
|
provide: OidcModelServerActions,
|
|
2306
2514
|
useFactory: oidcModelServerActionsFactory,
|
|
2307
2515
|
inject: [
|
|
2308
|
-
OidcClientService
|
|
2516
|
+
OidcClientService,
|
|
2517
|
+
OidcService
|
|
2309
2518
|
]
|
|
2310
2519
|
}
|
|
2311
2520
|
]
|
|
@@ -2372,7 +2581,7 @@ function _define_property$a(obj, key, value) {
|
|
|
2372
2581
|
}
|
|
2373
2582
|
return obj;
|
|
2374
2583
|
}
|
|
2375
|
-
function _instanceof$
|
|
2584
|
+
function _instanceof$2(left, right) {
|
|
2376
2585
|
"@swc/helpers - instanceof";
|
|
2377
2586
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
2378
2587
|
return !!right[Symbol.hasInstance](left);
|
|
@@ -2497,13 +2706,14 @@ function _ts_generator$6(thisArg, body) {
|
|
|
2497
2706
|
// MARK: Adapter
|
|
2498
2707
|
/**
|
|
2499
2708
|
* Model types that support grantId-based revocation.
|
|
2500
|
-
*/ var
|
|
2709
|
+
*/ var GRANTABLE_MODEL_NAMES = [
|
|
2501
2710
|
'AccessToken',
|
|
2502
2711
|
'AuthorizationCode',
|
|
2503
2712
|
'RefreshToken',
|
|
2504
2713
|
'DeviceCode',
|
|
2505
2714
|
'BackchannelAuthenticationRequest'
|
|
2506
|
-
]
|
|
2715
|
+
];
|
|
2716
|
+
var GRANTABLE_MODELS = new Set(GRANTABLE_MODEL_NAMES);
|
|
2507
2717
|
/**
|
|
2508
2718
|
* Creates an oidc-provider adapter constructor backed by Firestore via {@link OidcServerFirestoreCollections}.
|
|
2509
2719
|
*
|
|
@@ -2534,22 +2744,44 @@ function _ts_generator$6(thisArg, body) {
|
|
|
2534
2744
|
key: "upsert",
|
|
2535
2745
|
value: function upsert(id, payload, expiresIn) {
|
|
2536
2746
|
return _async_to_generator$6(function() {
|
|
2537
|
-
var o, data, doc;
|
|
2747
|
+
var _payload_uid, _payload_clientId, o, uid, clientId, iat, createdAtIso, createdAt, data, doc;
|
|
2538
2748
|
return _ts_generator$6(this, function(_state) {
|
|
2539
2749
|
switch(_state.label){
|
|
2540
2750
|
case 0:
|
|
2541
2751
|
// Set ownership key for Client entries so firestore rules can restrict reads by owner.
|
|
2542
2752
|
// The firestoreOwnerKey is passed through the payload metadata by OidcClientService.
|
|
2543
2753
|
o = this.name === OIDC_ENTRY_CLIENT_TYPE ? payload.firestoreOwnerKey : undefined;
|
|
2754
|
+
// oidc-provider uses `accountId` as the user identifier on Grant, AccessToken,
|
|
2755
|
+
// RefreshToken, etc. — `payload.uid` is only populated on Session/Interaction.
|
|
2756
|
+
// Fall back to `accountId` so the indexed `uid` column works for all entry types.
|
|
2757
|
+
uid = (_payload_uid = payload.uid) !== null && _payload_uid !== void 0 ? _payload_uid : payload.accountId;
|
|
2758
|
+
// oidc-provider stores the OAuth client id as `clientId` on every grantable
|
|
2759
|
+
// model (Grant, AccessToken, RefreshToken, AuthorizationCode, DeviceCode, etc.).
|
|
2760
|
+
// Client entries themselves use `client_id` in the payload, so we read both.
|
|
2761
|
+
clientId = (_payload_clientId = payload.clientId) !== null && _payload_clientId !== void 0 ? _payload_clientId : payload.client_id;
|
|
2762
|
+
// Derive a stable `createdAt` from the payload so it survives upserts
|
|
2763
|
+
// (e.g. `consume`). Grant/AccessToken/RefreshToken/AuthorizationCode all
|
|
2764
|
+
// inherit `iat` (epoch seconds) from BaseToken; Client entries use
|
|
2765
|
+
// `created_at` (ISO string).
|
|
2766
|
+
iat = payload.iat;
|
|
2767
|
+
createdAtIso = payload.created_at;
|
|
2768
|
+
if (typeof iat === 'number') {
|
|
2769
|
+
createdAt = unixDateTimeSecondsNumberToDate(iat);
|
|
2770
|
+
} else if (createdAtIso) {
|
|
2771
|
+
createdAt = safeToJsDate(createdAtIso);
|
|
2772
|
+
}
|
|
2544
2773
|
data = _object_spread$3({
|
|
2545
2774
|
type: this.name,
|
|
2546
2775
|
payload: encryptionService.encryptAdapterPayload(payload),
|
|
2547
2776
|
o: o,
|
|
2548
|
-
uid:
|
|
2777
|
+
uid: uid,
|
|
2549
2778
|
grantId: payload.grantId,
|
|
2779
|
+
clientId: clientId,
|
|
2550
2780
|
userCode: payload.userCode,
|
|
2551
2781
|
consumed: payload.consumed
|
|
2552
|
-
},
|
|
2782
|
+
}, createdAt ? {
|
|
2783
|
+
createdAt: createdAt
|
|
2784
|
+
} : undefined, expiresIn ? {
|
|
2553
2785
|
expiresAt: unixDateTimeSecondsNumberToDate(unixDateTimeSecondsNumberForNow() + expiresIn)
|
|
2554
2786
|
} : undefined);
|
|
2555
2787
|
doc = this.collection.documentAccessor().loadDocumentForId(id);
|
|
@@ -2758,7 +2990,7 @@ function _ts_generator$6(thisArg, body) {
|
|
|
2758
2990
|
* @returns the decrypted adapter payload, or undefined if the entry has expired
|
|
2759
2991
|
*/ key: "_toPayload",
|
|
2760
2992
|
value: function _toPayload(data) {
|
|
2761
|
-
var expiresDate = data.expiresAt ? _instanceof$
|
|
2993
|
+
var expiresDate = data.expiresAt ? _instanceof$2(data.expiresAt, Date) ? data.expiresAt : data.expiresAt.toDate() : undefined;
|
|
2762
2994
|
var isExpired = expiresDate != null && expiresDate < new Date();
|
|
2763
2995
|
return isExpired ? undefined : encryptionService.decryptAdapterPayload(data.payload);
|
|
2764
2996
|
}
|
|
@@ -3363,6 +3595,36 @@ function _ts_generator$5(thisArg, body) {
|
|
|
3363
3595
|
return this._getProvider();
|
|
3364
3596
|
}
|
|
3365
3597
|
},
|
|
3598
|
+
{
|
|
3599
|
+
// MARK: Login Duration
|
|
3600
|
+
/**
|
|
3601
|
+
* Resolves the login-duration TTL (seconds) for a Grant being created from a fresh consent submission.
|
|
3602
|
+
*
|
|
3603
|
+
* The Grant TTL configured on the oidc-provider only fires when oidc-provider's koa middleware drives
|
|
3604
|
+
* `grant.save()` (so `AsyncLocalStorage` carries the request context). Our consent flow saves grants
|
|
3605
|
+
* from a NestJS controller, so we resolve the TTL up-front and pre-set `grant.expiresIn` before saving.
|
|
3606
|
+
*
|
|
3607
|
+
* Mirrors the resolution used by the `Grant`/`Session` TTL functions in {@link buildProviderConfiguration}.
|
|
3608
|
+
*
|
|
3609
|
+
* @param requestedRawTtl - The raw `dbx_session_ttl` value from `interaction.params`, if any.
|
|
3610
|
+
* @param clientPayload - The persisted client metadata, used to read the per-client `dbx_max_session_ttl` cap.
|
|
3611
|
+
* @returns The resolved Grant TTL in seconds.
|
|
3612
|
+
*/ key: "resolveLoginDurationForGrant",
|
|
3613
|
+
value: function resolveLoginDurationForGrant(requestedRawTtl, clientPayload) {
|
|
3614
|
+
var _config_maxRequestedLoginDuration, _config_minRequestedLoginDuration, _config_defaultRequestedLoginDuration;
|
|
3615
|
+
var config = this.config;
|
|
3616
|
+
var serverMaxSeconds = (_config_maxRequestedLoginDuration = config.maxRequestedLoginDuration) !== null && _config_maxRequestedLoginDuration !== void 0 ? _config_maxRequestedLoginDuration : DEFAULT_MAX_REQUESTED_LOGIN_DURATION_SECONDS;
|
|
3617
|
+
var serverMinSeconds = (_config_minRequestedLoginDuration = config.minRequestedLoginDuration) !== null && _config_minRequestedLoginDuration !== void 0 ? _config_minRequestedLoginDuration : DEFAULT_MIN_REQUESTED_LOGIN_DURATION_SECONDS;
|
|
3618
|
+
var defaultSeconds = (_config_defaultRequestedLoginDuration = config.defaultRequestedLoginDuration) !== null && _config_defaultRequestedLoginDuration !== void 0 ? _config_defaultRequestedLoginDuration : config.tokenLifetimes.grant;
|
|
3619
|
+
return resolveLoginDurationSeconds({
|
|
3620
|
+
requestedSeconds: parseRequestedSessionTtlSeconds(requestedRawTtl),
|
|
3621
|
+
clientMaxSeconds: clientPayload === null || clientPayload === void 0 ? void 0 : clientPayload.dbx_max_session_ttl,
|
|
3622
|
+
serverMaxSeconds: serverMaxSeconds,
|
|
3623
|
+
serverMinSeconds: serverMinSeconds,
|
|
3624
|
+
defaultSeconds: defaultSeconds
|
|
3625
|
+
});
|
|
3626
|
+
}
|
|
3627
|
+
},
|
|
3366
3628
|
{
|
|
3367
3629
|
key: "verifyAccessToken",
|
|
3368
3630
|
value: // MARK: Token Verification
|
|
@@ -3440,6 +3702,67 @@ function _ts_generator$5(thisArg, body) {
|
|
|
3440
3702
|
}).call(this);
|
|
3441
3703
|
}
|
|
3442
3704
|
},
|
|
3705
|
+
{
|
|
3706
|
+
key: "revokeGrant",
|
|
3707
|
+
value: // MARK: Grant Revocation
|
|
3708
|
+
/**
|
|
3709
|
+
* Revokes a Grant entry and every grantable token entry that references it.
|
|
3710
|
+
*
|
|
3711
|
+
* Iterates through every grantable model (`AccessToken`, `AuthorizationCode`,
|
|
3712
|
+
* `RefreshToken`, `DeviceCode`, `BackchannelAuthenticationRequest`) and calls
|
|
3713
|
+
* the adapter's `revokeByGrantId` to delete all matching entries, then
|
|
3714
|
+
* deletes the Grant adapter entry itself. After this resolves, any token
|
|
3715
|
+
* referencing the grant is gone — `verifyAccessToken` returns `undefined`
|
|
3716
|
+
* and a `grant_type=refresh_token` exchange fails with `invalid_grant`.
|
|
3717
|
+
*
|
|
3718
|
+
* @param grantId - the grant id (and Grant adapter entry id) to revoke
|
|
3719
|
+
* @throws when the Grant entry does not exist
|
|
3720
|
+
*/ function revokeGrant(grantId) {
|
|
3721
|
+
return _async_to_generator$5(function() {
|
|
3722
|
+
var provider, ProviderGrant, existing;
|
|
3723
|
+
return _ts_generator$5(this, function(_state) {
|
|
3724
|
+
switch(_state.label){
|
|
3725
|
+
case 0:
|
|
3726
|
+
return [
|
|
3727
|
+
4,
|
|
3728
|
+
this.getProvider()
|
|
3729
|
+
];
|
|
3730
|
+
case 1:
|
|
3731
|
+
provider = _state.sent();
|
|
3732
|
+
ProviderGrant = provider.Grant;
|
|
3733
|
+
return [
|
|
3734
|
+
4,
|
|
3735
|
+
ProviderGrant.adapter.find(grantId)
|
|
3736
|
+
];
|
|
3737
|
+
case 2:
|
|
3738
|
+
existing = _state.sent();
|
|
3739
|
+
if (!existing) {
|
|
3740
|
+
throw new Error('Grant not found.');
|
|
3741
|
+
}
|
|
3742
|
+
return [
|
|
3743
|
+
4,
|
|
3744
|
+
Promise.all(GRANTABLE_MODEL_NAMES.map(function(modelName) {
|
|
3745
|
+
var _Model_adapter_revokeByGrantId, _Model_adapter;
|
|
3746
|
+
var Model = provider[modelName];
|
|
3747
|
+
return Model === null || Model === void 0 ? void 0 : (_Model_adapter = Model.adapter) === null || _Model_adapter === void 0 ? void 0 : (_Model_adapter_revokeByGrantId = _Model_adapter.revokeByGrantId) === null || _Model_adapter_revokeByGrantId === void 0 ? void 0 : _Model_adapter_revokeByGrantId.call(_Model_adapter, grantId);
|
|
3748
|
+
}))
|
|
3749
|
+
];
|
|
3750
|
+
case 3:
|
|
3751
|
+
_state.sent();
|
|
3752
|
+
return [
|
|
3753
|
+
4,
|
|
3754
|
+
ProviderGrant.adapter.destroy(grantId)
|
|
3755
|
+
];
|
|
3756
|
+
case 4:
|
|
3757
|
+
_state.sent();
|
|
3758
|
+
return [
|
|
3759
|
+
2
|
|
3760
|
+
];
|
|
3761
|
+
}
|
|
3762
|
+
});
|
|
3763
|
+
}).call(this);
|
|
3764
|
+
}
|
|
3765
|
+
},
|
|
3443
3766
|
{
|
|
3444
3767
|
key: "findClientPayload",
|
|
3445
3768
|
value: /**
|
|
@@ -3476,7 +3799,8 @@ function _ts_generator$5(thisArg, body) {
|
|
|
3476
3799
|
token_endpoint_auth_method: existing.token_endpoint_auth_method,
|
|
3477
3800
|
logo_uri: existing.logo_uri,
|
|
3478
3801
|
client_uri: existing.client_uri,
|
|
3479
|
-
created_at: existing.created_at
|
|
3802
|
+
created_at: existing.created_at,
|
|
3803
|
+
dbx_max_session_ttl: existing.dbx_max_session_ttl
|
|
3480
3804
|
};
|
|
3481
3805
|
}
|
|
3482
3806
|
return [
|
|
@@ -3501,8 +3825,21 @@ function _ts_generator$5(thisArg, body) {
|
|
|
3501
3825
|
*/ key: "buildProviderConfiguration",
|
|
3502
3826
|
value: function buildProviderConfiguration(cookieKeys) {
|
|
3503
3827
|
var _this = this;
|
|
3828
|
+
var _config_maxRequestedLoginDuration, _config_minRequestedLoginDuration;
|
|
3504
3829
|
var config = this.config;
|
|
3505
3830
|
var providerConfig = this.providerConfigService.providerConfig;
|
|
3831
|
+
var serverMaxSeconds = (_config_maxRequestedLoginDuration = config.maxRequestedLoginDuration) !== null && _config_maxRequestedLoginDuration !== void 0 ? _config_maxRequestedLoginDuration : DEFAULT_MAX_REQUESTED_LOGIN_DURATION_SECONDS;
|
|
3832
|
+
var serverMinSeconds = (_config_minRequestedLoginDuration = config.minRequestedLoginDuration) !== null && _config_minRequestedLoginDuration !== void 0 ? _config_minRequestedLoginDuration : DEFAULT_MIN_REQUESTED_LOGIN_DURATION_SECONDS;
|
|
3833
|
+
var overrideDefaultSeconds = config.defaultRequestedLoginDuration;
|
|
3834
|
+
var resolveDurationFromCtx = function resolveDurationFromCtx(ctx, client, perModelDefaultSeconds) {
|
|
3835
|
+
return resolveLoginDurationSeconds({
|
|
3836
|
+
requestedSeconds: readRequestedSessionTtlSeconds(ctx),
|
|
3837
|
+
clientMaxSeconds: client === null || client === void 0 ? void 0 : client.dbx_max_session_ttl,
|
|
3838
|
+
serverMaxSeconds: serverMaxSeconds,
|
|
3839
|
+
serverMinSeconds: serverMinSeconds,
|
|
3840
|
+
defaultSeconds: overrideDefaultSeconds !== null && overrideDefaultSeconds !== void 0 ? overrideDefaultSeconds : perModelDefaultSeconds
|
|
3841
|
+
});
|
|
3842
|
+
};
|
|
3506
3843
|
return _object_spread_props(_object_spread$2({
|
|
3507
3844
|
routes: _object_spread$2({}, this.providerConfigService.routes),
|
|
3508
3845
|
claims: _object_spread$2({}, providerConfig.claims),
|
|
@@ -3523,13 +3860,46 @@ function _ts_generator$5(thisArg, body) {
|
|
|
3523
3860
|
enabled: this.providerConfigService.oidcRegistrationRouteEnabled
|
|
3524
3861
|
}
|
|
3525
3862
|
},
|
|
3863
|
+
extraParams: [
|
|
3864
|
+
DBX_FIREBASE_SERVER_OIDC_SESSION_TTL_PARAM
|
|
3865
|
+
],
|
|
3866
|
+
extraClientMetadata: {
|
|
3867
|
+
properties: [
|
|
3868
|
+
DBX_FIREBASE_SERVER_OIDC_MAX_SESSION_TTL_CLIENT_METADATA
|
|
3869
|
+
],
|
|
3870
|
+
validator: function validator(_ctx, key, value) {
|
|
3871
|
+
if (key !== DBX_FIREBASE_SERVER_OIDC_MAX_SESSION_TTL_CLIENT_METADATA) {
|
|
3872
|
+
return;
|
|
3873
|
+
}
|
|
3874
|
+
if (value === undefined || value === null) {
|
|
3875
|
+
return;
|
|
3876
|
+
}
|
|
3877
|
+
if (typeof value !== 'number' || !Number.isInteger(value) || value <= 0) {
|
|
3878
|
+
throw new errors.InvalidClientMetadata("".concat(DBX_FIREBASE_SERVER_OIDC_MAX_SESSION_TTL_CLIENT_METADATA, " must be a positive integer (seconds)."));
|
|
3879
|
+
}
|
|
3880
|
+
if (value > serverMaxSeconds) {
|
|
3881
|
+
throw new errors.InvalidClientMetadata("".concat(DBX_FIREBASE_SERVER_OIDC_MAX_SESSION_TTL_CLIENT_METADATA, " cannot exceed the server max of ").concat(serverMaxSeconds, " seconds."));
|
|
3882
|
+
}
|
|
3883
|
+
}
|
|
3884
|
+
},
|
|
3526
3885
|
ttl: {
|
|
3527
3886
|
AccessToken: config.tokenLifetimes.accessToken,
|
|
3528
3887
|
IdToken: config.tokenLifetimes.idToken,
|
|
3529
3888
|
AuthorizationCode: config.tokenLifetimes.authorizationCode,
|
|
3530
|
-
RefreshToken:
|
|
3531
|
-
|
|
3532
|
-
|
|
3889
|
+
RefreshToken: function RefreshToken(ctx, _refreshToken, _client) {
|
|
3890
|
+
// The token endpoint's ctx.oidc.params holds the token-request body (code, code_verifier, …),
|
|
3891
|
+
// not the original auth params — `dbx_session_ttl` is no longer reachable here. The Grant
|
|
3892
|
+
// entity is bound on both initial issuance (authorization_code → token) and rotation
|
|
3893
|
+
// (refresh_token → token), and its `exp` already encodes the resolved login duration.
|
|
3894
|
+
var remaining = readRemainingGrantSeconds(ctx);
|
|
3895
|
+
return Math.min(remaining !== null && remaining !== void 0 ? remaining : config.tokenLifetimes.refreshToken, config.tokenLifetimes.refreshToken);
|
|
3896
|
+
},
|
|
3897
|
+
Session: function Session(ctx, _session) {
|
|
3898
|
+
return resolveDurationFromCtx(ctx, undefined, config.tokenLifetimes.session);
|
|
3899
|
+
},
|
|
3900
|
+
Grant: function Grant(ctx, _grant, client) {
|
|
3901
|
+
return resolveDurationFromCtx(ctx, client, config.tokenLifetimes.grant);
|
|
3902
|
+
},
|
|
3533
3903
|
Interaction: 60 * 60,
|
|
3534
3904
|
DeviceCode: 10 * 60
|
|
3535
3905
|
},
|
|
@@ -3648,7 +4018,7 @@ function _ts_generator$5(thisArg, body) {
|
|
|
3648
4018
|
value: // MARK: Internal
|
|
3649
4019
|
function _buildProvider() {
|
|
3650
4020
|
return _async_to_generator$5(function() {
|
|
3651
|
-
var _this, config, findAccount, signingKey, result, getEncryptionKey, cookieKey, adapterFactory, providerConfiguration, _ref, ProviderClass, provider;
|
|
4021
|
+
var _this, _config_trustProxy, config, findAccount, signingKey, result, getEncryptionKey, cookieKey, adapterFactory, providerConfiguration, _ref, ProviderClass, provider;
|
|
3652
4022
|
return _ts_generator$5(this, function(_state) {
|
|
3653
4023
|
switch(_state.label){
|
|
3654
4024
|
case 0:
|
|
@@ -3699,6 +4069,12 @@ function _ts_generator$5(thisArg, body) {
|
|
|
3699
4069
|
]
|
|
3700
4070
|
}
|
|
3701
4071
|
}));
|
|
4072
|
+
// Trust upstream X-Forwarded-* headers when running behind a reverse proxy
|
|
4073
|
+
// (e.g. Firebase Hosting → Cloud Run). Without this, oidc-provider builds
|
|
4074
|
+
// the interaction `returnTo` URL off the Cloud Run host instead of the
|
|
4075
|
+
// issuer's canonical host, so cookies set on the issuer host are not sent
|
|
4076
|
+
// on resume → "authorization request has expired".
|
|
4077
|
+
provider.proxy = (_config_trustProxy = config.trustProxy) !== null && _config_trustProxy !== void 0 ? _config_trustProxy : true;
|
|
3702
4078
|
if (config.suppressBodyParserWarning) ;
|
|
3703
4079
|
return [
|
|
3704
4080
|
2,
|
|
@@ -3782,7 +4158,7 @@ function _define_property$6(obj, key, value) {
|
|
|
3782
4158
|
}
|
|
3783
4159
|
return obj;
|
|
3784
4160
|
}
|
|
3785
|
-
function _instanceof(left, right) {
|
|
4161
|
+
function _instanceof$1(left, right) {
|
|
3786
4162
|
"@swc/helpers - instanceof";
|
|
3787
4163
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
3788
4164
|
return !!right[Symbol.hasInstance](left);
|
|
@@ -3946,7 +4322,7 @@ function _ts_generator$4(thisArg, body) {
|
|
|
3946
4322
|
];
|
|
3947
4323
|
case 3:
|
|
3948
4324
|
err = _state.sent();
|
|
3949
|
-
if (_instanceof(err, UnauthorizedException)) {
|
|
4325
|
+
if (_instanceof$1(err, UnauthorizedException)) {
|
|
3950
4326
|
throw err;
|
|
3951
4327
|
}
|
|
3952
4328
|
this.logger.error('Bearer token verification failed', err);
|
|
@@ -4411,13 +4787,20 @@ function _ts_generator$3(thisArg, body) {
|
|
|
4411
4787
|
value: /**
|
|
4412
4788
|
* Finds an existing grant by ID, or creates a new one.
|
|
4413
4789
|
*
|
|
4790
|
+
* For new grants, optionally pre-set `expiresIn` so {@link Grant#save} writes the requested TTL
|
|
4791
|
+
* instead of falling through to the configured Grant TTL function (which cannot read the original
|
|
4792
|
+
* `dbx_session_ttl` request param when save is driven from a NestJS controller — see
|
|
4793
|
+
* {@link OidcService#resolveLoginDurationForGrant}).
|
|
4794
|
+
*
|
|
4414
4795
|
* @param grantId - the existing grant ID to look up, or undefined to create a new grant
|
|
4415
4796
|
* @param accountId - the account ID for creating a new grant
|
|
4416
4797
|
* @param clientId - the client ID for creating a new grant
|
|
4798
|
+
* @param expiresInSeconds - optional TTL (seconds) to assign to a newly-created grant
|
|
4417
4799
|
* @returns the found or newly created grant
|
|
4418
|
-
*/
|
|
4800
|
+
*/ // eslint-disable-next-line @typescript-eslint/max-params -- positional args mirror the existing call sites
|
|
4801
|
+
function findOrCreateGrant(grantId, accountId, clientId, expiresInSeconds) {
|
|
4419
4802
|
return _async_to_generator$3(function() {
|
|
4420
|
-
var provider, grant, found;
|
|
4803
|
+
var provider, grant, found, grantInit;
|
|
4421
4804
|
return _ts_generator$3(this, function(_state) {
|
|
4422
4805
|
switch(_state.label){
|
|
4423
4806
|
case 0:
|
|
@@ -4446,10 +4829,14 @@ function _ts_generator$3(thisArg, body) {
|
|
|
4446
4829
|
4
|
|
4447
4830
|
];
|
|
4448
4831
|
case 3:
|
|
4449
|
-
|
|
4832
|
+
grantInit = {
|
|
4450
4833
|
accountId: accountId,
|
|
4451
4834
|
clientId: clientId
|
|
4452
|
-
}
|
|
4835
|
+
};
|
|
4836
|
+
if (expiresInSeconds != null) {
|
|
4837
|
+
grantInit.expiresIn = expiresInSeconds;
|
|
4838
|
+
}
|
|
4839
|
+
grant = new provider.Grant(grantInit);
|
|
4453
4840
|
_state.label = 4;
|
|
4454
4841
|
case 4:
|
|
4455
4842
|
return [
|
|
@@ -4538,6 +4925,14 @@ function _define_property$3(obj, key, value) {
|
|
|
4538
4925
|
}
|
|
4539
4926
|
return obj;
|
|
4540
4927
|
}
|
|
4928
|
+
function _instanceof(left, right) {
|
|
4929
|
+
"@swc/helpers - instanceof";
|
|
4930
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
4931
|
+
return !!right[Symbol.hasInstance](left);
|
|
4932
|
+
} else {
|
|
4933
|
+
return left instanceof right;
|
|
4934
|
+
}
|
|
4935
|
+
}
|
|
4541
4936
|
function _iterable_to_array_limit(arr, i) {
|
|
4542
4937
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
4543
4938
|
if (_i == null) return;
|
|
@@ -4675,6 +5070,14 @@ function _ts_generator$2(thisArg, body) {
|
|
|
4675
5070
|
};
|
|
4676
5071
|
}
|
|
4677
5072
|
}
|
|
5073
|
+
/**
|
|
5074
|
+
* OIDC scopes that the server always grants on consent when they were
|
|
5075
|
+
* requested, regardless of whether the frontend included them in
|
|
5076
|
+
* `grantedOIDCScopes`. `openid` is required for any OIDC flow, so the
|
|
5077
|
+
* UI shows it as non-deselectable and the server enforces it here.
|
|
5078
|
+
*/ var ALWAYS_GRANTED_OIDC_SCOPES = [
|
|
5079
|
+
'openid'
|
|
5080
|
+
];
|
|
4678
5081
|
// MARK: Interaction Controller
|
|
4679
5082
|
/**
|
|
4680
5083
|
* Controller for OIDC interaction endpoints (login/consent).
|
|
@@ -4686,14 +5089,16 @@ function _ts_generator$2(thisArg, body) {
|
|
|
4686
5089
|
* Firebase Auth ID token and bypass the oidc-provider interaction cookie
|
|
4687
5090
|
* (which is scoped to the frontend path set by `interactions.url`).
|
|
4688
5091
|
*/ var OidcInteractionController = /*#__PURE__*/ function() {
|
|
4689
|
-
function OidcInteractionController(oidcInteractionService, oidcProviderConfigService, accountService) {
|
|
5092
|
+
function OidcInteractionController(oidcInteractionService, oidcProviderConfigService, accountService, oidcService) {
|
|
4690
5093
|
_class_call_check$2(this, OidcInteractionController);
|
|
4691
5094
|
_define_property$3(this, "oidcInteractionService", void 0);
|
|
4692
5095
|
_define_property$3(this, "oidcProviderConfigService", void 0);
|
|
4693
5096
|
_define_property$3(this, "accountService", void 0);
|
|
5097
|
+
_define_property$3(this, "oidcService", void 0);
|
|
4694
5098
|
this.oidcInteractionService = oidcInteractionService;
|
|
4695
5099
|
this.oidcProviderConfigService = oidcProviderConfigService;
|
|
4696
5100
|
this.accountService = accountService;
|
|
5101
|
+
this.oidcService = oidcService;
|
|
4697
5102
|
}
|
|
4698
5103
|
_create_class$2(OidcInteractionController, [
|
|
4699
5104
|
{
|
|
@@ -4827,7 +5232,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
4827
5232
|
* @throws {HttpException} 400 when the consent interaction cannot be completed.
|
|
4828
5233
|
*/ function postConsent(uid, body, res) {
|
|
4829
5234
|
return _async_to_generator$2(function() {
|
|
4830
|
-
var _ref, redirectTo, interaction, prompt, params, session, grant, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, indicator, scopes, grantId, redirectTo1;
|
|
5235
|
+
var _ref, _ref1, _prompt_details_missingOIDCScope, _prompt_details_missingOIDCClaims, _prompt_details_missingResourceScopes, redirectTo, interaction, prompt, params, session, clientId, requestedRawTtl, clientPayload, clientMaxSessionTtl, expiresInSeconds, grant, missingOIDCScope, _resolveEffectiveSubset, granted, rejected, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, value, missingOIDCClaims, _resolveEffectiveSubset1, granted1, rejected1, missingResourceScopes, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, _step_value, indicator, scopes, _body_grantedResourceScopes, requestedSubset, _resolveEffectiveSubset2, granted2, rejected2, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, value1, grantId, redirectTo1, err;
|
|
4831
5236
|
return _ts_generator$2(this, function(_state) {
|
|
4832
5237
|
switch(_state.label){
|
|
4833
5238
|
case 0:
|
|
@@ -4841,9 +5246,9 @@ function _ts_generator$2(thisArg, body) {
|
|
|
4841
5246
|
case 2:
|
|
4842
5247
|
_state.trys.push([
|
|
4843
5248
|
2,
|
|
4844
|
-
|
|
5249
|
+
10,
|
|
4845
5250
|
,
|
|
4846
|
-
|
|
5251
|
+
11
|
|
4847
5252
|
]);
|
|
4848
5253
|
if (!!body.approved) return [
|
|
4849
5254
|
3,
|
|
@@ -4874,24 +5279,40 @@ function _ts_generator$2(thisArg, body) {
|
|
|
4874
5279
|
case 5:
|
|
4875
5280
|
interaction = _state.sent();
|
|
4876
5281
|
prompt = interaction.prompt, params = interaction.params, session = interaction.session;
|
|
5282
|
+
clientId = params.client_id;
|
|
5283
|
+
// Resolve the requested login duration up-front. The configured Grant TTL function (in
|
|
5284
|
+
// OidcService.buildProviderConfiguration) only fires when oidc-provider's koa middleware
|
|
5285
|
+
// drives `grant.save()`, so its `ctx.oidc.params` lookup of `dbx_session_ttl` returns
|
|
5286
|
+
// undefined when the consent submit runs in this controller. We pre-set `expiresIn` on
|
|
5287
|
+
// newly-created grants so they persist with the correct TTL.
|
|
5288
|
+
requestedRawTtl = params[DBX_FIREBASE_SERVER_OIDC_SESSION_TTL_PARAM];
|
|
4877
5289
|
return [
|
|
4878
5290
|
4,
|
|
4879
|
-
this.
|
|
5291
|
+
this.oidcService.findClientPayload(clientId)
|
|
4880
5292
|
];
|
|
4881
5293
|
case 6:
|
|
5294
|
+
clientPayload = _state.sent();
|
|
5295
|
+
clientMaxSessionTtl = (_ref = clientPayload === null || clientPayload === void 0 ? void 0 : clientPayload.dbx_max_session_ttl) !== null && _ref !== void 0 ? _ref : undefined;
|
|
5296
|
+
expiresInSeconds = this.oidcService.resolveLoginDurationForGrant(requestedRawTtl, {
|
|
5297
|
+
dbx_max_session_ttl: clientMaxSessionTtl
|
|
5298
|
+
});
|
|
5299
|
+
return [
|
|
5300
|
+
4,
|
|
5301
|
+
this.oidcInteractionService.findOrCreateGrant(interaction.grantId, (_ref1 = session === null || session === void 0 ? void 0 : session.accountId) !== null && _ref1 !== void 0 ? _ref1 : '', clientId, expiresInSeconds)
|
|
5302
|
+
];
|
|
5303
|
+
case 7:
|
|
4882
5304
|
grant = _state.sent();
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
if (prompt.details.missingResourceScopes) {
|
|
5305
|
+
missingOIDCScope = (_prompt_details_missingOIDCScope = prompt.details.missingOIDCScope) !== null && _prompt_details_missingOIDCScope !== void 0 ? _prompt_details_missingOIDCScope : [];
|
|
5306
|
+
if (missingOIDCScope.length > 0) {
|
|
5307
|
+
_resolveEffectiveSubset = resolveEffectiveSubset(missingOIDCScope, body.grantedOIDCScopes, ALWAYS_GRANTED_OIDC_SCOPES), granted = _resolveEffectiveSubset.granted, rejected = _resolveEffectiveSubset.rejected;
|
|
5308
|
+
if (granted.length > 0) {
|
|
5309
|
+
grant.addOIDCScope(granted.join(' '));
|
|
5310
|
+
}
|
|
4890
5311
|
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4891
5312
|
try {
|
|
4892
|
-
for(_iterator =
|
|
4893
|
-
|
|
4894
|
-
grant.
|
|
5313
|
+
for(_iterator = rejected[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5314
|
+
value = _step.value;
|
|
5315
|
+
grant.rejectOIDCScope(value);
|
|
4895
5316
|
}
|
|
4896
5317
|
} catch (err) {
|
|
4897
5318
|
_didIteratorError = true;
|
|
@@ -4908,11 +5329,67 @@ function _ts_generator$2(thisArg, body) {
|
|
|
4908
5329
|
}
|
|
4909
5330
|
}
|
|
4910
5331
|
}
|
|
5332
|
+
missingOIDCClaims = (_prompt_details_missingOIDCClaims = prompt.details.missingOIDCClaims) !== null && _prompt_details_missingOIDCClaims !== void 0 ? _prompt_details_missingOIDCClaims : [];
|
|
5333
|
+
if (missingOIDCClaims.length > 0) {
|
|
5334
|
+
_resolveEffectiveSubset1 = resolveEffectiveSubset(missingOIDCClaims, body.grantedOIDCClaims), granted1 = _resolveEffectiveSubset1.granted, rejected1 = _resolveEffectiveSubset1.rejected;
|
|
5335
|
+
if (granted1.length > 0) {
|
|
5336
|
+
grant.addOIDCClaims(granted1);
|
|
5337
|
+
}
|
|
5338
|
+
if (rejected1.length > 0) {
|
|
5339
|
+
grant.rejectOIDCClaims(rejected1);
|
|
5340
|
+
}
|
|
5341
|
+
}
|
|
5342
|
+
missingResourceScopes = (_prompt_details_missingResourceScopes = prompt.details.missingResourceScopes) !== null && _prompt_details_missingResourceScopes !== void 0 ? _prompt_details_missingResourceScopes : {};
|
|
5343
|
+
_iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
5344
|
+
try {
|
|
5345
|
+
for(_iterator1 = Object.entries(missingResourceScopes)[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
5346
|
+
_step_value = _sliced_to_array(_step1.value, 2), indicator = _step_value[0], scopes = _step_value[1];
|
|
5347
|
+
;
|
|
5348
|
+
requestedSubset = (_body_grantedResourceScopes = body.grantedResourceScopes) === null || _body_grantedResourceScopes === void 0 ? void 0 : _body_grantedResourceScopes[indicator];
|
|
5349
|
+
_resolveEffectiveSubset2 = resolveEffectiveSubset(scopes, requestedSubset), granted2 = _resolveEffectiveSubset2.granted, rejected2 = _resolveEffectiveSubset2.rejected;
|
|
5350
|
+
if (granted2.length > 0) {
|
|
5351
|
+
grant.addResourceScope(indicator, granted2.join(' '));
|
|
5352
|
+
}
|
|
5353
|
+
_iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
|
|
5354
|
+
try {
|
|
5355
|
+
for(_iterator2 = rejected2[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
5356
|
+
value1 = _step2.value;
|
|
5357
|
+
grant.rejectResourceScope(indicator, value1);
|
|
5358
|
+
}
|
|
5359
|
+
} catch (err) {
|
|
5360
|
+
_didIteratorError2 = true;
|
|
5361
|
+
_iteratorError2 = err;
|
|
5362
|
+
} finally{
|
|
5363
|
+
try {
|
|
5364
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
5365
|
+
_iterator2.return();
|
|
5366
|
+
}
|
|
5367
|
+
} finally{
|
|
5368
|
+
if (_didIteratorError2) {
|
|
5369
|
+
throw _iteratorError2;
|
|
5370
|
+
}
|
|
5371
|
+
}
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5374
|
+
} catch (err) {
|
|
5375
|
+
_didIteratorError1 = true;
|
|
5376
|
+
_iteratorError1 = err;
|
|
5377
|
+
} finally{
|
|
5378
|
+
try {
|
|
5379
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
5380
|
+
_iterator1.return();
|
|
5381
|
+
}
|
|
5382
|
+
} finally{
|
|
5383
|
+
if (_didIteratorError1) {
|
|
5384
|
+
throw _iteratorError1;
|
|
5385
|
+
}
|
|
5386
|
+
}
|
|
5387
|
+
}
|
|
4911
5388
|
return [
|
|
4912
5389
|
4,
|
|
4913
5390
|
grant.save()
|
|
4914
5391
|
];
|
|
4915
|
-
case
|
|
5392
|
+
case 8:
|
|
4916
5393
|
grantId = _state.sent();
|
|
4917
5394
|
return [
|
|
4918
5395
|
4,
|
|
@@ -4924,19 +5401,22 @@ function _ts_generator$2(thisArg, body) {
|
|
|
4924
5401
|
mergeWithLastSubmission: true
|
|
4925
5402
|
})
|
|
4926
5403
|
];
|
|
4927
|
-
case
|
|
5404
|
+
case 9:
|
|
4928
5405
|
redirectTo1 = _state.sent();
|
|
4929
5406
|
res.json({
|
|
4930
5407
|
redirectTo: redirectTo1
|
|
4931
5408
|
});
|
|
4932
5409
|
return [
|
|
4933
5410
|
3,
|
|
4934
|
-
|
|
5411
|
+
11
|
|
4935
5412
|
];
|
|
4936
|
-
case 9:
|
|
4937
|
-
_state.sent();
|
|
4938
|
-
throw new HttpException('Consent interaction failed', HttpStatus.BAD_REQUEST);
|
|
4939
5413
|
case 10:
|
|
5414
|
+
err = _state.sent();
|
|
5415
|
+
if (_instanceof(err, HttpException)) {
|
|
5416
|
+
throw err;
|
|
5417
|
+
}
|
|
5418
|
+
throw new HttpException('Consent interaction failed', HttpStatus.BAD_REQUEST);
|
|
5419
|
+
case 11:
|
|
4940
5420
|
return [
|
|
4941
5421
|
2
|
|
4942
5422
|
];
|
|
@@ -5015,8 +5495,108 @@ OidcInteractionController = __decorate([
|
|
|
5015
5495
|
Controller('interaction'),
|
|
5016
5496
|
__param(0, Inject(OidcInteractionService)),
|
|
5017
5497
|
__param(1, Inject(OidcProviderConfigService)),
|
|
5018
|
-
__param(2, Inject(OidcAccountService))
|
|
5498
|
+
__param(2, Inject(OidcAccountService)),
|
|
5499
|
+
__param(3, Inject(OidcService))
|
|
5019
5500
|
], OidcInteractionController);
|
|
5501
|
+
/**
|
|
5502
|
+
* Resolves the effective set to grant — and the complementary set to
|
|
5503
|
+
* reject — from a missing set, an optional caller-provided subset, and
|
|
5504
|
+
* an optional list of always-granted entries.
|
|
5505
|
+
*
|
|
5506
|
+
* Throws `400 BAD_REQUEST` if the requested subset contains entries that
|
|
5507
|
+
* are not in the missing set (no privilege escalation).
|
|
5508
|
+
*
|
|
5509
|
+
* - When `requestedSubset` is undefined → grants everything in `missing` (back-compat); rejects nothing.
|
|
5510
|
+
* - When `requestedSubset` is provided → grants exactly that subset; rejects every other missing entry so
|
|
5511
|
+
* oidc-provider does not re-prompt for them.
|
|
5512
|
+
* - Always-granted entries are union'd into `granted` (clamped to `missing`).
|
|
5513
|
+
*
|
|
5514
|
+
* @param missing - Entries the OIDC prompt indicated were missing for this consent.
|
|
5515
|
+
* @param requestedSubset - Optional subset the caller wants to grant; must be a subset of `missing`.
|
|
5516
|
+
* @param alwaysGranted - Entries that must be granted whenever they appear in `missing`, regardless of `requestedSubset`.
|
|
5517
|
+
* @returns `granted` to add to the grant and `rejected` to record on the grant.
|
|
5518
|
+
*/ function resolveEffectiveSubset(missing, requestedSubset) {
|
|
5519
|
+
var alwaysGranted = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
|
|
5520
|
+
var missingSet = new Set(missing);
|
|
5521
|
+
var baseSelection;
|
|
5522
|
+
if (requestedSubset === undefined) {
|
|
5523
|
+
baseSelection = missing;
|
|
5524
|
+
} else {
|
|
5525
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5526
|
+
try {
|
|
5527
|
+
for(var _iterator = requestedSubset[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5528
|
+
var value = _step.value;
|
|
5529
|
+
if (!missingSet.has(value)) {
|
|
5530
|
+
throw new HttpException('Granted value "'.concat(value, '" is not in the requested set.'), HttpStatus.BAD_REQUEST);
|
|
5531
|
+
}
|
|
5532
|
+
}
|
|
5533
|
+
} catch (err) {
|
|
5534
|
+
_didIteratorError = true;
|
|
5535
|
+
_iteratorError = err;
|
|
5536
|
+
} finally{
|
|
5537
|
+
try {
|
|
5538
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5539
|
+
_iterator.return();
|
|
5540
|
+
}
|
|
5541
|
+
} finally{
|
|
5542
|
+
if (_didIteratorError) {
|
|
5543
|
+
throw _iteratorError;
|
|
5544
|
+
}
|
|
5545
|
+
}
|
|
5546
|
+
}
|
|
5547
|
+
baseSelection = requestedSubset;
|
|
5548
|
+
}
|
|
5549
|
+
var grantedSet = new Set(baseSelection);
|
|
5550
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
5551
|
+
try {
|
|
5552
|
+
for(var _iterator1 = alwaysGranted[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
5553
|
+
var value1 = _step1.value;
|
|
5554
|
+
if (missingSet.has(value1)) {
|
|
5555
|
+
grantedSet.add(value1);
|
|
5556
|
+
}
|
|
5557
|
+
}
|
|
5558
|
+
} catch (err) {
|
|
5559
|
+
_didIteratorError1 = true;
|
|
5560
|
+
_iteratorError1 = err;
|
|
5561
|
+
} finally{
|
|
5562
|
+
try {
|
|
5563
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
5564
|
+
_iterator1.return();
|
|
5565
|
+
}
|
|
5566
|
+
} finally{
|
|
5567
|
+
if (_didIteratorError1) {
|
|
5568
|
+
throw _iteratorError1;
|
|
5569
|
+
}
|
|
5570
|
+
}
|
|
5571
|
+
}
|
|
5572
|
+
var rejected = [];
|
|
5573
|
+
var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
|
|
5574
|
+
try {
|
|
5575
|
+
for(var _iterator2 = missing[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
5576
|
+
var value2 = _step2.value;
|
|
5577
|
+
if (!grantedSet.has(value2)) {
|
|
5578
|
+
rejected.push(value2);
|
|
5579
|
+
}
|
|
5580
|
+
}
|
|
5581
|
+
} catch (err) {
|
|
5582
|
+
_didIteratorError2 = true;
|
|
5583
|
+
_iteratorError2 = err;
|
|
5584
|
+
} finally{
|
|
5585
|
+
try {
|
|
5586
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
5587
|
+
_iterator2.return();
|
|
5588
|
+
}
|
|
5589
|
+
} finally{
|
|
5590
|
+
if (_didIteratorError2) {
|
|
5591
|
+
throw _iteratorError2;
|
|
5592
|
+
}
|
|
5593
|
+
}
|
|
5594
|
+
}
|
|
5595
|
+
return {
|
|
5596
|
+
granted: Array.from(grantedSet),
|
|
5597
|
+
rejected: rejected
|
|
5598
|
+
};
|
|
5599
|
+
}
|
|
5020
5600
|
|
|
5021
5601
|
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
5022
5602
|
try {
|
|
@@ -5687,6 +6267,8 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
5687
6267
|
appOAuthConsentUrlPart: DEFAULT_APP_OAUTH_CONSENT_PATH_PART,
|
|
5688
6268
|
appOAuthInteractionPath: DEFAULT_APP_OAUTH_INTERACTION_PATH,
|
|
5689
6269
|
tokenLifetimes: DEFAULT_OIDC_TOKEN_LIFETIMES,
|
|
6270
|
+
trustProxy: envService.isProduction,
|
|
6271
|
+
trustProxyInNonProduction: false,
|
|
5690
6272
|
jwksServiceConfig: {
|
|
5691
6273
|
encryptionSecret: encryptionSecret
|
|
5692
6274
|
},
|
|
@@ -5743,6 +6325,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
5743
6325
|
],
|
|
5744
6326
|
exports: [
|
|
5745
6327
|
OidcClientService,
|
|
6328
|
+
OidcService,
|
|
5746
6329
|
OidcModuleConfig,
|
|
5747
6330
|
OidcAuthMiddlewareConfig,
|
|
5748
6331
|
OidcServerFirestoreCollections
|
|
@@ -5759,6 +6342,9 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
5759
6342
|
var result = moduleConfig;
|
|
5760
6343
|
if (config) {
|
|
5761
6344
|
result = _object_spread({}, moduleConfig, config);
|
|
6345
|
+
if (config.trustProxyInNonProduction && !envService.isProduction) {
|
|
6346
|
+
result.trustProxy = true;
|
|
6347
|
+
}
|
|
5762
6348
|
}
|
|
5763
6349
|
return result;
|
|
5764
6350
|
}
|
|
@@ -5845,4 +6431,4 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
5845
6431
|
return fn;
|
|
5846
6432
|
}
|
|
5847
6433
|
|
|
5848
|
-
export { DEFAULT_APP_OAUTH_CONSENT_PATH_PART, DEFAULT_APP_OAUTH_INTERACTION_PATH, DEFAULT_APP_OAUTH_LOGIN_PATH_PART, 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, JwksFirestoreCollections, JwksKeyDocument, JwksService, JwksServiceConfig, JwksServiceStorageConfig, OIDC_ENCRYPTED_PAYLOAD_FIELDS, OIDC_JWKS_ENCRYPTION_SECRET_ENV_KEY, OidcAccountService, OidcAccountServiceDelegate, OidcAccountServiceUserContext, OidcAuth, OidcAuthBearerTokenMiddleware, OidcAuthMiddlewareConfig, OidcClientService, OidcEncryptionService, OidcInteractionController, OidcInteractionService, OidcModelServerActions, OidcModuleConfig, OidcProviderConfigService, OidcProviderController, OidcServerFirestoreCollections, OidcService, OidcWellKnownController, activeJwksKeysQuery, appOidcModelModuleMetadata, applyOidcAuthMiddleware, createAdapterFactory, createOidcClientFactory, deleteOidcClientFactory, getOidcScopesFromRequest, jwksKeyCollectionReference, jwksKeyConverter, jwksKeyFirestoreCollection, jwksKeyIdentity, jwksKeysWithStatusQuery, nonRetiredJwksKeysQuery, oidcCallModelScopePreAssert, oidcFirestoreCollectionsFactory, oidcModelServerActions, oidcModelServerActionsFactory, oidcModuleConfigFactory, oidcModuleMetadata, rotateOidcClientSecretFactory, rotatedJwksKeysQuery, updateOidcClientFactory };
|
|
6434
|
+
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_JWKS_ENCRYPTION_SECRET_ENV_KEY, OidcAccountService, OidcAccountServiceDelegate, OidcAccountServiceUserContext, OidcAuth, OidcAuthBearerTokenMiddleware, OidcAuthMiddlewareConfig, OidcClientService, OidcEncryptionService, OidcInteractionController, OidcInteractionService, OidcModelServerActions, OidcModuleConfig, OidcProviderConfigService, OidcProviderController, OidcServerFirestoreCollections, OidcService, OidcWellKnownController, activeJwksKeysQuery, appOidcModelModuleMetadata, applyOidcAuthMiddleware, createAdapterFactory, createOidcClientFactory, deleteOidcClientFactory, deleteOidcTokenFactory, getOidcScopesFromRequest, jwksKeyCollectionReference, jwksKeyConverter, jwksKeyFirestoreCollection, jwksKeyIdentity, jwksKeysWithStatusQuery, nonRetiredJwksKeysQuery, oidcCallModelScopePreAssert, oidcFirestoreCollectionsFactory, oidcModelServerActions, oidcModelServerActionsFactory, oidcModuleConfigFactory, oidcModuleMetadata, rotateOidcClientSecretFactory, rotatedJwksKeysQuery, updateOidcClientFactory };
|