@dereekb/firebase-server 13.2.2 → 13.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +7506 -1884
- package/index.esm.js +7505 -1890
- package/mailgun/index.cjs.js +333 -31
- package/mailgun/index.esm.js +333 -31
- package/mailgun/package.json +8 -8
- package/mailgun/src/lib/auth.mailgun.d.ts +22 -3
- package/model/index.cjs.js +11334 -3830
- package/model/index.esm.js +11338 -3834
- package/model/package.json +8 -8
- package/model/src/lib/mailgun/notification.send.service.mailgun.d.ts +27 -1
- package/model/src/lib/notification/notification.action.init.service.d.ts +93 -1
- package/model/src/lib/notification/notification.action.service.d.ts +151 -2
- package/model/src/lib/notification/notification.config.d.ts +19 -7
- package/model/src/lib/notification/notification.config.service.d.ts +44 -6
- package/model/src/lib/notification/notification.create.run.d.ts +33 -5
- package/model/src/lib/notification/notification.error.d.ts +63 -0
- package/model/src/lib/notification/notification.module.d.ts +11 -0
- package/model/src/lib/notification/notification.send.d.ts +8 -1
- package/model/src/lib/notification/notification.send.service.d.ts +7 -1
- package/model/src/lib/notification/notification.send.service.notificationsummary.d.ts +32 -2
- package/model/src/lib/notification/notification.send.service.text.d.ts +11 -3
- package/model/src/lib/notification/notification.task.service.d.ts +13 -1
- package/model/src/lib/notification/notification.task.service.handler.d.ts +27 -3
- package/model/src/lib/notification/notification.task.service.util.d.ts +16 -4
- package/model/src/lib/notification/notification.task.subtask.handler.d.ts +31 -1
- package/model/src/lib/notification/notification.util.d.ts +70 -0
- package/model/src/lib/storagefile/storagefile.action.init.service.d.ts +62 -1
- package/model/src/lib/storagefile/storagefile.action.server.d.ts +124 -2
- package/model/src/lib/storagefile/storagefile.error.d.ts +44 -0
- package/model/src/lib/storagefile/storagefile.module.d.ts +11 -0
- package/model/src/lib/storagefile/storagefile.task.service.handler.d.ts +4 -1
- package/model/src/lib/storagefile/storagefile.upload.service.d.ts +13 -1
- package/model/src/lib/storagefile/storagefile.upload.service.initializer.d.ts +43 -1
- package/model/src/lib/storagefile/storagefile.util.d.ts +8 -0
- package/oidc/index.cjs.default.js +1 -0
- package/oidc/index.cjs.js +5607 -0
- package/oidc/index.cjs.mjs +2 -0
- package/oidc/index.d.ts +1 -0
- package/oidc/index.esm.js +5560 -0
- package/oidc/package.json +26 -0
- package/oidc/src/index.d.ts +1 -0
- package/oidc/src/lib/controller/index.d.ts +3 -0
- package/oidc/src/lib/controller/oidc.interaction.controller.d.ts +54 -0
- package/oidc/src/lib/controller/oidc.provider.controller.d.ts +18 -0
- package/oidc/src/lib/controller/oidc.wellknown.controller.d.ts +36 -0
- package/oidc/src/lib/index.d.ts +6 -0
- package/oidc/src/lib/middleware/index.d.ts +3 -0
- package/oidc/src/lib/middleware/oauth-auth.decorator.d.ts +14 -0
- package/oidc/src/lib/middleware/oauth-auth.middleware.d.ts +21 -0
- package/oidc/src/lib/middleware/oauth-auth.module.d.ts +50 -0
- package/oidc/src/lib/model/index.d.ts +3 -0
- package/oidc/src/lib/model/jwks/index.d.ts +3 -0
- package/oidc/src/lib/model/jwks/jwks.d.ts +107 -0
- package/oidc/src/lib/model/jwks/jwks.id.d.ts +9 -0
- package/oidc/src/lib/model/jwks/jwks.query.d.ts +18 -0
- package/oidc/src/lib/model/model.d.ts +12 -0
- package/oidc/src/lib/model/oidc/index.d.ts +2 -0
- package/oidc/src/lib/model/oidc/oidcmodel.action.server.d.ts +62 -0
- package/oidc/src/lib/model/oidc/oidcmodel.module.d.ts +23 -0
- package/oidc/src/lib/oidc.config.d.ts +175 -0
- package/oidc/src/lib/oidc.module.d.ts +100 -0
- package/oidc/src/lib/service/index.d.ts +10 -0
- package/oidc/src/lib/service/oidc.account.d.ts +36 -0
- package/oidc/src/lib/service/oidc.account.service.d.ts +104 -0
- package/oidc/src/lib/service/oidc.adapter.service.d.ts +20 -0
- package/oidc/src/lib/service/oidc.auth.d.ts +26 -0
- package/oidc/src/lib/service/oidc.client.service.d.ts +57 -0
- package/oidc/src/lib/service/oidc.config.service.d.ts +100 -0
- package/oidc/src/lib/service/oidc.encryption.service.d.ts +53 -0
- package/oidc/src/lib/service/oidc.interaction.service.d.ts +44 -0
- package/oidc/src/lib/service/oidc.jwks.service.d.ts +105 -0
- package/oidc/src/lib/service/oidc.service.d.ts +55 -0
- package/package.json +15 -9
- package/src/lib/auth/auth.context.d.ts +22 -2
- package/src/lib/auth/auth.service.d.ts +5 -0
- package/src/lib/auth/auth.service.error.d.ts +2 -1
- package/src/lib/auth/auth.util.d.ts +15 -3
- package/src/lib/env/env.config.d.ts +42 -0
- package/src/lib/env/env.service.d.ts +17 -0
- package/src/lib/env/index.d.ts +1 -0
- package/src/lib/firestore/array.d.ts +11 -3
- package/src/lib/firestore/driver.accessor.batch.d.ts +27 -4
- package/src/lib/firestore/driver.accessor.d.ts +43 -0
- package/src/lib/firestore/driver.accessor.default.d.ts +20 -0
- package/src/lib/firestore/driver.accessor.transaction.d.ts +28 -4
- package/src/lib/firestore/driver.d.ts +14 -0
- package/src/lib/firestore/driver.query.d.ts +25 -0
- package/src/lib/firestore/increment.d.ts +13 -3
- package/src/lib/firestore/snapshot/index.d.ts +1 -1
- package/src/lib/firestore/snapshot/{snapshot.field.d.ts → snapshot.field.encrypt.d.ts} +13 -27
- package/src/lib/function/assert.d.ts +32 -16
- package/src/lib/function/context.d.ts +26 -0
- package/src/lib/function/error.auth.d.ts +15 -0
- package/src/lib/function/error.d.ts +68 -4
- package/src/lib/nest/app.d.ts +53 -9
- package/src/lib/nest/app.module.d.ts +90 -0
- package/src/lib/nest/auth/auth.module.d.ts +30 -4
- package/src/lib/nest/auth/auth.util.d.ts +38 -0
- package/src/lib/nest/controller/auth.context.server.d.ts +27 -0
- package/src/lib/nest/controller/index.d.ts +1 -0
- package/src/lib/nest/development/development.app.function.d.ts +45 -0
- package/src/lib/nest/development/development.assert.function.d.ts +19 -1
- package/src/lib/nest/development/development.function.d.ts +42 -3
- package/src/lib/nest/development/development.schedule.function.d.ts +29 -0
- package/src/lib/nest/development/development.schedule.function.error.d.ts +21 -0
- package/src/lib/nest/env/env.service.d.ts +9 -0
- package/src/lib/nest/env/env.util.d.ts +16 -0
- package/src/lib/nest/firebase/firebase.module.d.ts +13 -1
- package/src/lib/nest/firestore/firestore.module.d.ts +24 -8
- package/src/lib/nest/function/call.d.ts +75 -6
- package/src/lib/nest/function/context.d.ts +85 -2
- package/src/lib/nest/function/nest.d.ts +46 -0
- package/src/lib/nest/function/schedule.d.ts +49 -0
- package/src/lib/nest/function/v2/blocking.d.ts +92 -8
- package/src/lib/nest/function/v2/call.d.ts +38 -8
- package/src/lib/nest/function/v2/event.d.ts +67 -4
- package/src/lib/nest/function/v2/schedule.d.ts +36 -5
- package/src/lib/nest/index.d.ts +3 -0
- package/src/lib/nest/middleware/appcheck.d.ts +5 -0
- package/src/lib/nest/middleware/appcheck.middleware.d.ts +44 -14
- package/src/lib/nest/middleware/appcheck.module.d.ts +10 -1
- package/src/lib/nest/middleware/globalprefix.d.ts +31 -3
- package/src/lib/nest/middleware/index.d.ts +2 -1
- package/src/lib/nest/middleware/rawbody.middleware.d.ts +6 -0
- package/src/lib/nest/model/call.model.function.d.ts +69 -3
- package/src/lib/nest/model/create.model.function.d.ts +66 -0
- package/src/lib/nest/model/crud.assert.function.d.ts +27 -1
- package/src/lib/nest/model/delete.model.function.d.ts +55 -0
- package/src/lib/nest/model/permission.error.d.ts +15 -0
- package/src/lib/nest/model/read.model.function.d.ts +57 -0
- package/src/lib/nest/model/specifier.function.d.ts +58 -1
- package/src/lib/nest/model/update.model.function.d.ts +58 -0
- package/src/lib/nest/nest.provider.d.ts +24 -11
- package/src/lib/nest/nest.provider.server.d.ts +12 -0
- package/src/lib/nest/storage/storage.module.d.ts +30 -4
- package/src/lib/storage/driver.accessor.d.ts +33 -0
- package/src/lib/storage/driver.d.ts +14 -0
- package/src/lib/storage/storage.d.ts +11 -4
- package/src/lib/storage/storage.service.d.ts +10 -1
- package/src/lib/type.d.ts +7 -2
- package/test/index.cjs.js +4072 -757
- package/test/index.esm.js +4073 -761
- package/test/package.json +8 -8
- package/test/src/lib/firebase/firebase.admin.auth.d.ts +82 -1
- package/test/src/lib/firebase/firebase.admin.collection.d.ts +55 -3
- package/test/src/lib/firebase/firebase.admin.d.ts +64 -0
- package/test/src/lib/firebase/firebase.admin.function.d.ts +84 -0
- package/test/src/lib/firebase/firebase.admin.nest.d.ts +125 -17
- package/test/src/lib/firebase/firebase.admin.nest.function.callable.context.d.ts +44 -0
- package/test/src/lib/firebase/firebase.admin.nest.function.cloud.context.d.ts +41 -0
- package/test/src/lib/firebase/firebase.admin.nest.function.d.ts +98 -0
- package/test/src/lib/firebase/firebase.admin.test.server.d.ts +26 -0
- package/test/src/lib/firebase/firebase.d.ts +57 -2
- package/test/src/lib/firebase/firebase.function.d.ts +138 -0
- package/test/src/lib/firestore/firestore.admin.d.ts +6 -0
- package/test/src/lib/firestore/firestore.d.ts +30 -0
- package/test/src/lib/storage/storage.admin.d.ts +9 -3
- package/test/src/lib/storage/storage.d.ts +30 -0
- package/zoho/index.cjs.js +406 -73
- package/zoho/index.esm.js +406 -73
- package/zoho/package.json +8 -8
- package/zoho/src/lib/zoho.accounts.firebase.d.ts +13 -2
- package/zoho/src/lib/zoho.accounts.firebase.system.d.ts +29 -6
- package/index.cjs.js.map +0 -1
- package/index.esm.js.map +0 -1
- /package/src/lib/nest/middleware/{webhook.d.ts → webhook.module.d.ts} +0 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import type { Configuration } from 'oidc-provider';
|
|
2
|
+
import { type WebsitePath, type SlashPath } from '@dereekb/util';
|
|
3
|
+
import { type OidcScope, type OidcTokenEndpointAuthMethod } from '@dereekb/firebase';
|
|
4
|
+
import { type JwksServiceConfig } from './service/oidc.jwks.service';
|
|
5
|
+
import { type JwksKeyConverterConfig } from './model';
|
|
6
|
+
/**
|
|
7
|
+
* Custom error rendering function for the oidc-provider.
|
|
8
|
+
*
|
|
9
|
+
* Matches the `renderError` option from the oidc-provider `Configuration` type.
|
|
10
|
+
*/
|
|
11
|
+
export type OidcRenderErrorFunction = Configuration['renderError'];
|
|
12
|
+
/**
|
|
13
|
+
* OIDC provider-level configuration for scopes, grant types, response types,
|
|
14
|
+
* and claim mappings. These values drive both the oidc-provider instance and the
|
|
15
|
+
* discovery metadata endpoint.
|
|
16
|
+
*
|
|
17
|
+
* Generic on `S` so that claim keys are validated against the app's scope union.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* type MyScopes = 'openid' | 'profile' | 'email';
|
|
22
|
+
*
|
|
23
|
+
* const providerConfig: OidcProviderConfig<MyScopes> = {
|
|
24
|
+
* claims: {
|
|
25
|
+
* openid: ['sub'],
|
|
26
|
+
* profile: ['name', 'picture'],
|
|
27
|
+
* email: ['email', 'email_verified']
|
|
28
|
+
* },
|
|
29
|
+
* responseTypes: ['code'],
|
|
30
|
+
* grantTypes: ['authorization_code', 'refresh_token']
|
|
31
|
+
* };
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export interface OidcProviderConfig<S extends OidcScope = OidcScope> {
|
|
35
|
+
/**
|
|
36
|
+
* Maps OIDC scope names to the claims they grant access to.
|
|
37
|
+
*
|
|
38
|
+
* The keys also determine `scopes_supported` in the discovery document.
|
|
39
|
+
*/
|
|
40
|
+
readonly claims: Record<S, string[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Supported OAuth 2.0 response types (e.g., `['code']`).
|
|
43
|
+
*/
|
|
44
|
+
readonly responseTypes: string[];
|
|
45
|
+
/**
|
|
46
|
+
* Supported OAuth 2.0 grant types (e.g., `['authorization_code', 'refresh_token']`).
|
|
47
|
+
*/
|
|
48
|
+
readonly grantTypes: string[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Configures the lifetime (in seconds) for each token type issued by the OIDC provider.
|
|
52
|
+
*/
|
|
53
|
+
export interface OidcTokenLifetimes {
|
|
54
|
+
/**
|
|
55
|
+
* Access token lifetime in seconds. Defaults to 900 (15 min).
|
|
56
|
+
*/
|
|
57
|
+
readonly accessToken: number;
|
|
58
|
+
/**
|
|
59
|
+
* ID token lifetime in seconds. Defaults to 3600 (1 hour).
|
|
60
|
+
*/
|
|
61
|
+
readonly idToken: number;
|
|
62
|
+
/**
|
|
63
|
+
* Refresh token lifetime in seconds (absolute). Defaults to 2592000 (30 days).
|
|
64
|
+
*/
|
|
65
|
+
readonly refreshToken: number;
|
|
66
|
+
/**
|
|
67
|
+
* Authorization code lifetime in seconds. Defaults to 60.
|
|
68
|
+
*/
|
|
69
|
+
readonly authorizationCode: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Default token lifetimes: 15 min access tokens, 30-day refresh tokens, 60 s auth codes.
|
|
73
|
+
*/
|
|
74
|
+
export declare const DEFAULT_OIDC_TOKEN_LIFETIMES: OidcTokenLifetimes;
|
|
75
|
+
/**
|
|
76
|
+
* Configuration for the OIDC module.
|
|
77
|
+
*
|
|
78
|
+
* Used as an abstract class so it can serve as both a type and a NestJS DI token.
|
|
79
|
+
*/
|
|
80
|
+
export declare abstract class OidcModuleConfig {
|
|
81
|
+
/**
|
|
82
|
+
* The OIDC issuer URL (e.g., 'https://accounts.example.com').
|
|
83
|
+
* Must be the canonical URL where the OIDC provider is accessible.
|
|
84
|
+
*/
|
|
85
|
+
readonly issuer: string;
|
|
86
|
+
/**
|
|
87
|
+
* The path prefix used for OIDC interaction endpoints (login/consent).
|
|
88
|
+
*
|
|
89
|
+
* Appended to the base appUrl this is the base frontend interaction path.
|
|
90
|
+
*
|
|
91
|
+
* Defaults to '/oauth'.
|
|
92
|
+
*/
|
|
93
|
+
readonly appOAuthInteractionPath: WebsitePath;
|
|
94
|
+
/**
|
|
95
|
+
* Frontend URL for the login interaction page.
|
|
96
|
+
* The interaction uid will be appended as a query parameter.
|
|
97
|
+
*
|
|
98
|
+
* Defaults to `<appOAuthInteractionPath>/login`.
|
|
99
|
+
*/
|
|
100
|
+
readonly appOAuthLoginUrlPart: WebsitePath;
|
|
101
|
+
/**
|
|
102
|
+
* Frontend URL for the consent interaction page.
|
|
103
|
+
*
|
|
104
|
+
* Defaults to `<appOAuthInteractionPath>/consent`.
|
|
105
|
+
*/
|
|
106
|
+
readonly appOAuthConsentUrlPart: WebsitePath;
|
|
107
|
+
/**
|
|
108
|
+
* Token lifetime configuration.
|
|
109
|
+
*/
|
|
110
|
+
readonly tokenLifetimes: OidcTokenLifetimes;
|
|
111
|
+
/**
|
|
112
|
+
* JWKS service configuration (encryption secret, rotated key max age).
|
|
113
|
+
*/
|
|
114
|
+
readonly jwksServiceConfig: JwksServiceConfig;
|
|
115
|
+
/**
|
|
116
|
+
* JWKS key converter configuration (encryption secret for Firestore field encryption).
|
|
117
|
+
*/
|
|
118
|
+
readonly jwksKeyConverterConfig: JwksKeyConverterConfig;
|
|
119
|
+
/**
|
|
120
|
+
* Custom error rendering function for the oidc-provider.
|
|
121
|
+
*
|
|
122
|
+
* When not provided, defaults to a JSON error response with `error` and `error_description` fields.
|
|
123
|
+
* Set this to customize how OIDC errors are presented (e.g. redirect to an error page).
|
|
124
|
+
*
|
|
125
|
+
* The function signature matches oidc-provider's `renderError` configuration option.
|
|
126
|
+
*/
|
|
127
|
+
readonly renderError?: OidcRenderErrorFunction;
|
|
128
|
+
/**
|
|
129
|
+
* Whether to suppress the oidc-provider "already parsed request body" warning.
|
|
130
|
+
*
|
|
131
|
+
* Enable this when running behind a platform (e.g. Firebase Cloud Functions) that
|
|
132
|
+
* parses request bodies before they reach the OIDC provider. The provider handles
|
|
133
|
+
* this correctly by falling back to `req.body`, but emits a one-time warning.
|
|
134
|
+
*
|
|
135
|
+
* Defaults to `false`.
|
|
136
|
+
*/
|
|
137
|
+
readonly suppressBodyParserWarning?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Path prefixes that require OAuth bearer token verification.
|
|
140
|
+
*
|
|
141
|
+
* Only requests matching one of these prefixes will be checked by the
|
|
142
|
+
* {@link OidcAuthBearerTokenMiddleware}. When non-empty, the middleware
|
|
143
|
+
* module is automatically registered by {@link oidcModuleMetadata}.
|
|
144
|
+
*
|
|
145
|
+
* Paths under the global API route prefix should not be included
|
|
146
|
+
* since those are typically protected by AppCheck.
|
|
147
|
+
*/
|
|
148
|
+
readonly protectedPaths?: SlashPath[];
|
|
149
|
+
/**
|
|
150
|
+
* Supported token endpoint authentication methods.
|
|
151
|
+
*
|
|
152
|
+
* Overrides the default methods (`client_secret_post`, `client_secret_basic`)
|
|
153
|
+
* in the discovery metadata document.
|
|
154
|
+
*
|
|
155
|
+
* @see DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS
|
|
156
|
+
*/
|
|
157
|
+
readonly tokenEndpointAuthMethods?: OidcTokenEndpointAuthMethod[];
|
|
158
|
+
/**
|
|
159
|
+
* Whether to enable the OIDC dynamic client registration endpoint (`/reg`).
|
|
160
|
+
*
|
|
161
|
+
* When enabled, clients can self-register via the registration endpoint
|
|
162
|
+
* and manage their registrations via the registration management feature.
|
|
163
|
+
*
|
|
164
|
+
* Defaults to `false`.
|
|
165
|
+
*/
|
|
166
|
+
readonly registrationEnabled?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Validates that all required fields are present on the config.
|
|
169
|
+
*
|
|
170
|
+
* Called by {@link oidcModuleConfigFactory} after building the config from environment variables.
|
|
171
|
+
*
|
|
172
|
+
* @throws {Error} When any required field (`issuer`, `appInteractionPath`, `appLoginUrlPart`, `appConsentUrlPart`, `jwksServiceConfig`, `jwksKeyConverterConfig`) is missing.
|
|
173
|
+
*/
|
|
174
|
+
static assertValidConfig(config: OidcModuleConfig): void;
|
|
175
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type ModuleMetadata } from '@nestjs/common';
|
|
2
|
+
import { ConfigService } from '@nestjs/config';
|
|
3
|
+
import { OidcModuleConfig } from './oidc.config';
|
|
4
|
+
import { type FirestoreContext } from '@dereekb/firebase';
|
|
5
|
+
import { FirebaseServerEnvService } from '@dereekb/firebase-server';
|
|
6
|
+
import { OidcServerFirestoreCollections } from './model/model';
|
|
7
|
+
/**
|
|
8
|
+
* Environment variable name for the JWKS encryption secret (hex-encoded AES-256 key).
|
|
9
|
+
*
|
|
10
|
+
* Used for encrypting private keys at rest in Firestore.
|
|
11
|
+
*/
|
|
12
|
+
export declare const OIDC_JWKS_ENCRYPTION_SECRET_ENV_KEY = "OIDC_JWKS_ENCRYPTION_SECRET";
|
|
13
|
+
/**
|
|
14
|
+
* Default path appended to `appUrl` to form the OIDC issuer URL.
|
|
15
|
+
*
|
|
16
|
+
* The issuer is the canonical identity of the OIDC provider (e.g., `https://example.com/oidc`).
|
|
17
|
+
* It appears in the `.well-known/openid-configuration` discovery document and is passed
|
|
18
|
+
* to `new Provider(issuer, ...)`. All provider endpoints (auth, token, userinfo, etc.)
|
|
19
|
+
* are served under this path via the {@link OidcProviderController}.
|
|
20
|
+
*
|
|
21
|
+
* This path is also used as the proxy target on the frontend (e.g., `/oidc/**` → backend),
|
|
22
|
+
* so frontend interaction routes must NOT live under this prefix.
|
|
23
|
+
*/
|
|
24
|
+
export declare const DEFAULT_OIDC_ISSUER_PATH = "/oidc";
|
|
25
|
+
/**
|
|
26
|
+
* Default frontend base path for OAuth interaction pages (login, consent).
|
|
27
|
+
*
|
|
28
|
+
* This is the path prefix on the **frontend app** where the OAuth interaction UI lives.
|
|
29
|
+
* The backend `OidcInteractionController` GET handler redirects the browser here after
|
|
30
|
+
* reading the oidc-provider interaction session.
|
|
31
|
+
*
|
|
32
|
+
* Uses `/oauth/interaction` instead of `/oidc/...` to avoid colliding with the
|
|
33
|
+
* `/oidc/**` proxy rule that forwards requests to the backend OIDC provider.
|
|
34
|
+
*
|
|
35
|
+
* Apps typically override this (e.g., `/demo/oauth`) via {@link ProvideAppOidcModuleMetadataConfig.config}.
|
|
36
|
+
*/
|
|
37
|
+
export declare const DEFAULT_APP_OAUTH_INTERACTION_PATH = "/oauth/interaction";
|
|
38
|
+
/**
|
|
39
|
+
* Default path part appended to `appOAuthInteractionPath` for the frontend login page.
|
|
40
|
+
*
|
|
41
|
+
* Combined with `appOAuthInteractionPath` to form the full login redirect URL
|
|
42
|
+
* (e.g., `/oauth/interaction/login?uid=...`).
|
|
43
|
+
*/
|
|
44
|
+
export declare const DEFAULT_APP_OAUTH_LOGIN_PATH_PART = "/login";
|
|
45
|
+
/**
|
|
46
|
+
* Default path part appended to `appOAuthInteractionPath` for the frontend consent page.
|
|
47
|
+
*
|
|
48
|
+
* Combined with `appOAuthInteractionPath` to form the full consent redirect URL
|
|
49
|
+
* (e.g., `/oauth/interaction/consent?uid=...`).
|
|
50
|
+
*/
|
|
51
|
+
export declare const DEFAULT_APP_OAUTH_CONSENT_PATH_PART = "/consent";
|
|
52
|
+
/**
|
|
53
|
+
* Route patterns for OIDC controllers that should be excluded from a global API route prefix.
|
|
54
|
+
*
|
|
55
|
+
* Typically fox dbx-components we set all the routes in the NestJS app to have a global prefix (e.g., '/api').
|
|
56
|
+
* For `firebase-server/oidc` we exclude the routes here so that the global prefix doesn't affect the OIDC routes.
|
|
57
|
+
*
|
|
58
|
+
* Use with `globalApiRoutePrefix.exclude` in {@link NestServerInstanceConfig}.
|
|
59
|
+
*/
|
|
60
|
+
export declare const FIREBASE_SERVER_OIDC_ROUTES_FOR_GLOBAL_ROUTE_EXCLUDE: string[];
|
|
61
|
+
/**
|
|
62
|
+
* Factory that builds {@link OidcModuleConfig} from environment variables and the app's {@link FirebaseServerEnvService}.
|
|
63
|
+
*
|
|
64
|
+
* Derives the issuer URL from `appUrl` + the optional `OIDC_ISSUER_PATH` env var (defaults to `/oidc`).
|
|
65
|
+
* Reads the JWKS encryption secret from `OIDC_JWKS_ENCRYPTION_SECRET`; in test environments,
|
|
66
|
+
* a deterministic fallback is used.
|
|
67
|
+
*
|
|
68
|
+
* @throws {Error} When `appUrl` is missing, lacks an HTTP prefix, or the encryption secret is invalid.
|
|
69
|
+
*/
|
|
70
|
+
export declare function oidcModuleConfigFactory(configService: ConfigService, envService: FirebaseServerEnvService): OidcModuleConfig;
|
|
71
|
+
/**
|
|
72
|
+
* Factory that creates {@link OidcServerFirestoreCollections} using the provided Firestore context
|
|
73
|
+
* and JWKS encryption config from {@link OidcModuleConfig}.
|
|
74
|
+
*/
|
|
75
|
+
export declare function oidcFirestoreCollectionsFactory(firestoreContext: FirestoreContext, oidcModuleConfig: OidcModuleConfig): OidcServerFirestoreCollections;
|
|
76
|
+
export interface ProvideAppOidcModuleMetadataConfig extends Pick<ModuleMetadata, 'imports' | 'exports' | 'providers'> {
|
|
77
|
+
/**
|
|
78
|
+
* Module that exports the required dependencies for this module.
|
|
79
|
+
* When provided, this module is automatically included in the generated `imports` array.
|
|
80
|
+
*/
|
|
81
|
+
readonly dependencyModule: Required<ModuleMetadata>['imports']['0'];
|
|
82
|
+
/**
|
|
83
|
+
* Optional overrides to merge into the {@link OidcModuleConfig} produced by the factory.
|
|
84
|
+
*/
|
|
85
|
+
readonly config?: Partial<Pick<OidcModuleConfig, 'suppressBodyParserWarning' | 'renderError' | 'protectedPaths' | 'appOAuthInteractionPath' | 'appOAuthLoginUrlPart' | 'appOAuthConsentUrlPart' | 'tokenEndpointAuthMethods' | 'registrationEnabled'>>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Convenience function used to generate ModuleMetadata for an app's OidcModule.
|
|
89
|
+
*
|
|
90
|
+
* The OidcModule requires the following dependencies in order to initialize properly:
|
|
91
|
+
* - FIREBASE_FIRESTORE_CONTEXT_TOKEN
|
|
92
|
+
* - OidcAccountService (provided via factory)
|
|
93
|
+
*
|
|
94
|
+
* Additionally, the following may be optionally provided:
|
|
95
|
+
* - JwksServiceStorageConfig
|
|
96
|
+
*
|
|
97
|
+
* @param metadataConfig
|
|
98
|
+
* @returns
|
|
99
|
+
*/
|
|
100
|
+
export declare function oidcModuleMetadata(metadataConfig: ProvideAppOidcModuleMetadataConfig): ModuleMetadata;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './oidc.account';
|
|
2
|
+
export * from './oidc.account.service';
|
|
3
|
+
export * from './oidc.auth';
|
|
4
|
+
export * from './oidc.adapter.service';
|
|
5
|
+
export * from './oidc.service';
|
|
6
|
+
export * from './oidc.encryption.service';
|
|
7
|
+
export * from './oidc.jwks.service';
|
|
8
|
+
export * from './oidc.config.service';
|
|
9
|
+
export * from './oidc.client.service';
|
|
10
|
+
export * from './oidc.interaction.service';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account representation returned by the `findAccount` callback in oidc-provider.
|
|
3
|
+
*
|
|
4
|
+
* The provider calls {@link OidcAccount.claims} during token issuance and userinfo
|
|
5
|
+
* responses to resolve the claims for the authenticated subject.
|
|
6
|
+
*
|
|
7
|
+
* @see {@link FindAccountFunction}
|
|
8
|
+
* @see {@link OidcAccountServiceUserContext.findAccount}
|
|
9
|
+
*/
|
|
10
|
+
export interface OidcAccount {
|
|
11
|
+
readonly accountId: string;
|
|
12
|
+
claims(use: string, scope: string, claims?: Record<string, unknown>, rejected?: string[]): Promise<OidcAccountClaims>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Claims returned by the OIDC userinfo and ID token endpoints.
|
|
16
|
+
*
|
|
17
|
+
* Standard OIDC claims (`sub`, `email`, `name`, etc.) plus arbitrary custom claims
|
|
18
|
+
* via the index signature.
|
|
19
|
+
*/
|
|
20
|
+
export interface OidcAccountClaims {
|
|
21
|
+
sub: string;
|
|
22
|
+
email?: string;
|
|
23
|
+
email_verified?: boolean;
|
|
24
|
+
name?: string;
|
|
25
|
+
picture?: string;
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Signature of the `findAccount` callback passed to the oidc-provider `Configuration`.
|
|
30
|
+
*
|
|
31
|
+
* The provider calls this during token and userinfo requests to resolve the
|
|
32
|
+
* {@link OidcAccount} for a given subject identifier.
|
|
33
|
+
*
|
|
34
|
+
* @see {@link OidcService}
|
|
35
|
+
*/
|
|
36
|
+
export type FindAccountFunction = (ctx: unknown, id: string, token?: unknown) => Promise<OidcAccount | undefined>;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { type FirebaseServerAuthService, type FirebaseServerAuthUserContext } from '@dereekb/firebase-server';
|
|
2
|
+
import type { OidcAccount, OidcAccountClaims } from './oidc.account';
|
|
3
|
+
import type { OidcProviderConfig } from '../oidc.config';
|
|
4
|
+
import { type OidcScope } from '@dereekb/firebase';
|
|
5
|
+
/**
|
|
6
|
+
* Delegate interface that allows customizing how OIDC claims are built from a user context.
|
|
7
|
+
*
|
|
8
|
+
* Generic on `S` to type-check scope names at compile time, and on `U` to allow
|
|
9
|
+
* custom Firebase Auth user context types.
|
|
10
|
+
*
|
|
11
|
+
* The delegate also carries the {@link OidcProviderConfig} so that provider-level
|
|
12
|
+
* settings (claims mapping, response types, grant types) are defined alongside
|
|
13
|
+
* the claim-building logic they correspond to.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* type MyScopes = 'openid' | 'profile' | 'email';
|
|
18
|
+
*
|
|
19
|
+
* const delegate: OidcAccountServiceDelegate<MyScopes> = {
|
|
20
|
+
* providerConfig: {
|
|
21
|
+
* claims: {
|
|
22
|
+
* openid: ['sub'],
|
|
23
|
+
* profile: ['name', 'picture'],
|
|
24
|
+
* email: ['email', 'email_verified']
|
|
25
|
+
* },
|
|
26
|
+
* responseTypes: ['code'],
|
|
27
|
+
* grantTypes: ['authorization_code', 'refresh_token']
|
|
28
|
+
* },
|
|
29
|
+
* async buildClaimsForUser(userContext, scopes) {
|
|
30
|
+
* const user = await userContext.loadRecord();
|
|
31
|
+
* const claims: OidcAccountClaims = { sub: user.uid };
|
|
32
|
+
*
|
|
33
|
+
* if (scopes.has('profile')) {
|
|
34
|
+
* claims.name = user.displayName;
|
|
35
|
+
* }
|
|
36
|
+
*
|
|
37
|
+
* if (scopes.has('email')) {
|
|
38
|
+
* claims.email = user.email;
|
|
39
|
+
* claims.email_verified = user.emailVerified ?? false;
|
|
40
|
+
* }
|
|
41
|
+
*
|
|
42
|
+
* return claims;
|
|
43
|
+
* }
|
|
44
|
+
* };
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare abstract class OidcAccountServiceDelegate<S extends OidcScope = OidcScope, U extends FirebaseServerAuthUserContext = FirebaseServerAuthUserContext> {
|
|
48
|
+
/**
|
|
49
|
+
* Provider-level OIDC configuration (scopes/claims mapping, response types, grant types).
|
|
50
|
+
*
|
|
51
|
+
* The keys of `claims` define the supported scopes and must align with the
|
|
52
|
+
* scope checks performed in {@link buildClaimsForUser}.
|
|
53
|
+
*/
|
|
54
|
+
abstract readonly providerConfig: OidcProviderConfig<S>;
|
|
55
|
+
/**
|
|
56
|
+
* Builds claims for the given user context based on the requested scopes.
|
|
57
|
+
*
|
|
58
|
+
* @param userContext - The Firebase Auth user context.
|
|
59
|
+
* @param scopes - The set of requested OIDC scopes, typed to the `S` union.
|
|
60
|
+
* @returns The claims to return for this user.
|
|
61
|
+
*/
|
|
62
|
+
abstract buildClaimsForUser(userContext: U, scopes: Set<S>): Promise<OidcAccountClaims> | OidcAccountClaims;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Per-user context for OIDC account operations.
|
|
66
|
+
*
|
|
67
|
+
* Created by {@link OidcAccountService.userContext} for a specific user ID.
|
|
68
|
+
*/
|
|
69
|
+
export declare class OidcAccountServiceUserContext<S extends OidcScope = OidcScope, U extends FirebaseServerAuthUserContext = FirebaseServerAuthUserContext> {
|
|
70
|
+
private readonly _service;
|
|
71
|
+
private readonly _uid;
|
|
72
|
+
readonly authUserContext: U;
|
|
73
|
+
constructor(_service: OidcAccountService<S, U>, _uid: string);
|
|
74
|
+
get uid(): string;
|
|
75
|
+
get service(): OidcAccountService<S, U>;
|
|
76
|
+
/**
|
|
77
|
+
* Finds this user's OIDC account representation.
|
|
78
|
+
*
|
|
79
|
+
* Returns an {@link OidcAccount} compatible with oidc-provider's `findAccount` interface,
|
|
80
|
+
* or `undefined` if the user does not exist in Firebase Auth.
|
|
81
|
+
*/
|
|
82
|
+
findAccount(): Promise<OidcAccount | undefined>;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Service that provides OIDC account lookup backed by Firebase Auth.
|
|
86
|
+
*
|
|
87
|
+
* Uses an {@link OidcAccountServiceDelegate} to customize claim building
|
|
88
|
+
* and to carry the provider-level OIDC configuration.
|
|
89
|
+
*
|
|
90
|
+
* Register it as a provider using the `OidcAccountService` class as the injection token.
|
|
91
|
+
*/
|
|
92
|
+
export declare class OidcAccountService<S extends OidcScope = OidcScope, U extends FirebaseServerAuthUserContext = FirebaseServerAuthUserContext> {
|
|
93
|
+
readonly authService: FirebaseServerAuthService<U>;
|
|
94
|
+
readonly delegate: OidcAccountServiceDelegate<S, U>;
|
|
95
|
+
constructor(authService: FirebaseServerAuthService<U>, delegate: OidcAccountServiceDelegate<S, U>);
|
|
96
|
+
/**
|
|
97
|
+
* The provider config from the delegate.
|
|
98
|
+
*/
|
|
99
|
+
get providerConfig(): OidcProviderConfig<S>;
|
|
100
|
+
/**
|
|
101
|
+
* Creates a user context for the given user ID.
|
|
102
|
+
*/
|
|
103
|
+
userContext(uid: string): OidcAccountServiceUserContext<S, U>;
|
|
104
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AdapterConstructor } from 'oidc-provider';
|
|
2
|
+
import { type OidcServerFirestoreCollections } from '../model';
|
|
3
|
+
import { type OidcEncryptionService } from './oidc.encryption.service';
|
|
4
|
+
/**
|
|
5
|
+
* Creates an oidc-provider adapter constructor backed by Firestore via {@link OidcServerFirestoreCollections}.
|
|
6
|
+
*
|
|
7
|
+
* All model types are stored in a single collection, discriminated by the `type` field.
|
|
8
|
+
* Sensitive payload fields (`client_secret`, `registration_access_token`) are selectively
|
|
9
|
+
* encrypted via the {@link OidcEncryptionService}.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const adapter = createAdapterFactory(collections, encryptionService);
|
|
14
|
+
* new Provider('issuer', { adapter });
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param collections - Firestore collection access for adapter entries.
|
|
18
|
+
* @param encryptionService - Encryption service for sensitive payload fields.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createAdapterFactory(collections: OidcServerFirestoreCollections, encryptionService: OidcEncryptionService): AdapterConstructor;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type OidcEntryClientId } from '@dereekb/firebase';
|
|
2
|
+
import { type FirebaseServerAuthData, type FirebaseServerAuthenticatedRequest } from '@dereekb/firebase-server';
|
|
3
|
+
/**
|
|
4
|
+
* Auth data attached to the request after successful OIDC bearer token verification.
|
|
5
|
+
*
|
|
6
|
+
* Extends {@link FirebaseServerAuthData} so it is compatible with the server auth pipeline.
|
|
7
|
+
* The `accessToken` field carries OIDC-specific claims from the verified access token.
|
|
8
|
+
*/
|
|
9
|
+
export interface OidcAuthData extends FirebaseServerAuthData {
|
|
10
|
+
/**
|
|
11
|
+
* Claims from the verified OIDC access token.
|
|
12
|
+
*/
|
|
13
|
+
readonly oidcValidatedToken: {
|
|
14
|
+
readonly sub: string;
|
|
15
|
+
readonly scope?: string;
|
|
16
|
+
readonly client_id?: OidcEntryClientId;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Extends {@link FirebaseServerAuthenticatedRequest} with OIDC auth data.
|
|
22
|
+
*
|
|
23
|
+
* The `auth` field is populated by {@link OidcAuthBearerTokenMiddleware} after
|
|
24
|
+
* successful bearer token verification.
|
|
25
|
+
*/
|
|
26
|
+
export type OidcAuthenticatedRequest = FirebaseServerAuthenticatedRequest<OidcAuthData>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type CreateOidcClientParams, type CreateOidcClientResult, type UpdateOidcClientParams, type RotateOidcClientSecretResult, type OidcEntryClientId } from '@dereekb/firebase';
|
|
2
|
+
import type { ClientMetadata } from 'oidc-provider';
|
|
3
|
+
import { type OidcService } from './oidc.service';
|
|
4
|
+
/**
|
|
5
|
+
* Service for managing OIDC client registrations through the oidc-provider.
|
|
6
|
+
*
|
|
7
|
+
* Mirrors the oidc-provider `registration.js` flow to ensure all provider
|
|
8
|
+
* validation and lifecycle hooks run.
|
|
9
|
+
*/
|
|
10
|
+
export declare class OidcClientService {
|
|
11
|
+
private readonly oidcService;
|
|
12
|
+
constructor(oidcService: OidcService);
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new OIDC client through the oidc-provider.
|
|
15
|
+
*
|
|
16
|
+
* Generates `client_id` and `client_secret` using the same defaults as oidc-provider's
|
|
17
|
+
* registration flow, validates via `Client.validate`, and persists through the adapter.
|
|
18
|
+
*
|
|
19
|
+
* @param params - Client registration parameters.
|
|
20
|
+
* @param validatedMetadata - Optional pre-validated metadata to merge into the client properties.
|
|
21
|
+
* Use this for server-side fields (e.g., inline `jwks`) that have already been validated
|
|
22
|
+
* and should not be exposed through the API params.
|
|
23
|
+
* @returns The generated client ID and secret (plaintext, returned only once).
|
|
24
|
+
*/
|
|
25
|
+
createClient(params: CreateOidcClientParams, validatedMetadata?: Partial<Pick<ClientMetadata, 'jwks'>>): Promise<CreateOidcClientResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Updates an existing OIDC client through the oidc-provider.
|
|
28
|
+
*
|
|
29
|
+
* Loads the existing client payload via the adapter, merges the updated fields,
|
|
30
|
+
* re-validates through `provider.Client`, and persists.
|
|
31
|
+
*
|
|
32
|
+
* `token_endpoint_auth_method` is immutable and cannot be changed.
|
|
33
|
+
*
|
|
34
|
+
* @param clientId - The client's document/adapter entry ID.
|
|
35
|
+
* @param params - The fields to update.
|
|
36
|
+
* @throws When the client is not found.
|
|
37
|
+
*/
|
|
38
|
+
updateClient(clientId: OidcEntryClientId, params: Omit<UpdateOidcClientParams, 'key'>): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Rotates the client secret for an existing OIDC client.
|
|
41
|
+
*
|
|
42
|
+
* Generates a new `client_secret`, re-validates via `Client.validate()`, and persists.
|
|
43
|
+
* The new secret is returned in plaintext — this is the only time it is available.
|
|
44
|
+
*
|
|
45
|
+
* @param clientId - The client's document/adapter entry ID.
|
|
46
|
+
* @returns The client ID and new secret (plaintext, returned only once).
|
|
47
|
+
* @throws When the client is not found.
|
|
48
|
+
*/
|
|
49
|
+
rotateClientSecret(clientId: OidcEntryClientId): Promise<RotateOidcClientSecretResult>;
|
|
50
|
+
/**
|
|
51
|
+
* Deletes an OIDC client through the oidc-provider adapter.
|
|
52
|
+
*
|
|
53
|
+
* @param clientId - The client's document/adapter entry ID.
|
|
54
|
+
* @throws When the client is not found.
|
|
55
|
+
*/
|
|
56
|
+
deleteClient(clientId: OidcEntryClientId): Promise<void>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { OidcModuleConfig, type OidcProviderConfig } from '../oidc.config';
|
|
2
|
+
import { OidcAccountService } from './oidc.account.service';
|
|
3
|
+
import { type WebsiteUrl } from '@dereekb/util';
|
|
4
|
+
import { type OidcScope, type OidcTokenEndpointAuthMethod } from '@dereekb/firebase';
|
|
5
|
+
import { FirebaseServerEnvService } from '@dereekb/firebase-server';
|
|
6
|
+
/**
|
|
7
|
+
* Default oidc-provider route paths.
|
|
8
|
+
*
|
|
9
|
+
* These match the oidc-provider defaults and are used to build
|
|
10
|
+
* both the provider configuration and the discovery document.
|
|
11
|
+
*
|
|
12
|
+
* @see https://github.com/panva/node-oidc-provider/blob/main/docs/README.md
|
|
13
|
+
*/
|
|
14
|
+
export declare const DEFAULT_OIDC_ROUTES: {
|
|
15
|
+
readonly authorization: "/auth";
|
|
16
|
+
readonly token: "/token";
|
|
17
|
+
readonly userinfo: "/me";
|
|
18
|
+
readonly jwks: "/jwks";
|
|
19
|
+
readonly registration: "/reg";
|
|
20
|
+
readonly end_session: "/session/end";
|
|
21
|
+
readonly code_verification: "/device";
|
|
22
|
+
readonly device_authorization: "/device/auth";
|
|
23
|
+
readonly introspection: "/token/introspection";
|
|
24
|
+
readonly revocation: "/token/revocation";
|
|
25
|
+
readonly pushed_authorization_request: "/request";
|
|
26
|
+
};
|
|
27
|
+
export type OidcRoutes = typeof DEFAULT_OIDC_ROUTES;
|
|
28
|
+
export declare const DEFAULT_OIDC_SUBJECT_TYPES: readonly string[];
|
|
29
|
+
export declare const DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS: readonly OidcTokenEndpointAuthMethod[];
|
|
30
|
+
export declare const DEFAULT_OIDC_ID_TOKEN_SIGNING_ALG_VALUES: readonly string[];
|
|
31
|
+
export declare const DEFAULT_OIDC_CODE_CHALLENGE_METHODS: readonly string[];
|
|
32
|
+
/**
|
|
33
|
+
* OpenID Connect Discovery metadata (RFC 8414 / OpenID Connect Discovery 1.0).
|
|
34
|
+
*/
|
|
35
|
+
export interface OidcDiscoveryMetadata {
|
|
36
|
+
readonly issuer: WebsiteUrl;
|
|
37
|
+
readonly authorization_endpoint: WebsiteUrl;
|
|
38
|
+
readonly token_endpoint: WebsiteUrl;
|
|
39
|
+
readonly userinfo_endpoint: WebsiteUrl;
|
|
40
|
+
readonly jwks_uri: WebsiteUrl;
|
|
41
|
+
readonly registration_endpoint?: WebsiteUrl;
|
|
42
|
+
readonly scopes_supported: OidcScope[];
|
|
43
|
+
readonly response_types_supported: string[];
|
|
44
|
+
readonly response_modes_supported: string[];
|
|
45
|
+
readonly grant_types_supported: string[];
|
|
46
|
+
readonly subject_types_supported: string[];
|
|
47
|
+
readonly id_token_signing_alg_values_supported: string[];
|
|
48
|
+
readonly token_endpoint_auth_methods_supported: OidcTokenEndpointAuthMethod[];
|
|
49
|
+
readonly claims_supported: string[];
|
|
50
|
+
readonly code_challenge_methods_supported: string[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Centralizes all derived OIDC provider configuration so that both the
|
|
54
|
+
* oidc-provider instance and the discovery endpoint use the same values.
|
|
55
|
+
*
|
|
56
|
+
* Reads provider-level settings (scopes, claims, grant types, response types) from
|
|
57
|
+
* the {@link OidcAccountServiceDelegate.providerConfig} via the injected account service.
|
|
58
|
+
*
|
|
59
|
+
* Injected into {@link OidcService} and {@link OidcWellKnownController}.
|
|
60
|
+
*/
|
|
61
|
+
export declare class OidcProviderConfigService {
|
|
62
|
+
private readonly config;
|
|
63
|
+
readonly routes: OidcRoutes;
|
|
64
|
+
/**
|
|
65
|
+
* If the OIDC registration route is enabled.
|
|
66
|
+
*/
|
|
67
|
+
readonly oidcRegistrationRouteEnabled: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* The url to the front-end login page.
|
|
70
|
+
*/
|
|
71
|
+
readonly appLoginUrl: WebsiteUrl;
|
|
72
|
+
/**
|
|
73
|
+
* The url to the front-end consent page.
|
|
74
|
+
*/
|
|
75
|
+
readonly appConsentUrl: WebsiteUrl;
|
|
76
|
+
/**
|
|
77
|
+
* The app-provided provider config from the delegate.
|
|
78
|
+
*/
|
|
79
|
+
readonly providerConfig: OidcProviderConfig;
|
|
80
|
+
/**
|
|
81
|
+
* Scopes derived from the claims configuration keys.
|
|
82
|
+
*/
|
|
83
|
+
readonly scopesSupported: string[];
|
|
84
|
+
/**
|
|
85
|
+
* Flat list of all unique claim names from the claims configuration.
|
|
86
|
+
*/
|
|
87
|
+
readonly claimsSupported: string[];
|
|
88
|
+
/**
|
|
89
|
+
* Token endpoint authentication methods from config or defaults.
|
|
90
|
+
*/
|
|
91
|
+
readonly tokenEndpointAuthMethodsSupported: OidcTokenEndpointAuthMethod[];
|
|
92
|
+
constructor(config: OidcModuleConfig, accountService: OidcAccountService, envService: FirebaseServerEnvService);
|
|
93
|
+
/**
|
|
94
|
+
* Builds the OpenID Connect Discovery metadata document.
|
|
95
|
+
*
|
|
96
|
+
* @param jwksUri - Optional override for the JWKS URI (e.g., from cloud storage).
|
|
97
|
+
* Falls back to `{issuer}{routes.jwks}`.
|
|
98
|
+
*/
|
|
99
|
+
buildDiscoveryMetadata(jwksUri?: string): OidcDiscoveryMetadata;
|
|
100
|
+
}
|