@softure-ai/auth 0.2.8 → 0.2.10
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/CHANGELOG.md +22 -0
- package/README.md +49 -2
- package/dist/index.d.ts +42 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/options.d.ts +124 -13
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +48 -15
- package/dist/options.js.map +1 -1
- package/dist/server/oidc/allowlist.d.ts +10 -0
- package/dist/server/oidc/allowlist.d.ts.map +1 -0
- package/dist/server/oidc/allowlist.js +23 -0
- package/dist/server/oidc/allowlist.js.map +1 -0
- package/dist/server/oidc/discovery.d.ts +2 -2
- package/dist/server/oidc/discovery.d.ts.map +1 -1
- package/dist/server/oidc/discovery.js.map +1 -1
- package/dist/server/oidc/flow.d.ts +0 -7
- package/dist/server/oidc/flow.d.ts.map +1 -1
- package/dist/server/oidc/flow.js +50 -49
- package/dist/server/oidc/flow.js.map +1 -1
- package/dist/server/oidc/github.d.ts +33 -0
- package/dist/server/oidc/github.d.ts.map +1 -0
- package/dist/server/oidc/github.js +92 -0
- package/dist/server/oidc/github.js.map +1 -0
- package/dist/server/oidc/index.d.ts +2 -1
- package/dist/server/oidc/index.d.ts.map +1 -1
- package/dist/server/oidc/index.js +3 -2
- package/dist/server/oidc/index.js.map +1 -1
- package/dist/server/oidc/token-request.d.ts +2 -2
- package/dist/server/oidc/token-request.d.ts.map +1 -1
- package/dist/testing/github-provider.d.ts +58 -0
- package/dist/testing/github-provider.d.ts.map +1 -0
- package/dist/testing/github-provider.js +139 -0
- package/dist/testing/github-provider.js.map +1 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +2 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/oidc-provider.d.ts +2 -2
- package/dist/testing/oidc-provider.d.ts.map +1 -1
- package/module.json +1 -1
- package/package.json +1 -1
- package/src/index.ts +5 -1
- package/src/options.ts +80 -36
- package/src/server/oidc/allowlist.ts +23 -0
- package/src/server/oidc/discovery.ts +2 -2
- package/src/server/oidc/flow.ts +63 -47
- package/src/server/oidc/github.ts +112 -0
- package/src/server/oidc/index.ts +2 -2
- package/src/server/oidc/token-request.ts +2 -2
- package/src/testing/github-provider.ts +202 -0
- package/src/testing/index.ts +10 -1
- package/src/testing/oidc-provider.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,28 @@ Newest first. Each version lists what changed for an app that uses `@softure-ai/
|
|
|
4
4
|
production, the version gets a line `verified in: <app>@<commit>` ([docs/05](../../docs/05-adoption-playbook.md),
|
|
5
5
|
"Definition of done"). Versions before the first one below are described in their GitHub Releases (`auth@x.y.z`).
|
|
6
6
|
|
|
7
|
+
## 0.2.10
|
|
8
|
+
|
|
9
|
+
- The GitHub sign-in example and the `clientIdEnv`/`clientSecretEnv` hints name `GH_AUTH_CLIENT_ID` and
|
|
10
|
+
`GH_AUTH_CLIENT_SECRET` (#846): GitHub Actions refuses secret names that start with `GITHUB_`. Any name still parses.
|
|
11
|
+
|
|
12
|
+
## 0.2.9
|
|
13
|
+
|
|
14
|
+
- Sign in with GitHub (#840): a provider entry `{ type: "github", id, name, clientIdEnv, clientSecretEnv,
|
|
15
|
+
allowedEmails | allowedDomains }` in `oidc.providers`. GitHub is an OAuth App, not OpenID Connect: the endpoints are
|
|
16
|
+
fixed, and the account is read from GitHub's API (`/user`, `/user/emails`) with an access token that is never
|
|
17
|
+
stored. The subject is the numeric account id; only verified emails count, primary first. Everything else is the
|
|
18
|
+
OpenID Connect sign-in's: state, PKCE, cookie, `oidc-*` buckets, callback route, allowlist, `auth.identities`,
|
|
19
|
+
linking, `onRegistered`, error codes. `createFakeGithubProvider` in `@softure-ai/auth/testing` tests it without
|
|
20
|
+
network. README section 3, "GitHub sign-in".
|
|
21
|
+
- Types: `OidcProvider` is now a union of `OpenIdConnectProvider` (`type: "oidc"`, the default for an entry without
|
|
22
|
+
`type`) and `GithubProvider`; code that reads `provider.issuer` narrows on `type` first. The parsed options carry
|
|
23
|
+
`type`. New exports: `OpenIdConnectProvider`, `OpenIdConnectProviderInput`, `GithubProvider`, `GithubProviderInput`.
|
|
24
|
+
- The allowlist message reads "a sign-in through a provider is limited to them".
|
|
25
|
+
|
|
26
|
+
No change for an app: existing entries parse as before, no migration, bucket, route or copy is added. Sign-in through
|
|
27
|
+
a provider stays opt-in.
|
|
28
|
+
|
|
7
29
|
## 0.2.8
|
|
8
30
|
|
|
9
31
|
- OpenID Connect stays opt-in, now stated and tested (#786). An app without `oidc.providers` runs none of it. On a bump
|
package/README.md
CHANGED
|
@@ -123,13 +123,13 @@ passwords for one email, from any addresses, block logins to that account for th
|
|
|
123
123
|
window, the owner's included. Raise its limit if that trade-off is wrong for your app. Auth checks
|
|
124
124
|
at its first call that the buckets it counts in exist and names the missing ones: the three
|
|
125
125
|
`password-reset*` buckets only when `passwordReset.send` is set, `oidc-start` and `oidc-callback` (per client address)
|
|
126
|
-
only with
|
|
126
|
+
only with a provider (OpenID Connect or GitHub). A request whose client address
|
|
127
127
|
cannot be resolved is refused (`security.client_unidentified`); the security README shows resolver
|
|
128
128
|
chains for production and for development and test stacks.
|
|
129
129
|
|
|
130
130
|
### OpenID Connect sign-in
|
|
131
131
|
|
|
132
|
-
Sign in with Google, or any OpenID Connect provider, for the accounts of a Workspace domain or a short list of
|
|
132
|
+
Sign in with Google, or any OpenID Connect provider (or GitHub, below), for the accounts of a Workspace domain or a short list of
|
|
133
133
|
emails. Off without providers. With `password: { enabled: false }` it is the only way in: no password, no
|
|
134
134
|
registration form, no outer sign-in in front of the host.
|
|
135
135
|
|
|
@@ -201,6 +201,53 @@ the variables the provider names.
|
|
|
201
201
|
`oidc.fetch` and `fake.env` as the context's `env`; `fake.signIn(authorizeUrl, { subject, email, hostedDomain, name, givenName })`
|
|
202
202
|
answers the callback URL. It can break on purpose (`claims`, `signWith`, `rotateKeys`, `failNext`, `setDiscovery`).
|
|
203
203
|
|
|
204
|
+
#### GitHub sign-in
|
|
205
|
+
|
|
206
|
+
GitHub is not an OpenID Connect provider for people (an OAuth App has no discovery document, ID token or keys), so it
|
|
207
|
+
is a provider type of its own in the same list. It shares the button, the route, the cookie, the state and PKCE, the
|
|
208
|
+
`oidc-*` buckets, the allowlist, `auth.identities`, account linking, `onRegistered` and the error codes above; only the
|
|
209
|
+
protocol step differs.
|
|
210
|
+
|
|
211
|
+
```ts
|
|
212
|
+
auth({
|
|
213
|
+
password: { enabled: false },
|
|
214
|
+
oidc: {
|
|
215
|
+
providers: [
|
|
216
|
+
{
|
|
217
|
+
type: "github", // no issuer: GitHub's endpoints are fixed
|
|
218
|
+
id: "github", // the callback is /api/auth/oidc/github/callback
|
|
219
|
+
name: "GitHub",
|
|
220
|
+
clientIdEnv: "GH_AUTH_CLIENT_ID",
|
|
221
|
+
clientSecretEnv: "GH_AUTH_CLIENT_SECRET", // required: GitHub's token endpoint always needs it
|
|
222
|
+
allowedEmails: ["owner@example.com"], // or allowedDomains
|
|
223
|
+
authorizeParams: { allow_signup: "false" }, // optional, sent as they are
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
At GitHub, create an OAuth App (Settings, Developer settings, OAuth Apps), set its "Authorization callback URL" to
|
|
231
|
+
`<appOrigin>/api/auth/oidc/<id>/callback` and put its client id and a client secret in the variables above.
|
|
232
|
+
Keep the `GITHUB_` prefix off these names: GitHub Actions refuses secret names that start with it, so a deploy
|
|
233
|
+
workflow could not hold them as Environment secrets.
|
|
234
|
+
|
|
235
|
+
- **Flow.** The browser goes to `https://github.com/login/oauth/authorize` with the scopes `read:user user:email`, the
|
|
236
|
+
state and the PKCE S256 challenge (no nonce). The callback exchanges the code at
|
|
237
|
+
`https://github.com/login/oauth/access_token` (GitHub answers an OAuth error with status 200, which still fails the
|
|
238
|
+
sign-in), then reads `GET https://api.github.com/user` and `GET https://api.github.com/user/emails` with the access
|
|
239
|
+
token. The token is used for those two reads only: it is never stored or logged.
|
|
240
|
+
- **Who may sign in.** Only verified emails count. The primary email is tried first, then any other verified email,
|
|
241
|
+
and the first one that `allowedEmails` or `allowedDomains` accepts signs in (there is no hosted domain on GitHub).
|
|
242
|
+
None: `auth.oidc_not_allowed`.
|
|
243
|
+
- **Accounts.** The subject is the numeric GitHub account id, so a renamed login or a changed email keeps the account.
|
|
244
|
+
The display name is the profile `name`, else the `login`. The log line reads `GitHub sign-in with github failed: …`.
|
|
245
|
+
- **Tests.** `createFakeGithubProvider()` from `@softure-ai/auth/testing` is GitHub in memory (authorize check, token
|
|
246
|
+
endpoint with PKCE and one-time codes, `/user`, `/user/emails`): pass `fake.definition`, `fake.fetch` and `fake.env`
|
|
247
|
+
as with the OpenID Connect fake; `fake.signIn(authorizeUrl, { id, login, name, emails: [{ email, verified, primary }] })`
|
|
248
|
+
answers the callback URL, `{ deny: true }` a refusal, and `failNext` breaks the next calls
|
|
249
|
+
(`unavailable`, `bad_verification_code`, `user_unavailable`, `emails_unavailable`).
|
|
250
|
+
|
|
204
251
|
**Without a provider.** OpenID Connect is opt-in: an app chooses its sign-in methods, and with no
|
|
205
252
|
`oidc.providers` nothing of it runs. What such an app still gets, and why it needs nothing:
|
|
206
253
|
|
package/dist/index.d.ts
CHANGED
|
@@ -209,7 +209,12 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
|
|
|
209
209
|
ttlMinutes: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
210
210
|
}, import("zod/v4/core").$strict>>;
|
|
211
211
|
oidc: import("zod").ZodPrefault<import("zod").ZodObject<{
|
|
212
|
-
providers: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodPipe<import("zod").ZodObject<{
|
|
212
|
+
providers: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodPipe<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
213
|
+
requireHostedDomain: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
214
|
+
allowedDomains: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
215
|
+
allowedEmails: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodEmail>>>;
|
|
216
|
+
createAccounts: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
217
|
+
type: import("zod").ZodDefault<import("zod").ZodLiteral<"oidc">>;
|
|
213
218
|
id: import("zod").ZodString;
|
|
214
219
|
name: import("zod").ZodString;
|
|
215
220
|
issuer: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<string, string>>;
|
|
@@ -221,12 +226,33 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
|
|
|
221
226
|
}>>;
|
|
222
227
|
scopes: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
223
228
|
authorizeParams: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
229
|
+
}, import("zod/v4/core").$strict>, import("zod").ZodObject<{
|
|
224
230
|
allowedDomains: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
225
231
|
allowedEmails: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodEmail>>>;
|
|
226
|
-
requireHostedDomain: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
227
232
|
createAccounts: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
228
|
-
|
|
233
|
+
type: import("zod").ZodLiteral<"github">;
|
|
234
|
+
id: import("zod").ZodString;
|
|
235
|
+
name: import("zod").ZodString;
|
|
236
|
+
clientIdEnv: import("zod").ZodString;
|
|
237
|
+
clientSecretEnv: import("zod").ZodString;
|
|
238
|
+
authorizeParams: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
239
|
+
}, import("zod/v4/core").$strict>], "type">, import("zod").ZodTransform<{
|
|
240
|
+
requireHostedDomain: false;
|
|
241
|
+
allowedDomains: string[];
|
|
242
|
+
allowedEmails: string[];
|
|
243
|
+
createAccounts: boolean;
|
|
244
|
+
type: "github";
|
|
245
|
+
id: string;
|
|
246
|
+
name: string;
|
|
247
|
+
clientIdEnv: string;
|
|
248
|
+
clientSecretEnv: string;
|
|
249
|
+
authorizeParams: Record<string, string>;
|
|
250
|
+
} | {
|
|
229
251
|
requireHostedDomain: boolean;
|
|
252
|
+
allowedDomains: string[];
|
|
253
|
+
allowedEmails: string[];
|
|
254
|
+
createAccounts: boolean;
|
|
255
|
+
type: "oidc";
|
|
230
256
|
id: string;
|
|
231
257
|
name: string;
|
|
232
258
|
issuer: string;
|
|
@@ -234,11 +260,12 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
|
|
|
234
260
|
clientAuth: "body" | "basic";
|
|
235
261
|
scopes: string[];
|
|
236
262
|
authorizeParams: Record<string, string>;
|
|
263
|
+
clientSecretEnv?: string | undefined;
|
|
264
|
+
}, {
|
|
237
265
|
allowedDomains: string[];
|
|
238
266
|
allowedEmails: string[];
|
|
239
267
|
createAccounts: boolean;
|
|
240
|
-
|
|
241
|
-
}, {
|
|
268
|
+
type: "oidc";
|
|
242
269
|
id: string;
|
|
243
270
|
name: string;
|
|
244
271
|
issuer: string;
|
|
@@ -246,11 +273,18 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
|
|
|
246
273
|
clientAuth: "body" | "basic";
|
|
247
274
|
scopes: string[];
|
|
248
275
|
authorizeParams: Record<string, string>;
|
|
276
|
+
requireHostedDomain?: boolean | undefined;
|
|
277
|
+
clientSecretEnv?: string | undefined;
|
|
278
|
+
} | {
|
|
249
279
|
allowedDomains: string[];
|
|
250
280
|
allowedEmails: string[];
|
|
251
281
|
createAccounts: boolean;
|
|
252
|
-
|
|
253
|
-
|
|
282
|
+
type: "github";
|
|
283
|
+
id: string;
|
|
284
|
+
name: string;
|
|
285
|
+
clientIdEnv: string;
|
|
286
|
+
clientSecretEnv: string;
|
|
287
|
+
authorizeParams: Record<string, string>;
|
|
254
288
|
}>>>>;
|
|
255
289
|
stateTtlMinutes: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
256
290
|
httpTimeoutMs: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
@@ -262,7 +296,7 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
|
|
|
262
296
|
export { INITIAL_AUTH_FORM_STATE } from "./contract.js";
|
|
263
297
|
export type { AuthErrorCode, AuthFormErrorCode, AuthFormField, AuthFormState, AuthUser, NewSession, OidcSignInErrorCode, RegisteredEvent, SignedIn, } from "./contract.js";
|
|
264
298
|
export { authMessages, getAuthErrorMessage, type AuthMessages } from "./messages/index.js";
|
|
265
|
-
export { OIDC_PROVIDER_ID_PATTERN, type AuthOptions, type AuthOptionsInput, type OidcProvider, type OidcProviderInput, type OnRegisteredHook, type RewriteRedirect, type RewriteRedirectContext, type ScryptParams, } from "./options.js";
|
|
299
|
+
export { OIDC_PROVIDER_ID_PATTERN, type AuthOptions, type AuthOptionsInput, type GithubProvider, type GithubProviderInput, type OidcProvider, type OidcProviderInput, type OnRegisteredHook, type OpenIdConnectProvider, type OpenIdConnectProviderInput, type RewriteRedirect, type RewriteRedirectContext, type ScryptParams, } from "./options.js";
|
|
266
300
|
export { consolePasswordResetSender, type PasswordResetDetails, type PasswordResetEnqueuer, type PasswordResetSender, } from "./password-reset-sender.js";
|
|
267
301
|
export { getSessionCookie, type SessionCookie } from "./session-cookie.js";
|
|
268
302
|
export { toSafeNextPath } from "./safe-next-path.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,SAAS,SAAS,CAAC;AAEhC,2DAA2D;AAC3D,eAAO,MAAM,0BAA0B,6BAA6B,CAA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AAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,GACzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -40,7 +40,7 @@ export const AUTH_RATE_LIMIT_BUCKETS = {
|
|
|
40
40
|
export const auth = defineModule({
|
|
41
41
|
manifest: {
|
|
42
42
|
id: MODULE_ID,
|
|
43
|
-
version: "0.2.
|
|
43
|
+
version: "0.2.10",
|
|
44
44
|
dependsOn: { security: "^0.2.0", mailing: "^0.2.0?", ops: "^0.2.0?", jobs: "^0.1.1?" },
|
|
45
45
|
dbSchema: "auth",
|
|
46
46
|
tables: ["users", "sessions", "user_roles", "password_resets", "identities", "oidc_states"],
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,qIAAqI;AACrI,sGAAsG;AACtG,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CA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,EAAE,gBAAgB,EAAsB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/options.d.ts
CHANGED
|
@@ -36,7 +36,12 @@ declare const scryptSchema: z.ZodObject<{
|
|
|
36
36
|
export declare const OIDC_PROVIDER_ID_PATTERN: RegExp;
|
|
37
37
|
/** An https URL, or http on the local machine (a development identity provider). */
|
|
38
38
|
export declare function isSecureEndpoint(value: string): boolean;
|
|
39
|
-
declare const
|
|
39
|
+
declare const openIdConnectProviderSchema: z.ZodObject<{
|
|
40
|
+
requireHostedDomain: z.ZodOptional<z.ZodBoolean>;
|
|
41
|
+
allowedDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
42
|
+
allowedEmails: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
|
|
43
|
+
createAccounts: z.ZodDefault<z.ZodBoolean>;
|
|
44
|
+
type: z.ZodDefault<z.ZodLiteral<"oidc">>;
|
|
40
45
|
id: z.ZodString;
|
|
41
46
|
name: z.ZodString;
|
|
42
47
|
issuer: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
@@ -48,12 +53,67 @@ declare const oidcProviderSchema: z.ZodPipe<z.ZodObject<{
|
|
|
48
53
|
}>>;
|
|
49
54
|
scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
50
55
|
authorizeParams: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
56
|
+
}, z.core.$strict>;
|
|
57
|
+
/**
|
|
58
|
+
* Sign-in with a GitHub OAuth App: not OpenID Connect (no discovery, ID token or keys), so the endpoints are fixed and
|
|
59
|
+
* the account is read from GitHub's API with the access token, which is not kept. Everything around it (state, PKCE,
|
|
60
|
+
* cookie, rate limits, callback route, allowlist, identities) is the OpenID Connect sign-in's.
|
|
61
|
+
*/
|
|
62
|
+
declare const githubProviderSchema: z.ZodObject<{
|
|
51
63
|
allowedDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
52
64
|
allowedEmails: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
|
|
65
|
+
createAccounts: z.ZodDefault<z.ZodBoolean>;
|
|
66
|
+
type: z.ZodLiteral<"github">;
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
name: z.ZodString;
|
|
69
|
+
clientIdEnv: z.ZodString;
|
|
70
|
+
clientSecretEnv: z.ZodString;
|
|
71
|
+
authorizeParams: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
declare const oidcProviderSchema: z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
53
74
|
requireHostedDomain: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
allowedDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
76
|
+
allowedEmails: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
|
|
54
77
|
createAccounts: z.ZodDefault<z.ZodBoolean>;
|
|
55
|
-
|
|
78
|
+
type: z.ZodDefault<z.ZodLiteral<"oidc">>;
|
|
79
|
+
id: z.ZodString;
|
|
80
|
+
name: z.ZodString;
|
|
81
|
+
issuer: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
82
|
+
clientIdEnv: z.ZodString;
|
|
83
|
+
clientSecretEnv: z.ZodOptional<z.ZodString>;
|
|
84
|
+
clientAuth: z.ZodDefault<z.ZodEnum<{
|
|
85
|
+
body: "body";
|
|
86
|
+
basic: "basic";
|
|
87
|
+
}>>;
|
|
88
|
+
scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
89
|
+
authorizeParams: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
90
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
91
|
+
allowedDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
92
|
+
allowedEmails: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
|
|
93
|
+
createAccounts: z.ZodDefault<z.ZodBoolean>;
|
|
94
|
+
type: z.ZodLiteral<"github">;
|
|
95
|
+
id: z.ZodString;
|
|
96
|
+
name: z.ZodString;
|
|
97
|
+
clientIdEnv: z.ZodString;
|
|
98
|
+
clientSecretEnv: z.ZodString;
|
|
99
|
+
authorizeParams: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
100
|
+
}, z.core.$strict>], "type">, z.ZodTransform<{
|
|
101
|
+
requireHostedDomain: false;
|
|
102
|
+
allowedDomains: string[];
|
|
103
|
+
allowedEmails: string[];
|
|
104
|
+
createAccounts: boolean;
|
|
105
|
+
type: "github";
|
|
106
|
+
id: string;
|
|
107
|
+
name: string;
|
|
108
|
+
clientIdEnv: string;
|
|
109
|
+
clientSecretEnv: string;
|
|
110
|
+
authorizeParams: Record<string, string>;
|
|
111
|
+
} | {
|
|
56
112
|
requireHostedDomain: boolean;
|
|
113
|
+
allowedDomains: string[];
|
|
114
|
+
allowedEmails: string[];
|
|
115
|
+
createAccounts: boolean;
|
|
116
|
+
type: "oidc";
|
|
57
117
|
id: string;
|
|
58
118
|
name: string;
|
|
59
119
|
issuer: string;
|
|
@@ -61,11 +121,12 @@ declare const oidcProviderSchema: z.ZodPipe<z.ZodObject<{
|
|
|
61
121
|
clientAuth: "body" | "basic";
|
|
62
122
|
scopes: string[];
|
|
63
123
|
authorizeParams: Record<string, string>;
|
|
124
|
+
clientSecretEnv?: string | undefined;
|
|
125
|
+
}, {
|
|
64
126
|
allowedDomains: string[];
|
|
65
127
|
allowedEmails: string[];
|
|
66
128
|
createAccounts: boolean;
|
|
67
|
-
|
|
68
|
-
}, {
|
|
129
|
+
type: "oidc";
|
|
69
130
|
id: string;
|
|
70
131
|
name: string;
|
|
71
132
|
issuer: string;
|
|
@@ -73,14 +134,30 @@ declare const oidcProviderSchema: z.ZodPipe<z.ZodObject<{
|
|
|
73
134
|
clientAuth: "body" | "basic";
|
|
74
135
|
scopes: string[];
|
|
75
136
|
authorizeParams: Record<string, string>;
|
|
137
|
+
requireHostedDomain?: boolean | undefined;
|
|
138
|
+
clientSecretEnv?: string | undefined;
|
|
139
|
+
} | {
|
|
76
140
|
allowedDomains: string[];
|
|
77
141
|
allowedEmails: string[];
|
|
78
142
|
createAccounts: boolean;
|
|
79
|
-
|
|
80
|
-
|
|
143
|
+
type: "github";
|
|
144
|
+
id: string;
|
|
145
|
+
name: string;
|
|
146
|
+
clientIdEnv: string;
|
|
147
|
+
clientSecretEnv: string;
|
|
148
|
+
authorizeParams: Record<string, string>;
|
|
81
149
|
}>>;
|
|
82
150
|
export type OidcProviderInput = z.input<typeof oidcProviderSchema>;
|
|
151
|
+
export type OpenIdConnectProviderInput = z.input<typeof openIdConnectProviderSchema>;
|
|
152
|
+
export type GithubProviderInput = z.input<typeof githubProviderSchema>;
|
|
153
|
+
/** A configured sign-in provider: OpenID Connect (`type: "oidc"`) or GitHub (`type: "github"`). */
|
|
83
154
|
export type OidcProvider = z.output<typeof oidcProviderSchema>;
|
|
155
|
+
export type OpenIdConnectProvider = Extract<OidcProvider, {
|
|
156
|
+
readonly type: "oidc";
|
|
157
|
+
}>;
|
|
158
|
+
export type GithubProvider = Extract<OidcProvider, {
|
|
159
|
+
readonly type: "github";
|
|
160
|
+
}>;
|
|
84
161
|
export declare const authOptionsSchema: z.ZodObject<{
|
|
85
162
|
password: z.ZodPrefault<z.ZodObject<{
|
|
86
163
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -114,7 +191,12 @@ export declare const authOptionsSchema: z.ZodObject<{
|
|
|
114
191
|
ttlMinutes: z.ZodDefault<z.ZodNumber>;
|
|
115
192
|
}, z.core.$strict>>;
|
|
116
193
|
oidc: z.ZodPrefault<z.ZodObject<{
|
|
117
|
-
providers: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
194
|
+
providers: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
195
|
+
requireHostedDomain: z.ZodOptional<z.ZodBoolean>;
|
|
196
|
+
allowedDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
197
|
+
allowedEmails: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
|
|
198
|
+
createAccounts: z.ZodDefault<z.ZodBoolean>;
|
|
199
|
+
type: z.ZodDefault<z.ZodLiteral<"oidc">>;
|
|
118
200
|
id: z.ZodString;
|
|
119
201
|
name: z.ZodString;
|
|
120
202
|
issuer: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
@@ -126,12 +208,33 @@ export declare const authOptionsSchema: z.ZodObject<{
|
|
|
126
208
|
}>>;
|
|
127
209
|
scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
128
210
|
authorizeParams: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
211
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
129
212
|
allowedDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
130
213
|
allowedEmails: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
|
|
131
|
-
requireHostedDomain: z.ZodOptional<z.ZodBoolean>;
|
|
132
214
|
createAccounts: z.ZodDefault<z.ZodBoolean>;
|
|
133
|
-
|
|
215
|
+
type: z.ZodLiteral<"github">;
|
|
216
|
+
id: z.ZodString;
|
|
217
|
+
name: z.ZodString;
|
|
218
|
+
clientIdEnv: z.ZodString;
|
|
219
|
+
clientSecretEnv: z.ZodString;
|
|
220
|
+
authorizeParams: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
221
|
+
}, z.core.$strict>], "type">, z.ZodTransform<{
|
|
222
|
+
requireHostedDomain: false;
|
|
223
|
+
allowedDomains: string[];
|
|
224
|
+
allowedEmails: string[];
|
|
225
|
+
createAccounts: boolean;
|
|
226
|
+
type: "github";
|
|
227
|
+
id: string;
|
|
228
|
+
name: string;
|
|
229
|
+
clientIdEnv: string;
|
|
230
|
+
clientSecretEnv: string;
|
|
231
|
+
authorizeParams: Record<string, string>;
|
|
232
|
+
} | {
|
|
134
233
|
requireHostedDomain: boolean;
|
|
234
|
+
allowedDomains: string[];
|
|
235
|
+
allowedEmails: string[];
|
|
236
|
+
createAccounts: boolean;
|
|
237
|
+
type: "oidc";
|
|
135
238
|
id: string;
|
|
136
239
|
name: string;
|
|
137
240
|
issuer: string;
|
|
@@ -139,11 +242,12 @@ export declare const authOptionsSchema: z.ZodObject<{
|
|
|
139
242
|
clientAuth: "body" | "basic";
|
|
140
243
|
scopes: string[];
|
|
141
244
|
authorizeParams: Record<string, string>;
|
|
245
|
+
clientSecretEnv?: string | undefined;
|
|
246
|
+
}, {
|
|
142
247
|
allowedDomains: string[];
|
|
143
248
|
allowedEmails: string[];
|
|
144
249
|
createAccounts: boolean;
|
|
145
|
-
|
|
146
|
-
}, {
|
|
250
|
+
type: "oidc";
|
|
147
251
|
id: string;
|
|
148
252
|
name: string;
|
|
149
253
|
issuer: string;
|
|
@@ -151,11 +255,18 @@ export declare const authOptionsSchema: z.ZodObject<{
|
|
|
151
255
|
clientAuth: "body" | "basic";
|
|
152
256
|
scopes: string[];
|
|
153
257
|
authorizeParams: Record<string, string>;
|
|
258
|
+
requireHostedDomain?: boolean | undefined;
|
|
259
|
+
clientSecretEnv?: string | undefined;
|
|
260
|
+
} | {
|
|
154
261
|
allowedDomains: string[];
|
|
155
262
|
allowedEmails: string[];
|
|
156
263
|
createAccounts: boolean;
|
|
157
|
-
|
|
158
|
-
|
|
264
|
+
type: "github";
|
|
265
|
+
id: string;
|
|
266
|
+
name: string;
|
|
267
|
+
clientIdEnv: string;
|
|
268
|
+
clientSecretEnv: string;
|
|
269
|
+
authorizeParams: Record<string, string>;
|
|
159
270
|
}>>>>;
|
|
160
271
|
stateTtlMinutes: z.ZodDefault<z.ZodNumber>;
|
|
161
272
|
httpTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
package/dist/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAG7F;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,QAAU,CAAC;AAY3C,4FAA4F;AAC5F,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,aAAa,CAAC,SAAS,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAExG,qDAAqD;AACrD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,eAAe,CAAC;CACzC;AAED;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,sBAAsB,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAMtG,QAAA,MAAM,YAAY;;;;kBAahB,CAAC;AAyBH,sHAAsH;AACtH,eA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|
@@ -74,10 +74,22 @@ export function isSecureEndpoint(value) {
|
|
|
74
74
|
return url.protocol === "https:" || (url.protocol === "http:" && LOCAL_HOSTS.has(url.hostname));
|
|
75
75
|
}
|
|
76
76
|
const domainSchema = z.string().trim().toLowerCase().regex(DOMAIN, "must be a lowercase host name such as example.com");
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
/** Who may sign in through a provider; refined on every provider type. */
|
|
78
|
+
const allowlistShape = {
|
|
79
|
+
/** Who may sign in: a verified email in one of these domains. */
|
|
80
|
+
allowedDomains: z.array(domainSchema).default([]),
|
|
81
|
+
/** Who may sign in: one of these verified emails. */
|
|
82
|
+
allowedEmails: z.array(adminEmailSchema).default([]),
|
|
83
|
+
/** A first sign-in of an allowed identity without an account creates one (no password); false only links. */
|
|
84
|
+
createAccounts: z.boolean().default(true),
|
|
85
|
+
};
|
|
86
|
+
const providerIdSchema = z.string().regex(OIDC_PROVIDER_ID_PATTERN, "must be an id such as google (a-z first, then a-z, 0-9 or -, at most 32)");
|
|
87
|
+
const authorizeParamsSchema = z.record(z.string().regex(/^[a-z_]{1,64}$/), z.string().max(512)).default({});
|
|
88
|
+
const openIdConnectProviderSchema = z.strictObject({
|
|
89
|
+
/** Optional: an entry without `type` is an OpenID Connect provider. */
|
|
90
|
+
type: z.literal("oidc").default("oidc"),
|
|
79
91
|
/** The provider's id in URLs and in `auth.identities`, e.g. `google`. */
|
|
80
|
-
id:
|
|
92
|
+
id: providerIdSchema,
|
|
81
93
|
/** The provider's name as the button shows it (`messages.oidc.signInWith`), e.g. `Google`. */
|
|
82
94
|
name: z.string().trim().min(1).max(64),
|
|
83
95
|
/** The issuer; its discovery document is `<issuer>/.well-known/openid-configuration`. */
|
|
@@ -94,22 +106,40 @@ const oidcProviderSchema = z
|
|
|
94
106
|
/** Requested scopes; `openid` and `email` are always sent. */
|
|
95
107
|
scopes: z.array(z.string().regex(/^[\x21\x23-\x5b\x5d-\x7e]{1,128}$/, "must be a scope token")).default([]),
|
|
96
108
|
/** Extra parameters of the authorize URL, e.g. `{ prompt: "select_account", hd: "example.com" }`. */
|
|
97
|
-
authorizeParams:
|
|
98
|
-
|
|
99
|
-
allowedDomains: z.array(domainSchema).default([]),
|
|
100
|
-
/** Who may sign in: one of these verified emails. */
|
|
101
|
-
allowedEmails: z.array(adminEmailSchema).default([]),
|
|
109
|
+
authorizeParams: authorizeParamsSchema,
|
|
110
|
+
...allowlistShape,
|
|
102
111
|
/**
|
|
103
112
|
* A domain match also needs the token's `hd` claim to name that domain (a Google Workspace account). Defaults to
|
|
104
113
|
* true for Google, whose consumer accounts can carry a verified address of any domain.
|
|
105
114
|
*/
|
|
106
115
|
requireHostedDomain: z.boolean().optional(),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
116
|
+
});
|
|
117
|
+
/**
|
|
118
|
+
* Sign-in with a GitHub OAuth App: not OpenID Connect (no discovery, ID token or keys), so the endpoints are fixed and
|
|
119
|
+
* the account is read from GitHub's API with the access token, which is not kept. Everything around it (state, PKCE,
|
|
120
|
+
* cookie, rate limits, callback route, allowlist, identities) is the OpenID Connect sign-in's.
|
|
121
|
+
*/
|
|
122
|
+
const githubProviderSchema = z.strictObject({
|
|
123
|
+
type: z.literal("github"),
|
|
124
|
+
/** The provider's id in URLs and in `auth.identities`, e.g. `github`. */
|
|
125
|
+
id: providerIdSchema,
|
|
126
|
+
/** The provider's name as the button shows it, e.g. `GitHub`. */
|
|
127
|
+
name: z.string().trim().min(1).max(64),
|
|
128
|
+
/** The environment variable that holds the OAuth App's client id. */
|
|
129
|
+
clientIdEnv: z.string().regex(ENV_NAME, "must be an environment variable name such as GH_AUTH_CLIENT_ID"),
|
|
130
|
+
/** The environment variable that holds the OAuth App's client secret (GitHub's token endpoint always needs it). */
|
|
131
|
+
clientSecretEnv: z.string().regex(ENV_NAME, "must be an environment variable name such as GH_AUTH_CLIENT_SECRET"),
|
|
132
|
+
/** Extra parameters of the authorize URL, e.g. `{ allow_signup: "false", prompt: "select_account" }`. */
|
|
133
|
+
authorizeParams: authorizeParamsSchema,
|
|
134
|
+
...allowlistShape,
|
|
135
|
+
});
|
|
136
|
+
const oidcProviderSchema = z
|
|
137
|
+
.discriminatedUnion("type", [openIdConnectProviderSchema, githubProviderSchema])
|
|
138
|
+
.transform((provider) => provider.type === "github"
|
|
139
|
+
? { ...provider, requireHostedDomain: false }
|
|
140
|
+
: { ...provider, requireHostedDomain: provider.requireHostedDomain ?? provider.issuer === GOOGLE_ISSUER })
|
|
111
141
|
.refine((provider) => provider.allowedDomains.length + provider.allowedEmails.length > 0, {
|
|
112
|
-
message: "needs allowedDomains or allowedEmails:
|
|
142
|
+
message: "needs allowedDomains or allowedEmails: a sign-in through a provider is limited to them",
|
|
113
143
|
path: ["allowedDomains"],
|
|
114
144
|
});
|
|
115
145
|
export const authOptionsSchema = z.strictObject({
|
|
@@ -193,7 +223,10 @@ export const authOptionsSchema = z.strictObject({
|
|
|
193
223
|
ttlMinutes: z.number().int().min(5).max(1440).default(60),
|
|
194
224
|
})
|
|
195
225
|
.prefault({}),
|
|
196
|
-
/**
|
|
226
|
+
/**
|
|
227
|
+
* Sign-in with OpenID Connect providers (e.g. Google) or GitHub (`type: "github"`), limited to allowed domains or
|
|
228
|
+
* emails. Off without providers.
|
|
229
|
+
*/
|
|
197
230
|
oidc: z
|
|
198
231
|
.strictObject({
|
|
199
232
|
providers: z
|
|
@@ -202,7 +235,7 @@ export const authOptionsSchema = z.strictObject({
|
|
|
202
235
|
.default([]),
|
|
203
236
|
/** How long a started sign-in may take at the provider. */
|
|
204
237
|
stateTtlMinutes: z.number().int().min(1).max(60).default(10),
|
|
205
|
-
/** Timeout of each call to a provider (discovery, keys, token). */
|
|
238
|
+
/** Timeout of each call to a provider (discovery, keys, token, GitHub's API). */
|
|
206
239
|
httpTimeoutMs: z.number().int().min(1000).max(60_000).default(10_000),
|
|
207
240
|
/** The `fetch` the provider calls go through; tests pass a fake provider's. */
|
|
208
241
|
fetch: z.custom((value) => typeof value === "function", "must be a function").optional(),
|
package/dist/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,CAAC;AAE3C,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAC5C,4EAA4E;AAC5E,MAAM,kBAAkB,GAAG,yBAAyB,CAAC;AACrD,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAC9C,MAAM,uBAAuB,GAAG,2BAA2B,CAAC;AAC5D,0EAA0E;AAC1E,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AACpG,MAAM,MAAM,GAAG,gGAAgG,CAAC;AAuBhH,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,YAAY,GAAG,CAAC,CAAC,YAAY,CAAC;IAClC,8CAA8C;IAC9C,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;SACZ,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;SACZ,MAAM,CAAC,YAAY,EAAE,wBAAwB,CAAC;SAC9C,OAAO,CAAC,mBAAmB,CAAC;IAC/B,qBAAqB;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GA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IACjD,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;IACjC,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,IAAI,EAAE,UAAU,IAAI,EAAE,EAAE,YAAY,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1F,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,eAAe,EAAE,YAAY,CAAC,EAAE,OAAO,EAAE,oDAAoD,EAAE,CAAC,CAAC;IAC7I,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { OidcProvider } from "../../options.js";
|
|
2
|
+
import type { IdentityClaims } from "./id-token.js";
|
|
3
|
+
/**
|
|
4
|
+
* The identity's email when it may sign in: verified, and listed in `allowedEmails` or of a domain in
|
|
5
|
+
* `allowedDomains` (with `requireHostedDomain`, the `hd` claim must name that domain too); null otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getAllowedEmail(provider: OidcProvider, claims: IdentityClaims): string | null;
|
|
8
|
+
/** Whether a verified, lowercased email passes the provider's allowlist. */
|
|
9
|
+
export declare function isAllowedEmail(provider: OidcProvider, email: string, hostedDomain: string | null): boolean;
|
|
10
|
+
//# sourceMappingURL=allowlist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allowlist.d.ts","sourceRoot":"","sources":["../../../src/server/oidc/allowlist.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAI7F;AAED,4EAA4E;AAC5E,wBAAgB,cAAc,CAAC,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAO1G"}
|