@cedarjs/auth-dbauth-oauth 7.0.0-canary.3075

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.
@@ -0,0 +1,82 @@
1
+ import {
2
+ buildCookieAttributes,
3
+ createExpiresAtDate,
4
+ decryptSession,
5
+ encryptSession
6
+ } from "@cedarjs/auth-dbauth-api";
7
+ const TRANSACTION_COOKIE_NAME = "oauth-transaction";
8
+ const DEFAULT_TRANSACTION_EXPIRES_SECONDS = 60 * 10;
9
+ const DEFAULT_TRANSACTION_COOKIE_ATTRIBUTES = {
10
+ HttpOnly: true,
11
+ SameSite: "Lax",
12
+ Path: "/"
13
+ };
14
+ function encodeTransactionCookie(data) {
15
+ const inner = Buffer.from(JSON.stringify(data), "utf-8").toString("base64url");
16
+ return encryptSession(JSON.stringify({ p: inner }));
17
+ }
18
+ function decodeTransactionCookie(cookieValue) {
19
+ if (!cookieValue) {
20
+ return null;
21
+ }
22
+ try {
23
+ const [wrapper] = decryptSession(cookieValue);
24
+ if (!wrapper || typeof wrapper !== "object" || typeof wrapper.p !== "string") {
25
+ return null;
26
+ }
27
+ const json = Buffer.from(
28
+ wrapper.p,
29
+ "base64url"
30
+ ).toString("utf-8");
31
+ return JSON.parse(json);
32
+ } catch {
33
+ return null;
34
+ }
35
+ }
36
+ function isTransactionExpired(data, expiresSeconds) {
37
+ return Date.now() - data.createdAt > expiresSeconds * 1e3;
38
+ }
39
+ function createTransactionCookieString({
40
+ data,
41
+ cookieConfig,
42
+ expiresSeconds
43
+ }) {
44
+ const expiresAt = createExpiresAtDate(expiresSeconds);
45
+ const effectiveCookieConfig = cookieConfig?.attributes ? cookieConfig : {
46
+ ...cookieConfig,
47
+ attributes: DEFAULT_TRANSACTION_COOKIE_ATTRIBUTES
48
+ };
49
+ return [
50
+ `${TRANSACTION_COOKIE_NAME}=${encodeTransactionCookie(data)}`,
51
+ ...buildCookieAttributes({
52
+ cookieConfig: effectiveCookieConfig,
53
+ expires: expiresAt
54
+ })
55
+ ].join(";");
56
+ }
57
+ function clearTransactionCookieString(cookieConfig) {
58
+ return [
59
+ `${TRANSACTION_COOKIE_NAME}=`,
60
+ ...buildCookieAttributes({ cookieConfig, expires: "now" })
61
+ ].join(";");
62
+ }
63
+ function getTransactionCookieValue(cookieHeader) {
64
+ if (!cookieHeader) {
65
+ return null;
66
+ }
67
+ const cookie = cookieHeader.split(";").find((c) => c.split("=")[0].trim() === TRANSACTION_COOKIE_NAME);
68
+ if (!cookie || cookie === `${TRANSACTION_COOKIE_NAME}=`) {
69
+ return null;
70
+ }
71
+ return cookie.split("=").slice(1).join("=").trim();
72
+ }
73
+ export {
74
+ DEFAULT_TRANSACTION_EXPIRES_SECONDS,
75
+ TRANSACTION_COOKIE_NAME,
76
+ clearTransactionCookieString,
77
+ createTransactionCookieString,
78
+ decodeTransactionCookie,
79
+ encodeTransactionCookie,
80
+ getTransactionCookieValue,
81
+ isTransactionExpired
82
+ };
@@ -0,0 +1,264 @@
1
+ import type { CorsConfig } from '@cedarjs/api';
2
+ import type { DbAuthCookieConfig } from '@cedarjs/auth-dbauth-api';
3
+ /**
4
+ * The three flows a caller can start an OAuth transaction with, plus the
5
+ * `unlink` flow which never leaves the app (no redirect round-trip).
6
+ *
7
+ * - `login`: the `(provider, providerUserId)` identity must already exist.
8
+ * Prevents a user from accidentally creating a duplicate account by
9
+ * logging in with a provider they haven't linked yet.
10
+ * - `signup`: creates a new user row plus the identity row. Fails if the
11
+ * provider's email matches an existing account (the user should log in
12
+ * and link instead).
13
+ * - `link`: attaches a provider identity to the account of the currently
14
+ * logged-in dbAuth user. Requires a valid dbAuth session cookie.
15
+ * - `unlink`: removes a provider identity from the current dbAuth user's
16
+ * account. JSON POST, no redirect, refuses to remove the last identity
17
+ * from an account with no password.
18
+ */
19
+ export type OAuthFlow = 'login' | 'signup' | 'link' | 'unlink';
20
+ /**
21
+ * Canonical profile a strategy hands back to the OAuth handler once the
22
+ * token exchange (and, for OIDC, id_token verification) is complete.
23
+ *
24
+ * `providerUserId` is the only field account lookup ever keys on — never
25
+ * `email` or `username`. For OIDC providers it must be the id_token's
26
+ * validated `sub` claim; for non-OIDC providers (GitHub, Facebook-shaped
27
+ * strategies) it must be the provider's immutable numeric/opaque user id,
28
+ * stringified.
29
+ */
30
+ export interface OAuthUserInfo {
31
+ providerUserId: string;
32
+ email?: string;
33
+ emailVerified?: boolean;
34
+ username?: string;
35
+ /** The raw profile/claims the strategy read `providerUserId`/`email`/etc from, for debugging. */
36
+ raw?: Record<string, unknown>;
37
+ }
38
+ /**
39
+ * Passed to `OAuthStrategy.getAuthorizationUrl`. The handler generates
40
+ * `state`, the PKCE pair, and (when `usesOidc` is true) `nonce` itself so
41
+ * every strategy gets the same CSRF/replay protection; the strategy's job is
42
+ * only to fold them into the URL its provider expects.
43
+ */
44
+ export interface OAuthAuthorizationContext {
45
+ /** The key this strategy is registered under in `providers`, e.g. `'google'`. */
46
+ provider: string;
47
+ /** Absolute callback URL registered with the provider for this provider key. */
48
+ redirectUri: string;
49
+ flow: OAuthFlow;
50
+ state: string;
51
+ codeVerifier: string;
52
+ /** S256 `code_challenge` precomputed from `codeVerifier`, for convenience. */
53
+ codeChallenge: string;
54
+ /** Present only when the strategy's `usesOidc` is true. */
55
+ nonce: string | undefined;
56
+ }
57
+ /**
58
+ * Passed to `OAuthStrategy.handleCallback` once the handler has already
59
+ * verified `state` against the transaction cookie and confirmed the
60
+ * provider didn't return an `error` param. The strategy owns everything
61
+ * from here: token exchange, id_token/JWKS verification (if any), userinfo,
62
+ * and mapping the result to `OAuthUserInfo`.
63
+ */
64
+ export interface OAuthCallbackContext {
65
+ provider: string;
66
+ redirectUri: string;
67
+ flow: OAuthFlow;
68
+ /**
69
+ * The `state` value generated for this transaction. The handler has
70
+ * already checked it against the callback's own `state` param, but a
71
+ * strategy using `oauth4webapi`'s `authorizationCodeGrantRequest` still
72
+ * needs it: that function only accepts `URLSearchParams` "branded" by
73
+ * having been passed through `oauth.validateAuthResponse(as, client,
74
+ * params, state)` first.
75
+ */
76
+ state: string;
77
+ /** The PKCE verifier generated for this transaction (matches `codeVerifier` from the authorization step). */
78
+ codeVerifier: string;
79
+ /** The nonce generated for this transaction, when `usesOidc` is true. */
80
+ nonce: string | undefined;
81
+ /** Query-string params from the callback request (used by GET callbacks). */
82
+ query: Record<string, string>;
83
+ /**
84
+ * Parsed `application/x-www-form-urlencoded` body params (used by
85
+ * `form_post` callbacks, e.g. Apple's cross-site POST). Empty for GET
86
+ * callbacks.
87
+ */
88
+ form: Record<string, string>;
89
+ }
90
+ /**
91
+ * The public extension point for adding an OAuth provider: presets (Google)
92
+ * and built-in strategies (GitHub) are implemented purely through this
93
+ * interface, so anything they can do a userland strategy package can too.
94
+ */
95
+ export interface OAuthStrategy {
96
+ /** Human-readable name, used in error messages/logs. */
97
+ name: string;
98
+ /**
99
+ * Absolute callback URL registered with the provider for this strategy,
100
+ * e.g. `https://example.com/auth/oauth/google/callback`. The handler
101
+ * doesn't compute this itself (it can't know which public host a
102
+ * provider's app-registration console has on file) — it just reads it
103
+ * back off the strategy and threads it through
104
+ * `OAuthAuthorizationContext`/`OAuthCallbackContext` for convenience.
105
+ */
106
+ redirectUri: string;
107
+ /**
108
+ * Whether this strategy participates in OIDC nonce handling. Presets
109
+ * (OIDC-compliant providers) set this to `true`; non-OIDC strategies like
110
+ * GitHub leave it `false` (or omitted) and the handler skips nonce
111
+ * generation for them.
112
+ */
113
+ usesOidc?: boolean;
114
+ /**
115
+ * Builds the full authorization URL to redirect the user to. Receives the
116
+ * handler-generated state/PKCE/nonce so the URL can embed them, plus
117
+ * whatever extra parameters the provider needs.
118
+ */
119
+ getAuthorizationUrl(ctx: OAuthAuthorizationContext): Promise<URL> | URL;
120
+ /**
121
+ * Completes the token exchange and returns the canonical profile. Throw to
122
+ * abort the flow — the handler catches it, logs the real message
123
+ * server-side, and redirects with the generic `provider_error` code so no
124
+ * exception text reaches the client.
125
+ */
126
+ handleCallback(ctx: OAuthCallbackContext): Promise<OAuthUserInfo>;
127
+ }
128
+ /**
129
+ * Data-only description of an OIDC-compliant provider: enough to run
130
+ * discovery and build a standard authorization-code + PKCE + nonce flow
131
+ * against it. Turn one into an `OAuthStrategy` with `createOidcStrategy`.
132
+ */
133
+ export interface ProviderPreset {
134
+ /** Display name, e.g. `'Google'`. */
135
+ name: string;
136
+ /** Issuer URL used for OIDC discovery (`${issuer}/.well-known/openid-configuration`). */
137
+ issuer: string;
138
+ /** Space-separated default scopes. Must include `openid`. */
139
+ scope: string;
140
+ }
141
+ /**
142
+ * Per-provider credentials used to turn a `ProviderPreset` into an
143
+ * `OAuthStrategy`, or to configure a built-in strategy factory (e.g.
144
+ * `githubProvider`).
145
+ */
146
+ export interface OAuthProviderCredentials {
147
+ clientId: string;
148
+ clientSecret: string;
149
+ /** Absolute callback URL registered with the provider, e.g. `https://example.com/auth/oauth/google/callback`. */
150
+ redirectUri: string;
151
+ /** Overrides the preset/strategy default scope, when set. */
152
+ scope?: string;
153
+ /**
154
+ * Test-only: allow `http://` issuer/token/authorization endpoints.
155
+ * Defaults to false. Never enable this outside of tests.
156
+ */
157
+ allowInsecureRequests?: boolean;
158
+ }
159
+ /**
160
+ * Field names on the identity (`oauthModelAccessor`) Prisma model. Defaults
161
+ * assume a model shaped like the community-plugin's `OAuth` model:
162
+ * `provider`, `providerUserId`, `userId`, plus optional
163
+ * `providerUsername`/`providerEmail`/`createdAt`/`updatedAt`. Uniqueness is
164
+ * assumed on `(provider, providerUserId)` and `(userId, provider)`.
165
+ */
166
+ export interface OAuthIdentityFields {
167
+ provider: string;
168
+ providerUserId: string;
169
+ userId: string;
170
+ providerUsername: string;
171
+ providerEmail: string;
172
+ }
173
+ export declare const DEFAULT_OAUTH_IDENTITY_FIELDS: OAuthIdentityFields;
174
+ /**
175
+ * Options passed to `signup.handler`: the OAuth profile plus the provider
176
+ * key, so the handler can create the user row (password fields absent) the
177
+ * same way `DbAuthHandlerOptions['signup'].handler` creates one for
178
+ * username/password signup.
179
+ */
180
+ export interface OAuthSignupHandlerOptions {
181
+ provider: string;
182
+ profile: OAuthUserInfo;
183
+ }
184
+ export type UserType = Record<string | number, any>;
185
+ export interface OAuthRedirects {
186
+ /** Path or absolute URL to send the browser to after a successful login. */
187
+ afterLogin: string;
188
+ /** Defaults to `afterLogin` when omitted. */
189
+ afterSignup?: string;
190
+ /** Defaults to `afterLogin` when omitted. */
191
+ afterLink?: string;
192
+ /**
193
+ * Path or absolute URL to send the browser to on failure. The stable
194
+ * error code is appended as `?error=<code>&provider=<name>` (additional
195
+ * existing query params are preserved).
196
+ */
197
+ error: string;
198
+ }
199
+ export interface OAuthHandlerOptions<TDb extends object = Record<string, unknown>> {
200
+ /** Prisma client (or a compatible mock in tests). */
201
+ db: TDb;
202
+ /** Property on `db` for the user table, e.g. `'user'` for `db.user`. */
203
+ authModelAccessor: keyof TDb;
204
+ /** Property on `db` for the identity table, e.g. `'oAuth'` for `db.oAuth`. */
205
+ oauthModelAccessor: keyof TDb;
206
+ /** Field name mapping on the identity model. Unset fields fall back to `DEFAULT_OAUTH_IDENTITY_FIELDS`. */
207
+ oauthFields?: Partial<OAuthIdentityFields>;
208
+ /**
209
+ * Field name mapping on the user model. `id` matches
210
+ * `DbAuthHandlerOptions.authFields.id`. `username` is matched against a
211
+ * provider's returned email for the signup email-collision guard (it's
212
+ * usually the same field dbAuth's own `authFields.username` points at,
213
+ * typically `'email'`). `hashedPassword` is used by the `unlink` guard to
214
+ * tell a password-protected account from a provider-only one.
215
+ */
216
+ authFields: {
217
+ id: string;
218
+ username: string;
219
+ hashedPassword: string;
220
+ };
221
+ /** Fields allowed back to the client in the session cookie payload. Defaults to `['id', 'email']`. */
222
+ allowedUserFields?: string[];
223
+ /** Configured providers, keyed by the path segment used in `/auth/oauth/{key}/...`. */
224
+ providers: Record<string, OAuthStrategy>;
225
+ /** Defaults to `/auth/oauth`. */
226
+ basePath?: string;
227
+ redirects: OAuthRedirects;
228
+ signup: {
229
+ enabled?: boolean;
230
+ handler: (options: OAuthSignupHandlerOptions) => UserType | Promise<UserType>;
231
+ } | {
232
+ enabled: false;
233
+ };
234
+ /** How long the minted session lasts, in seconds. Mirrors `DbAuthHandlerOptions['login'].expires`. */
235
+ sessionExpires: number;
236
+ /** How long the OAuth transaction cookie is valid for, in seconds. Defaults to 600 (10 minutes). */
237
+ transactionExpires?: number;
238
+ /** Cookie config applied to both the session cookie (via `createLoginResponse`) and the transaction cookie. */
239
+ cookie?: DbAuthCookieConfig;
240
+ /**
241
+ * Cookie config for the OAuth transaction cookie only, replacing `cookie`
242
+ * for it (not merged). Needed for a provider whose callback arrives as a
243
+ * cross-site `form_post` (e.g. Apple): the browser only sends a cookie on
244
+ * a cross-site POST when it carries `SameSite: 'None'` plus `Secure`, but
245
+ * setting that on `cookie` would also loosen the session cookie's
246
+ * `SameSite` policy for every provider, not just the one that needs it.
247
+ * Set this only for apps that configure such a provider; every other app
248
+ * keeps the transaction cookie on `cookie`'s (typically `Lax`) policy.
249
+ */
250
+ transactionCookie?: DbAuthCookieConfig;
251
+ cors?: CorsConfig;
252
+ /**
253
+ * Extra origins that are trusted for the `unlink` route's state-changing
254
+ * `POST` request, on top of the request's own host and any origins
255
+ * already listed in `cors.origin`.
256
+ *
257
+ * Needed when the web side and API are on different origins and
258
+ * `cors.origin` isn't set to those origins, or when `cors.origin` is set
259
+ * to `true` -- reflecting any request origin is never treated as trust,
260
+ * so that combination requires listing trusted origins here explicitly.
261
+ */
262
+ trustedOrigins?: string | string[];
263
+ }
264
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAElE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,G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;;;;OASG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CACnC"}
package/dist/types.js ADDED
@@ -0,0 +1,10 @@
1
+ const DEFAULT_OAUTH_IDENTITY_FIELDS = {
2
+ provider: "provider",
3
+ providerUserId: "providerUserId",
4
+ userId: "userId",
5
+ providerUsername: "providerUsername",
6
+ providerEmail: "providerEmail"
7
+ };
8
+ export {
9
+ DEFAULT_OAUTH_IDENTITY_FIELDS
10
+ };
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@cedarjs/auth-dbauth-oauth",
3
+ "version": "7.0.0-canary.3075",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/cedarjs/cedar.git",
7
+ "directory": "packages/auth-providers/dbAuth/oauth"
8
+ },
9
+ "license": "MIT",
10
+ "type": "module",
11
+ "exports": {
12
+ ".": {
13
+ "default": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.js"
16
+ }
17
+ }
18
+ },
19
+ "main": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "scripts": {
25
+ "build": "node ./build.mts",
26
+ "build:pack": "yarn pack -o cedarjs-auth-dbauth-oauth.tgz",
27
+ "build:types": "tsc --build --verbose ./tsconfig.build.json",
28
+ "build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"",
29
+ "check:attw": "yarn cedar-fwtools-attw",
30
+ "check:package": "concurrently npm:check:attw yarn:publint",
31
+ "prepublishOnly": "NODE_ENV=production yarn build",
32
+ "test": "vitest run",
33
+ "test:watch": "vitest watch"
34
+ },
35
+ "dependencies": {
36
+ "@cedarjs/auth-dbauth-api": "7.0.0-canary.3075"
37
+ },
38
+ "devDependencies": {
39
+ "@cedarjs/api": "7.0.0-canary.3075",
40
+ "@cedarjs/framework-tools": "7.0.0-canary.3075",
41
+ "@types/aws-lambda": "8.10.162",
42
+ "concurrently": "9.2.4",
43
+ "msw": "2.15.0",
44
+ "oauth2-mock-server": "9.1.0",
45
+ "oauth4webapi": "3.8.7",
46
+ "publint": "0.3.24",
47
+ "typescript": "5.9.3",
48
+ "vitest": "4.1.11"
49
+ },
50
+ "peerDependencies": {
51
+ "oauth4webapi": "^3.0.0"
52
+ },
53
+ "peerDependenciesMeta": {
54
+ "oauth4webapi": {
55
+ "optional": true
56
+ }
57
+ },
58
+ "engines": {
59
+ "node": ">=24"
60
+ },
61
+ "publishConfig": {
62
+ "access": "public"
63
+ }
64
+ }