@robelest/convex-auth 0.0.4-preview.13 → 0.0.4-preview.15
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/README.md +140 -9
- package/dist/bin.cjs +5957 -5478
- package/dist/client/index.d.ts +3 -7
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +27 -26
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/api.d.ts +14 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +1513 -3
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/convex.config.d.ts +2 -2
- package/dist/component/convex.config.d.ts.map +1 -1
- package/dist/component/model.d.ts +153 -0
- package/dist/component/model.d.ts.map +1 -0
- package/dist/component/model.js +327 -0
- package/dist/component/model.js.map +1 -0
- package/dist/component/providers/sso.d.ts +1 -1
- package/dist/component/public/enterprise.d.ts +49 -0
- package/dist/component/public/enterprise.d.ts.map +1 -0
- package/dist/component/public/enterprise.js +450 -0
- package/dist/component/public/enterprise.js.map +1 -0
- package/dist/component/public/factors.d.ts +52 -0
- package/dist/component/public/factors.d.ts.map +1 -0
- package/dist/component/public/factors.js +285 -0
- package/dist/component/public/factors.js.map +1 -0
- package/dist/component/public/groups.d.ts +118 -0
- package/dist/component/public/groups.d.ts.map +1 -0
- package/dist/component/public/groups.js +599 -0
- package/dist/component/public/groups.js.map +1 -0
- package/dist/component/public/identity.d.ts +93 -0
- package/dist/component/public/identity.d.ts.map +1 -0
- package/dist/component/public/identity.js +426 -0
- package/dist/component/public/identity.js.map +1 -0
- package/dist/component/public/keys.d.ts +41 -0
- package/dist/component/public/keys.d.ts.map +1 -0
- package/dist/component/public/keys.js +157 -0
- package/dist/component/public/keys.js.map +1 -0
- package/dist/component/public/shared.d.ts +26 -0
- package/dist/component/public/shared.d.ts.map +1 -0
- package/dist/component/public/shared.js +32 -0
- package/dist/component/public/shared.js.map +1 -0
- package/dist/component/public.d.ts +9 -321
- package/dist/component/public.d.ts.map +1 -1
- package/dist/component/public.js +6 -2145
- package/dist/component/schema.d.ts +368 -258
- package/dist/component/schema.js +23 -27
- package/dist/component/schema.js.map +1 -1
- package/dist/component/server/auth.d.ts +42 -7
- package/dist/component/server/auth.d.ts.map +1 -1
- package/dist/component/server/auth.js +70 -6
- package/dist/component/server/auth.js.map +1 -1
- package/dist/component/server/cookies.js +3 -0
- package/dist/component/server/cookies.js.map +1 -1
- package/dist/component/server/db.js +1 -0
- package/dist/component/server/db.js.map +1 -1
- package/dist/component/server/device.js +3 -1
- package/dist/component/server/device.js.map +1 -1
- package/dist/component/server/domains/core.js +466 -0
- package/dist/component/server/domains/core.js.map +1 -0
- package/dist/component/server/domains/sso.js +689 -0
- package/dist/component/server/domains/sso.js.map +1 -0
- package/dist/component/server/factory.d.ts +136 -0
- package/dist/component/server/factory.d.ts.map +1 -0
- package/dist/component/server/factory.js +1128 -0
- package/dist/component/server/factory.js.map +1 -0
- package/dist/component/server/fx.js +2 -1
- package/dist/component/server/fx.js.map +1 -1
- package/dist/component/server/http.js +287 -0
- package/dist/component/server/http.js.map +1 -0
- package/dist/component/server/identity.js +13 -0
- package/dist/component/server/identity.js.map +1 -0
- package/dist/component/server/keys.js +4 -0
- package/dist/component/server/keys.js.map +1 -1
- package/dist/component/server/mutations/account.js +1 -1
- package/dist/component/server/mutations/index.js +2 -2
- package/dist/component/server/mutations/index.js.map +1 -1
- package/dist/component/server/mutations/invalidate.js +1 -1
- package/dist/component/server/mutations/oauth.js +10 -7
- package/dist/component/server/mutations/oauth.js.map +1 -1
- package/dist/component/server/mutations/refresh.js +1 -1
- package/dist/component/server/mutations/register.js +1 -1
- package/dist/component/server/mutations/retrieve.js +1 -1
- package/dist/component/server/mutations/signature.js +1 -1
- package/dist/component/server/mutations/store.js +6 -3
- package/dist/component/server/mutations/store.js.map +1 -1
- package/dist/component/server/mutations/verify.js +1 -1
- package/dist/component/server/oauth.js +3 -0
- package/dist/component/server/oauth.js.map +1 -1
- package/dist/component/server/passkey.js +3 -2
- package/dist/component/server/passkey.js.map +1 -1
- package/dist/component/server/provider.js +2 -0
- package/dist/component/server/provider.js.map +1 -1
- package/dist/component/server/providers.js +3 -0
- package/dist/component/server/providers.js.map +1 -1
- package/dist/component/server/ratelimit.js +3 -0
- package/dist/component/server/ratelimit.js.map +1 -1
- package/dist/component/server/redirects.js +2 -0
- package/dist/component/server/redirects.js.map +1 -1
- package/dist/component/server/refresh.js +5 -0
- package/dist/component/server/refresh.js.map +1 -1
- package/dist/component/server/sessions.js +5 -0
- package/dist/component/server/sessions.js.map +1 -1
- package/dist/component/server/signin.js +2 -1
- package/dist/component/server/signin.js.map +1 -1
- package/dist/component/server/sso.js +166 -19
- package/dist/component/server/sso.js.map +1 -1
- package/dist/component/server/tokens.js +1 -0
- package/dist/component/server/tokens.js.map +1 -1
- package/dist/component/server/totp.js +4 -2
- package/dist/component/server/totp.js.map +1 -1
- package/dist/component/server/types.d.ts +50 -35
- package/dist/component/server/types.d.ts.map +1 -1
- package/dist/component/server/types.js.map +1 -1
- package/dist/component/server/users.js +1 -0
- package/dist/component/server/users.js.map +1 -1
- package/dist/component/server/utils.js +44 -2
- package/dist/component/server/utils.js.map +1 -1
- package/dist/providers/anonymous.d.ts +1 -1
- package/dist/providers/credentials.d.ts +1 -1
- package/dist/providers/password.d.ts +1 -1
- package/dist/providers/sso.d.ts +1 -1
- package/dist/providers/sso.js.map +1 -1
- package/dist/server/auth.d.ts +44 -9
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +70 -6
- package/dist/server/auth.js.map +1 -1
- package/dist/server/cookies.d.ts +1 -38
- package/dist/server/cookies.js +3 -0
- package/dist/server/cookies.js.map +1 -1
- package/dist/server/db.d.ts +1 -125
- package/dist/server/db.js +1 -0
- package/dist/server/db.js.map +1 -1
- package/dist/server/device.d.ts +1 -24
- package/dist/server/device.js +3 -1
- package/dist/server/device.js.map +1 -1
- package/dist/server/domains/core.d.ts +320 -0
- package/dist/server/domains/core.d.ts.map +1 -0
- package/dist/server/domains/core.js +466 -0
- package/dist/server/domains/core.js.map +1 -0
- package/dist/server/domains/sso.d.ts +340 -0
- package/dist/server/domains/sso.d.ts.map +1 -0
- package/dist/server/domains/sso.js +689 -0
- package/dist/server/domains/sso.js.map +1 -0
- package/dist/server/enterpriseValidators.d.ts +1 -0
- package/dist/server/enterpriseValidators.js +56 -0
- package/dist/server/enterpriseValidators.js.map +1 -0
- package/dist/server/factory.d.ts +136 -0
- package/dist/server/factory.d.ts.map +1 -0
- package/dist/server/factory.js +1128 -0
- package/dist/server/factory.js.map +1 -0
- package/dist/server/fx.d.ts +1 -16
- package/dist/server/fx.d.ts.map +1 -1
- package/dist/server/fx.js +1 -0
- package/dist/server/fx.js.map +1 -1
- package/dist/server/http.d.ts +59 -0
- package/dist/server/http.d.ts.map +1 -0
- package/dist/server/http.js +287 -0
- package/dist/server/http.js.map +1 -0
- package/dist/server/identity.d.ts +1 -0
- package/dist/server/identity.js +13 -0
- package/dist/server/identity.js.map +1 -0
- package/dist/server/index.d.ts +432 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +486 -36
- package/dist/server/index.js.map +1 -1
- package/dist/server/keys.d.ts +1 -57
- package/dist/server/keys.js +4 -0
- package/dist/server/keys.js.map +1 -1
- package/dist/server/mutations/account.d.ts +7 -7
- package/dist/server/mutations/account.d.ts.map +1 -1
- package/dist/server/mutations/code.d.ts +13 -13
- package/dist/server/mutations/index.d.ts +107 -107
- package/dist/server/mutations/index.d.ts.map +1 -1
- package/dist/server/mutations/index.js +1 -1
- package/dist/server/mutations/index.js.map +1 -1
- package/dist/server/mutations/invalidate.d.ts +5 -5
- package/dist/server/mutations/oauth.d.ts +10 -10
- package/dist/server/mutations/oauth.d.ts.map +1 -1
- package/dist/server/mutations/oauth.js +9 -6
- package/dist/server/mutations/oauth.js.map +1 -1
- package/dist/server/mutations/refresh.d.ts +4 -4
- package/dist/server/mutations/register.d.ts +12 -12
- package/dist/server/mutations/register.d.ts.map +1 -1
- package/dist/server/mutations/retrieve.d.ts +1 -1
- package/dist/server/mutations/signature.d.ts +5 -5
- package/dist/server/mutations/signature.d.ts.map +1 -1
- package/dist/server/mutations/signin.d.ts +1 -1
- package/dist/server/mutations/signout.d.ts +1 -1
- package/dist/server/mutations/store.d.ts +3 -2
- package/dist/server/mutations/store.d.ts.map +1 -1
- package/dist/server/mutations/store.js +6 -3
- package/dist/server/mutations/store.js.map +1 -1
- package/dist/server/mutations/verifier.d.ts +1 -1
- package/dist/server/mutations/verify.d.ts +4 -4
- package/dist/server/oauth.d.ts +1 -59
- package/dist/server/oauth.js +3 -0
- package/dist/server/oauth.js.map +1 -1
- package/dist/server/passkey.d.ts.map +1 -1
- package/dist/server/passkey.js +3 -2
- package/dist/server/passkey.js.map +1 -1
- package/dist/server/provider.d.ts +1 -14
- package/dist/server/provider.d.ts.map +1 -1
- package/dist/server/provider.js +2 -0
- package/dist/server/provider.js.map +1 -1
- package/dist/server/providers.js +3 -0
- package/dist/server/providers.js.map +1 -1
- package/dist/server/ratelimit.d.ts +1 -22
- package/dist/server/ratelimit.js +3 -0
- package/dist/server/ratelimit.js.map +1 -1
- package/dist/server/redirects.d.ts +1 -10
- package/dist/server/redirects.js +2 -0
- package/dist/server/redirects.js.map +1 -1
- package/dist/server/refresh.d.ts +1 -37
- package/dist/server/refresh.js +5 -0
- package/dist/server/refresh.js.map +1 -1
- package/dist/server/sessions.d.ts +1 -28
- package/dist/server/sessions.js +5 -0
- package/dist/server/sessions.js.map +1 -1
- package/dist/server/signin.d.ts +1 -55
- package/dist/server/signin.js +2 -1
- package/dist/server/signin.js.map +1 -1
- package/dist/server/sso.d.ts +1 -348
- package/dist/server/sso.js +165 -18
- package/dist/server/sso.js.map +1 -1
- package/dist/server/templates.d.ts +1 -21
- package/dist/server/templates.js +1 -0
- package/dist/server/templates.js.map +1 -1
- package/dist/server/tokens.d.ts +1 -11
- package/dist/server/tokens.js +1 -0
- package/dist/server/tokens.js.map +1 -1
- package/dist/server/totp.d.ts +1 -23
- package/dist/server/totp.js +4 -2
- package/dist/server/totp.js.map +1 -1
- package/dist/server/types.d.ts +55 -71
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/types.js.map +1 -1
- package/dist/server/users.d.ts +1 -31
- package/dist/server/users.js +1 -0
- package/dist/server/users.js.map +1 -1
- package/dist/server/utils.d.ts +1 -27
- package/dist/server/utils.js +44 -2
- package/dist/server/utils.js.map +1 -1
- package/dist/server/version.d.ts +1 -1
- package/dist/server/version.js +1 -1
- package/dist/server/version.js.map +1 -1
- package/package.json +4 -5
- package/src/cli/bin.ts +5 -0
- package/src/cli/index.ts +22 -9
- package/src/cli/keys.ts +3 -0
- package/src/client/index.ts +36 -37
- package/src/component/_generated/api.ts +14 -0
- package/src/component/_generated/component.ts +1920 -3
- package/src/component/index.ts +2 -0
- package/src/component/model.ts +424 -0
- package/src/component/public/enterprise.ts +654 -0
- package/src/component/public/factors.ts +332 -0
- package/src/component/public/groups.ts +951 -0
- package/src/component/public/identity.ts +566 -0
- package/src/component/public/keys.ts +209 -0
- package/src/component/public/shared.ts +117 -0
- package/src/component/public.ts +5 -2965
- package/src/component/schema.ts +47 -57
- package/src/providers/sso.ts +1 -1
- package/src/server/auth.ts +192 -9
- package/src/server/cookies.ts +3 -0
- package/src/server/db.ts +3 -0
- package/src/server/device.ts +3 -1
- package/src/server/domains/core.ts +916 -0
- package/src/server/domains/sso.ts +1462 -0
- package/src/server/enterpriseValidators.ts +88 -0
- package/src/server/factory.ts +2168 -0
- package/src/server/fx.ts +1 -0
- package/src/server/http.ts +529 -0
- package/src/server/identity.ts +18 -0
- package/src/server/index.ts +712 -40
- package/src/server/keys.ts +4 -0
- package/src/server/mutations/index.ts +1 -1
- package/src/server/mutations/oauth.ts +36 -8
- package/src/server/mutations/store.ts +6 -3
- package/src/server/oauth.ts +6 -0
- package/src/server/passkey.ts +3 -2
- package/src/server/provider.ts +2 -0
- package/src/server/providers.ts +3 -0
- package/src/server/ratelimit.ts +3 -0
- package/src/server/redirects.ts +2 -0
- package/src/server/refresh.ts +5 -0
- package/src/server/sessions.ts +5 -0
- package/src/server/signin.ts +1 -0
- package/src/server/sso.ts +251 -17
- package/src/server/templates.ts +1 -0
- package/src/server/tokens.ts +1 -0
- package/src/server/totp.ts +4 -2
- package/src/server/types.ts +85 -77
- package/src/server/users.ts +1 -0
- package/src/server/utils.ts +71 -1
- package/src/server/version.ts +1 -1
- package/dist/component/public.js.map +0 -1
- package/dist/component/server/implementation.d.ts +0 -1264
- package/dist/component/server/implementation.d.ts.map +0 -1
- package/dist/component/server/implementation.js +0 -2365
- package/dist/component/server/implementation.js.map +0 -1
- package/dist/server/cookies.d.ts.map +0 -1
- package/dist/server/db.d.ts.map +0 -1
- package/dist/server/device.d.ts.map +0 -1
- package/dist/server/implementation.d.ts +0 -1264
- package/dist/server/implementation.d.ts.map +0 -1
- package/dist/server/implementation.js +0 -2365
- package/dist/server/implementation.js.map +0 -1
- package/dist/server/keys.d.ts.map +0 -1
- package/dist/server/oauth.d.ts.map +0 -1
- package/dist/server/ratelimit.d.ts.map +0 -1
- package/dist/server/redirects.d.ts.map +0 -1
- package/dist/server/refresh.d.ts.map +0 -1
- package/dist/server/sessions.d.ts.map +0 -1
- package/dist/server/signin.d.ts.map +0 -1
- package/dist/server/sso.d.ts.map +0 -1
- package/dist/server/templates.d.ts.map +0 -1
- package/dist/server/tokens.d.ts.map +0 -1
- package/dist/server/totp.d.ts.map +0 -1
- package/dist/server/users.d.ts.map +0 -1
- package/dist/server/utils.d.ts.map +0 -1
- package/src/server/implementation.ts +0 -5336
package/dist/server/index.js
CHANGED
|
@@ -1,14 +1,464 @@
|
|
|
1
1
|
import { Fx } from "./fx.js";
|
|
2
2
|
import { isLocalHost } from "./utils.js";
|
|
3
|
-
import {
|
|
4
|
-
import { makeFunctionReference } from "convex/server";
|
|
3
|
+
import { enterpriseConnectionWhereValidator, enterpriseDomainInputValidator, enterprisePolicyPatchValidator, enterpriseSamlAttributeMappingValidator, enterpriseSamlSpValidator, enterpriseStatusValidator } from "./enterpriseValidators.js";
|
|
4
|
+
import { actionGeneric, makeFunctionReference, mutationGeneric, queryGeneric } from "convex/server";
|
|
5
|
+
import { ConvexError, v } from "convex/values";
|
|
5
6
|
import { parse, serialize } from "cookie";
|
|
6
7
|
import { ConvexHttpClient } from "convex/browser";
|
|
7
8
|
import { jwtDecode } from "jwt-decode";
|
|
8
9
|
|
|
9
10
|
//#region src/server/index.ts
|
|
10
|
-
const signInActionRef = makeFunctionReference("auth
|
|
11
|
-
const signOutActionRef = makeFunctionReference("auth
|
|
11
|
+
const signInActionRef = makeFunctionReference("auth:signIn");
|
|
12
|
+
const signOutActionRef = makeFunctionReference("auth:signOut");
|
|
13
|
+
function requireSignedInUser(auth) {
|
|
14
|
+
return async (ctx) => {
|
|
15
|
+
return await auth.user.require(ctx);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
async function resolveMountedEnterpriseTarget(auth, ctx, target) {
|
|
19
|
+
if (target.groupId !== void 0) return {
|
|
20
|
+
enterpriseId: target.enterpriseId,
|
|
21
|
+
groupId: target.groupId,
|
|
22
|
+
resolvedGroupId: target.groupId
|
|
23
|
+
};
|
|
24
|
+
if (target.enterpriseId !== void 0) {
|
|
25
|
+
const enterprise = await auth.sso.admin.connection.get(ctx, target.enterpriseId);
|
|
26
|
+
if (enterprise === null) throw new ConvexError({
|
|
27
|
+
code: "INVALID_PARAMETERS",
|
|
28
|
+
message: "Enterprise not found."
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
enterpriseId: enterprise._id,
|
|
32
|
+
groupId: enterprise.groupId,
|
|
33
|
+
resolvedGroupId: enterprise.groupId
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (target.domain !== void 0) {
|
|
37
|
+
const resolved = await auth.sso.admin.connection.getByDomain(ctx, target.domain);
|
|
38
|
+
if (resolved?.enterprise === void 0) throw new ConvexError({
|
|
39
|
+
code: "INVALID_PARAMETERS",
|
|
40
|
+
message: "Enterprise not found."
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
enterpriseId: resolved.enterprise._id,
|
|
44
|
+
groupId: resolved.enterprise.groupId,
|
|
45
|
+
resolvedGroupId: resolved.enterprise.groupId
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
enterpriseId: void 0,
|
|
50
|
+
groupId: void 0,
|
|
51
|
+
resolvedGroupId: null
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function createMountedAdminAuthorizer(auth, options) {
|
|
55
|
+
const requireUserId = requireSignedInUser(auth);
|
|
56
|
+
return async (ctx, permission, target = {}) => {
|
|
57
|
+
const userId = await requireUserId(ctx);
|
|
58
|
+
if (!options?.authorized) throw new ConvexError({
|
|
59
|
+
code: "FORBIDDEN",
|
|
60
|
+
message: "Mounted enterprise admin APIs require an authorized callback."
|
|
61
|
+
});
|
|
62
|
+
const resolved = await resolveMountedEnterpriseTarget(auth, ctx, target);
|
|
63
|
+
await options.authorized(ctx, {
|
|
64
|
+
userId,
|
|
65
|
+
permission,
|
|
66
|
+
enterpriseId: resolved.enterpriseId,
|
|
67
|
+
groupId: resolved.groupId,
|
|
68
|
+
resolvedGroupId: resolved.resolvedGroupId
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
userId,
|
|
72
|
+
...resolved
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Build optional public SSO management actions that apps can mount under
|
|
78
|
+
* `convex/auth/sso/**` when they want client-callable enterprise APIs.
|
|
79
|
+
*
|
|
80
|
+
* `admin` is for tenant-admin control-plane operations and should be mounted
|
|
81
|
+
* with an explicit authorization policy. `client` is for end-user sign-in
|
|
82
|
+
* helpers and does not require tenant-admin authorization.
|
|
83
|
+
*/
|
|
84
|
+
function sso(auth, options) {
|
|
85
|
+
const authorize = createMountedAdminAuthorizer(auth, options);
|
|
86
|
+
return {
|
|
87
|
+
admin: {
|
|
88
|
+
connection: {
|
|
89
|
+
create: mutationGeneric({
|
|
90
|
+
args: {
|
|
91
|
+
groupId: v.optional(v.string()),
|
|
92
|
+
name: v.optional(v.string()),
|
|
93
|
+
slug: v.optional(v.string()),
|
|
94
|
+
status: v.optional(enterpriseStatusValidator),
|
|
95
|
+
domain: v.optional(v.string())
|
|
96
|
+
},
|
|
97
|
+
handler: async (ctx, args) => {
|
|
98
|
+
const { userId } = await authorize(ctx, "sso.connection.create", { groupId: args.groupId });
|
|
99
|
+
const createsGroup = args.groupId === void 0;
|
|
100
|
+
const groupId = args.groupId ?? await auth.group.create(ctx, {
|
|
101
|
+
name: args.name?.trim() || args.slug?.trim() || "Enterprise",
|
|
102
|
+
slug: args.slug,
|
|
103
|
+
type: "enterprise"
|
|
104
|
+
});
|
|
105
|
+
if (createsGroup) await auth.member.add(ctx, {
|
|
106
|
+
groupId,
|
|
107
|
+
userId,
|
|
108
|
+
role: "admin"
|
|
109
|
+
});
|
|
110
|
+
const enterpriseId = await auth.sso.admin.connection.create(ctx, {
|
|
111
|
+
groupId,
|
|
112
|
+
name: args.name,
|
|
113
|
+
slug: args.slug,
|
|
114
|
+
status: args.status
|
|
115
|
+
});
|
|
116
|
+
if (args.domain) await auth.sso.admin.connection.domain.set(ctx, enterpriseId, [{
|
|
117
|
+
domain: args.domain,
|
|
118
|
+
isPrimary: true
|
|
119
|
+
}]);
|
|
120
|
+
return {
|
|
121
|
+
enterpriseId,
|
|
122
|
+
groupId
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}),
|
|
126
|
+
get: queryGeneric({
|
|
127
|
+
args: { enterpriseId: v.string() },
|
|
128
|
+
handler: async (ctx, args) => {
|
|
129
|
+
await authorize(ctx, "sso.connection.read", { enterpriseId: args.enterpriseId });
|
|
130
|
+
return await auth.sso.admin.connection.get(ctx, args.enterpriseId);
|
|
131
|
+
}
|
|
132
|
+
}),
|
|
133
|
+
getByGroup: queryGeneric({
|
|
134
|
+
args: { groupId: v.string() },
|
|
135
|
+
handler: async (ctx, args) => {
|
|
136
|
+
await authorize(ctx, "sso.connection.read", { groupId: args.groupId });
|
|
137
|
+
return await auth.sso.admin.connection.getByGroup(ctx, args.groupId);
|
|
138
|
+
}
|
|
139
|
+
}),
|
|
140
|
+
getByDomain: queryGeneric({
|
|
141
|
+
args: { domain: v.string() },
|
|
142
|
+
handler: async (ctx, args) => {
|
|
143
|
+
await authorize(ctx, "sso.connection.read", { domain: args.domain });
|
|
144
|
+
return await auth.sso.admin.connection.getByDomain(ctx, args.domain);
|
|
145
|
+
}
|
|
146
|
+
}),
|
|
147
|
+
list: queryGeneric({
|
|
148
|
+
args: {
|
|
149
|
+
where: v.optional(enterpriseConnectionWhereValidator),
|
|
150
|
+
limit: v.optional(v.number()),
|
|
151
|
+
cursor: v.optional(v.union(v.string(), v.null())),
|
|
152
|
+
orderBy: v.optional(v.string()),
|
|
153
|
+
order: v.optional(v.union(v.literal("asc"), v.literal("desc")))
|
|
154
|
+
},
|
|
155
|
+
handler: async (ctx, args) => {
|
|
156
|
+
await authorize(ctx, "sso.connection.read", { groupId: args.where?.groupId });
|
|
157
|
+
return await auth.sso.admin.connection.list(ctx, args);
|
|
158
|
+
}
|
|
159
|
+
}),
|
|
160
|
+
update: mutationGeneric({
|
|
161
|
+
args: {
|
|
162
|
+
enterpriseId: v.string(),
|
|
163
|
+
data: v.object({
|
|
164
|
+
name: v.optional(v.string()),
|
|
165
|
+
slug: v.optional(v.string()),
|
|
166
|
+
status: v.optional(enterpriseStatusValidator)
|
|
167
|
+
})
|
|
168
|
+
},
|
|
169
|
+
handler: async (ctx, args) => {
|
|
170
|
+
await authorize(ctx, "sso.connection.manage", { enterpriseId: args.enterpriseId });
|
|
171
|
+
await auth.sso.admin.connection.update(ctx, args.enterpriseId, args.data);
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
}),
|
|
175
|
+
delete: mutationGeneric({
|
|
176
|
+
args: { enterpriseId: v.string() },
|
|
177
|
+
handler: async (ctx, args) => {
|
|
178
|
+
await authorize(ctx, "sso.connection.manage", { enterpriseId: args.enterpriseId });
|
|
179
|
+
await auth.sso.admin.connection.delete(ctx, args.enterpriseId);
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
}),
|
|
183
|
+
status: queryGeneric({
|
|
184
|
+
args: { enterpriseId: v.string() },
|
|
185
|
+
handler: async (ctx, args) => {
|
|
186
|
+
await authorize(ctx, "sso.connection.read", { enterpriseId: args.enterpriseId });
|
|
187
|
+
return await auth.sso.admin.connection.status(ctx, args.enterpriseId);
|
|
188
|
+
}
|
|
189
|
+
}),
|
|
190
|
+
domain: {
|
|
191
|
+
list: queryGeneric({
|
|
192
|
+
args: { enterpriseId: v.string() },
|
|
193
|
+
handler: async (ctx, args) => {
|
|
194
|
+
await authorize(ctx, "sso.connection.read", { enterpriseId: args.enterpriseId });
|
|
195
|
+
return await auth.sso.admin.connection.domain.list(ctx, args.enterpriseId);
|
|
196
|
+
}
|
|
197
|
+
}),
|
|
198
|
+
validate: queryGeneric({
|
|
199
|
+
args: { enterpriseId: v.string() },
|
|
200
|
+
handler: async (ctx, args) => {
|
|
201
|
+
await authorize(ctx, "sso.domain.manage", { enterpriseId: args.enterpriseId });
|
|
202
|
+
return await auth.sso.admin.connection.domain.validate(ctx, args.enterpriseId);
|
|
203
|
+
}
|
|
204
|
+
}),
|
|
205
|
+
set: mutationGeneric({
|
|
206
|
+
args: {
|
|
207
|
+
enterpriseId: v.string(),
|
|
208
|
+
domains: v.array(enterpriseDomainInputValidator)
|
|
209
|
+
},
|
|
210
|
+
handler: async (ctx, args) => {
|
|
211
|
+
await authorize(ctx, "sso.domain.manage", { enterpriseId: args.enterpriseId });
|
|
212
|
+
await auth.sso.admin.connection.domain.set(ctx, args.enterpriseId, args.domains);
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
})
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
oidc: {
|
|
219
|
+
configure: mutationGeneric({
|
|
220
|
+
args: {
|
|
221
|
+
enterpriseId: v.string(),
|
|
222
|
+
issuer: v.optional(v.string()),
|
|
223
|
+
discoveryUrl: v.optional(v.string()),
|
|
224
|
+
clientId: v.string(),
|
|
225
|
+
clientSecret: v.optional(v.string()),
|
|
226
|
+
scopes: v.optional(v.array(v.string())),
|
|
227
|
+
authorizationParams: v.optional(v.record(v.string(), v.string())),
|
|
228
|
+
clockToleranceSeconds: v.optional(v.number()),
|
|
229
|
+
strictIssuer: v.optional(v.boolean()),
|
|
230
|
+
extraFields: v.optional(v.record(v.string(), v.string()))
|
|
231
|
+
},
|
|
232
|
+
handler: async (ctx, args) => {
|
|
233
|
+
await authorize(ctx, "sso.protocol.manage", { enterpriseId: args.enterpriseId });
|
|
234
|
+
return await auth.sso.admin.oidc.configure(ctx, args);
|
|
235
|
+
}
|
|
236
|
+
}),
|
|
237
|
+
get: queryGeneric({
|
|
238
|
+
args: { enterpriseId: v.string() },
|
|
239
|
+
handler: async (ctx, args) => {
|
|
240
|
+
await authorize(ctx, "sso.connection.read", { enterpriseId: args.enterpriseId });
|
|
241
|
+
return await auth.sso.admin.oidc.get(ctx, args.enterpriseId);
|
|
242
|
+
}
|
|
243
|
+
}),
|
|
244
|
+
validate: actionGeneric({
|
|
245
|
+
args: { enterpriseId: v.string() },
|
|
246
|
+
handler: async (ctx, args) => {
|
|
247
|
+
await authorize(ctx, "sso.protocol.manage", { enterpriseId: args.enterpriseId });
|
|
248
|
+
return await auth.sso.admin.oidc.validate(ctx, args.enterpriseId);
|
|
249
|
+
}
|
|
250
|
+
})
|
|
251
|
+
},
|
|
252
|
+
saml: {
|
|
253
|
+
configure: actionGeneric({
|
|
254
|
+
args: {
|
|
255
|
+
enterpriseId: v.string(),
|
|
256
|
+
metadataXml: v.optional(v.string()),
|
|
257
|
+
metadataUrl: v.optional(v.string()),
|
|
258
|
+
domains: v.optional(v.array(v.string())),
|
|
259
|
+
signAuthnRequests: v.optional(v.boolean()),
|
|
260
|
+
attributeMapping: v.optional(enterpriseSamlAttributeMappingValidator),
|
|
261
|
+
sp: v.optional(enterpriseSamlSpValidator)
|
|
262
|
+
},
|
|
263
|
+
handler: async (ctx, args) => {
|
|
264
|
+
await authorize(ctx, "sso.protocol.manage", { enterpriseId: args.enterpriseId });
|
|
265
|
+
return await auth.sso.admin.saml.configure(ctx, args);
|
|
266
|
+
}
|
|
267
|
+
}),
|
|
268
|
+
validate: queryGeneric({
|
|
269
|
+
args: { enterpriseId: v.string() },
|
|
270
|
+
handler: async (ctx, args) => {
|
|
271
|
+
await authorize(ctx, "sso.protocol.manage", { enterpriseId: args.enterpriseId });
|
|
272
|
+
return await auth.sso.admin.saml.validate(ctx, args.enterpriseId);
|
|
273
|
+
}
|
|
274
|
+
})
|
|
275
|
+
},
|
|
276
|
+
policy: {
|
|
277
|
+
get: queryGeneric({
|
|
278
|
+
args: { enterpriseId: v.string() },
|
|
279
|
+
handler: async (ctx, args) => {
|
|
280
|
+
await authorize(ctx, "sso.connection.read", { enterpriseId: args.enterpriseId });
|
|
281
|
+
return await auth.sso.admin.policy.get(ctx, args.enterpriseId);
|
|
282
|
+
}
|
|
283
|
+
}),
|
|
284
|
+
update: mutationGeneric({
|
|
285
|
+
args: {
|
|
286
|
+
enterpriseId: v.string(),
|
|
287
|
+
patch: enterprisePolicyPatchValidator
|
|
288
|
+
},
|
|
289
|
+
handler: async (ctx, args) => {
|
|
290
|
+
await authorize(ctx, "sso.policy.manage", { enterpriseId: args.enterpriseId });
|
|
291
|
+
return await auth.sso.admin.policy.update(ctx, args.enterpriseId, args.patch);
|
|
292
|
+
}
|
|
293
|
+
}),
|
|
294
|
+
validate: queryGeneric({
|
|
295
|
+
args: { enterpriseId: v.string() },
|
|
296
|
+
handler: async (ctx, args) => {
|
|
297
|
+
await authorize(ctx, "sso.policy.manage", { enterpriseId: args.enterpriseId });
|
|
298
|
+
return await auth.sso.admin.policy.validate(ctx, args.enterpriseId);
|
|
299
|
+
}
|
|
300
|
+
})
|
|
301
|
+
},
|
|
302
|
+
audit: { list: queryGeneric({
|
|
303
|
+
args: {
|
|
304
|
+
enterpriseId: v.optional(v.string()),
|
|
305
|
+
groupId: v.optional(v.string()),
|
|
306
|
+
limit: v.optional(v.number())
|
|
307
|
+
},
|
|
308
|
+
handler: async (ctx, args) => {
|
|
309
|
+
await authorize(ctx, "sso.audit.read", {
|
|
310
|
+
enterpriseId: args.enterpriseId,
|
|
311
|
+
groupId: args.groupId
|
|
312
|
+
});
|
|
313
|
+
return await auth.sso.admin.audit.list(ctx, args);
|
|
314
|
+
}
|
|
315
|
+
}) },
|
|
316
|
+
webhook: { endpoint: {
|
|
317
|
+
create: mutationGeneric({
|
|
318
|
+
args: {
|
|
319
|
+
enterpriseId: v.string(),
|
|
320
|
+
url: v.string(),
|
|
321
|
+
secret: v.string(),
|
|
322
|
+
subscriptions: v.array(v.string()),
|
|
323
|
+
createdByUserId: v.optional(v.string())
|
|
324
|
+
},
|
|
325
|
+
handler: async (ctx, args) => {
|
|
326
|
+
const { userId } = await authorize(ctx, "sso.webhook.manage", { enterpriseId: args.enterpriseId });
|
|
327
|
+
return {
|
|
328
|
+
_id: (await auth.sso.admin.webhook.endpoint.create(ctx, {
|
|
329
|
+
...args,
|
|
330
|
+
createdByUserId: args.createdByUserId ?? userId
|
|
331
|
+
})).endpointId,
|
|
332
|
+
enterpriseId: args.enterpriseId,
|
|
333
|
+
url: args.url,
|
|
334
|
+
subscriptions: args.subscriptions,
|
|
335
|
+
createdByUserId: args.createdByUserId ?? userId,
|
|
336
|
+
status: "active",
|
|
337
|
+
failureCount: 0
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
}),
|
|
341
|
+
list: queryGeneric({
|
|
342
|
+
args: { enterpriseId: v.string() },
|
|
343
|
+
handler: async (ctx, args) => {
|
|
344
|
+
await authorize(ctx, "sso.webhook.manage", { enterpriseId: args.enterpriseId });
|
|
345
|
+
return (await auth.sso.admin.webhook.endpoint.list(ctx, args.enterpriseId)).map((endpoint) => {
|
|
346
|
+
const { secretHash: _secretHash, ...rest } = endpoint;
|
|
347
|
+
return rest;
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
}),
|
|
351
|
+
disable: mutationGeneric({
|
|
352
|
+
args: { endpointId: v.string() },
|
|
353
|
+
handler: async (ctx, args) => {
|
|
354
|
+
await authorize(ctx, "sso.webhook.manage");
|
|
355
|
+
await auth.sso.admin.webhook.endpoint.disable(ctx, args.endpointId);
|
|
356
|
+
return null;
|
|
357
|
+
}
|
|
358
|
+
})
|
|
359
|
+
} }
|
|
360
|
+
},
|
|
361
|
+
client: {
|
|
362
|
+
signIn: queryGeneric({
|
|
363
|
+
args: {
|
|
364
|
+
enterpriseId: v.optional(v.string()),
|
|
365
|
+
email: v.optional(v.string()),
|
|
366
|
+
domain: v.optional(v.string()),
|
|
367
|
+
redirectTo: v.optional(v.string())
|
|
368
|
+
},
|
|
369
|
+
handler: async (ctx, args) => {
|
|
370
|
+
return await auth.sso.client.signIn(ctx, args);
|
|
371
|
+
}
|
|
372
|
+
}),
|
|
373
|
+
metadata: queryGeneric({
|
|
374
|
+
args: {
|
|
375
|
+
enterpriseId: v.string(),
|
|
376
|
+
entityId: v.optional(v.string()),
|
|
377
|
+
acsUrl: v.optional(v.string()),
|
|
378
|
+
sloUrl: v.optional(v.string())
|
|
379
|
+
},
|
|
380
|
+
handler: async (ctx, args) => {
|
|
381
|
+
return await auth.sso.client.metadata(ctx, args);
|
|
382
|
+
}
|
|
383
|
+
})
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Build optional public SCIM management actions that apps can mount under
|
|
389
|
+
* `convex/auth/scim/**` when they want client-callable enterprise admin APIs.
|
|
390
|
+
*/
|
|
391
|
+
function scim(auth, options) {
|
|
392
|
+
const authorize = createMountedAdminAuthorizer(auth, options);
|
|
393
|
+
return { admin: {
|
|
394
|
+
configure: mutationGeneric({
|
|
395
|
+
args: {
|
|
396
|
+
enterpriseId: v.string(),
|
|
397
|
+
basePath: v.optional(v.string()),
|
|
398
|
+
status: v.optional(enterpriseStatusValidator)
|
|
399
|
+
},
|
|
400
|
+
handler: async (ctx, args) => {
|
|
401
|
+
await authorize(ctx, "scim.manage", { enterpriseId: args.enterpriseId });
|
|
402
|
+
return await auth.scim.admin.configure(ctx, args);
|
|
403
|
+
}
|
|
404
|
+
}),
|
|
405
|
+
get: queryGeneric({
|
|
406
|
+
args: { enterpriseId: v.string() },
|
|
407
|
+
handler: async (ctx, args) => {
|
|
408
|
+
await authorize(ctx, "scim.manage", { enterpriseId: args.enterpriseId });
|
|
409
|
+
return await auth.scim.admin.get(ctx, args.enterpriseId);
|
|
410
|
+
}
|
|
411
|
+
}),
|
|
412
|
+
validate: queryGeneric({
|
|
413
|
+
args: { enterpriseId: v.string() },
|
|
414
|
+
handler: async (ctx, args) => {
|
|
415
|
+
await authorize(ctx, "scim.manage", { enterpriseId: args.enterpriseId });
|
|
416
|
+
return await auth.scim.admin.validate(ctx, args.enterpriseId);
|
|
417
|
+
}
|
|
418
|
+
})
|
|
419
|
+
} };
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Build a flat mounted enterprise API surface for app-owned Convex exports.
|
|
423
|
+
*
|
|
424
|
+
* The returned object contains tenant-admin SSO and SCIM control-plane
|
|
425
|
+
* functions plus end-user enterprise sign-in helpers. The `authorized`
|
|
426
|
+
* callback is required for admin operations.
|
|
427
|
+
*/
|
|
428
|
+
function enterprise(auth, options) {
|
|
429
|
+
const mountedSso = sso(auth, { authorized: options.authorized });
|
|
430
|
+
const mountedScim = scim(auth, { authorized: options.authorized });
|
|
431
|
+
return {
|
|
432
|
+
createConnection: mountedSso.admin.connection.create,
|
|
433
|
+
getConnection: mountedSso.admin.connection.get,
|
|
434
|
+
getConnectionByGroup: mountedSso.admin.connection.getByGroup,
|
|
435
|
+
getConnectionByDomain: mountedSso.admin.connection.getByDomain,
|
|
436
|
+
listConnections: mountedSso.admin.connection.list,
|
|
437
|
+
updateConnection: mountedSso.admin.connection.update,
|
|
438
|
+
deleteConnection: mountedSso.admin.connection.delete,
|
|
439
|
+
getConnectionStatus: mountedSso.admin.connection.status,
|
|
440
|
+
listDomains: mountedSso.admin.connection.domain.list,
|
|
441
|
+
validateDomains: mountedSso.admin.connection.domain.validate,
|
|
442
|
+
setDomains: mountedSso.admin.connection.domain.set,
|
|
443
|
+
configureOidc: mountedSso.admin.oidc.configure,
|
|
444
|
+
getOidc: mountedSso.admin.oidc.get,
|
|
445
|
+
validateOidc: mountedSso.admin.oidc.validate,
|
|
446
|
+
configureSaml: mountedSso.admin.saml.configure,
|
|
447
|
+
validateSaml: mountedSso.admin.saml.validate,
|
|
448
|
+
getPolicy: mountedSso.admin.policy.get,
|
|
449
|
+
updatePolicy: mountedSso.admin.policy.update,
|
|
450
|
+
validatePolicy: mountedSso.admin.policy.validate,
|
|
451
|
+
listAudit: mountedSso.admin.audit.list,
|
|
452
|
+
createWebhookEndpoint: mountedSso.admin.webhook.endpoint.create,
|
|
453
|
+
listWebhookEndpoints: mountedSso.admin.webhook.endpoint.list,
|
|
454
|
+
disableWebhookEndpoint: mountedSso.admin.webhook.endpoint.disable,
|
|
455
|
+
configureScim: mountedScim.admin.configure,
|
|
456
|
+
getScim: mountedScim.admin.get,
|
|
457
|
+
validateScim: mountedScim.admin.validate,
|
|
458
|
+
signIn: mountedSso.client.signIn,
|
|
459
|
+
metadata: mountedSso.client.metadata
|
|
460
|
+
};
|
|
461
|
+
}
|
|
12
462
|
const TOKEN_COOKIE_BASE_NAME = "__convexAuthJWT";
|
|
13
463
|
const REFRESH_COOKIE_BASE_NAME = "__convexAuthRefreshToken";
|
|
14
464
|
const VERIFIER_COOKIE_BASE_NAME = "__convexAuthOAuthVerifier";
|
|
@@ -316,7 +766,7 @@ function server(options) {
|
|
|
316
766
|
if (body === null) return new Response("Invalid request body", { status: 400 });
|
|
317
767
|
const action = body.action;
|
|
318
768
|
const args = typeof body.args === "object" && body.args !== null ? body.args : {};
|
|
319
|
-
const actionDispatch = action === "auth
|
|
769
|
+
const actionDispatch = action === "auth:signIn" ? { action: "sessionStart" } : action === "auth:signOut" ? { action: "sessionStop" } : null;
|
|
320
770
|
if (actionDispatch === null) return new Response("Invalid action", { status: 400 });
|
|
321
771
|
const host = request.headers.get("host") ?? new URL(request.url).host;
|
|
322
772
|
const currentCookies = parseAuthCookies(request.headers.get("cookie"), host, cookieNamespace);
|
|
@@ -476,12 +926,12 @@ function server(options) {
|
|
|
476
926
|
const refreshed = await new ConvexHttpClient(convexUrl).action(signInActionRef, { refreshToken });
|
|
477
927
|
const refreshedTokens = await Fx.run(Fx.match(refreshed, refreshed.kind, {
|
|
478
928
|
signedIn: (signedInResult) => Fx.succeed(signedInResult.tokens),
|
|
479
|
-
redirect: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
480
|
-
started: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
481
|
-
passkeyOptions: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
482
|
-
totpRequired: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
483
|
-
totpSetup: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
484
|
-
deviceCode: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
929
|
+
redirect: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for sign-out fallback refresh")),
|
|
930
|
+
started: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for sign-out fallback refresh")),
|
|
931
|
+
passkeyOptions: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for sign-out fallback refresh")),
|
|
932
|
+
totpRequired: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for sign-out fallback refresh")),
|
|
933
|
+
totpSetup: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for sign-out fallback refresh")),
|
|
934
|
+
deviceCode: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for sign-out fallback refresh"))
|
|
485
935
|
}));
|
|
486
936
|
const fallbackSignOutDispatch = refreshedTokens !== null ? {
|
|
487
937
|
kind: "signOutWithRefreshed",
|
|
@@ -563,12 +1013,12 @@ function server(options) {
|
|
|
563
1013
|
kind: "signedIn",
|
|
564
1014
|
tokens: await Fx.run(Fx.match(result, result.kind, {
|
|
565
1015
|
signedIn: (signedInResult) => Fx.succeed(signedInResult.tokens),
|
|
566
|
-
redirect: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
567
|
-
started: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
568
|
-
passkeyOptions: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
569
|
-
totpRequired: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
570
|
-
totpSetup: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
571
|
-
deviceCode: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
1016
|
+
redirect: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for code exchange")),
|
|
1017
|
+
started: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for code exchange")),
|
|
1018
|
+
passkeyOptions: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for code exchange")),
|
|
1019
|
+
totpRequired: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for code exchange")),
|
|
1020
|
+
totpSetup: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for code exchange")),
|
|
1021
|
+
deviceCode: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for code exchange"))
|
|
572
1022
|
}))
|
|
573
1023
|
};
|
|
574
1024
|
},
|
|
@@ -661,12 +1111,12 @@ function server(options) {
|
|
|
661
1111
|
const result = await new ConvexHttpClient(convexUrl).action(signInActionRef, { refreshToken: refreshTokenValue });
|
|
662
1112
|
const tokens$1 = await Fx.run(Fx.match(result, result.kind, {
|
|
663
1113
|
signedIn: (signedInResult) => Fx.succeed(signedInResult.tokens),
|
|
664
|
-
redirect: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
665
|
-
started: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
666
|
-
passkeyOptions: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
667
|
-
totpRequired: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
668
|
-
totpSetup: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
669
|
-
deviceCode: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
1114
|
+
redirect: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh")),
|
|
1115
|
+
started: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh")),
|
|
1116
|
+
passkeyOptions: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh")),
|
|
1117
|
+
totpRequired: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh")),
|
|
1118
|
+
totpSetup: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh")),
|
|
1119
|
+
deviceCode: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh"))
|
|
670
1120
|
}));
|
|
671
1121
|
if (verbose) console.debug(`${(/* @__PURE__ */ new Date()).toISOString()} [convex-auth/server] Refreshed tokens, null=${tokens$1 === null}`);
|
|
672
1122
|
return tokens$1;
|
|
@@ -708,12 +1158,12 @@ function server(options) {
|
|
|
708
1158
|
const result = await new ConvexHttpClient(convexUrl).action(signInActionRef, { refreshToken: refreshTokenValue });
|
|
709
1159
|
const tokens$1 = await Fx.run(Fx.match(result, result.kind, {
|
|
710
1160
|
signedIn: (signedInResult) => Fx.succeed(signedInResult.tokens),
|
|
711
|
-
redirect: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
712
|
-
started: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
713
|
-
passkeyOptions: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
714
|
-
totpRequired: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
715
|
-
totpSetup: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
716
|
-
deviceCode: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
1161
|
+
redirect: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh")),
|
|
1162
|
+
started: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh")),
|
|
1163
|
+
passkeyOptions: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh")),
|
|
1164
|
+
totpRequired: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh")),
|
|
1165
|
+
totpSetup: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh")),
|
|
1166
|
+
deviceCode: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh"))
|
|
717
1167
|
}));
|
|
718
1168
|
if (verbose) console.debug(`${(/* @__PURE__ */ new Date()).toISOString()} [convex-auth/server] Refreshed tokens, null=${tokens$1 === null}`);
|
|
719
1169
|
return tokens$1;
|
|
@@ -743,12 +1193,12 @@ function server(options) {
|
|
|
743
1193
|
const result = await new ConvexHttpClient(convexUrl).action(signInActionRef, { refreshToken: refreshTokenValue });
|
|
744
1194
|
const tokens$1 = await Fx.run(Fx.match(result, result.kind, {
|
|
745
1195
|
signedIn: (signedInResult) => Fx.succeed(signedInResult.tokens),
|
|
746
|
-
redirect: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
747
|
-
started: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
748
|
-
passkeyOptions: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
749
|
-
totpRequired: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
750
|
-
totpSetup: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
751
|
-
deviceCode: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth
|
|
1196
|
+
redirect: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh")),
|
|
1197
|
+
started: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh")),
|
|
1198
|
+
passkeyOptions: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh")),
|
|
1199
|
+
totpRequired: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh")),
|
|
1200
|
+
totpSetup: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh")),
|
|
1201
|
+
deviceCode: () => Fx.fatal(/* @__PURE__ */ new Error("Invalid `auth:signIn` result for token refresh"))
|
|
752
1202
|
}));
|
|
753
1203
|
if (verbose) console.debug(`${(/* @__PURE__ */ new Date()).toISOString()} [convex-auth/server] Refreshed tokens, null=${tokens$1 === null}`);
|
|
754
1204
|
return tokens$1;
|
|
@@ -786,5 +1236,5 @@ function server(options) {
|
|
|
786
1236
|
}
|
|
787
1237
|
|
|
788
1238
|
//#endregion
|
|
789
|
-
export { authCookieNames, parseAuthCookies, serializeAuthCookies, server, shouldProxyAuthAction, structuredAuthCookies };
|
|
1239
|
+
export { authCookieNames, enterprise, parseAuthCookies, scim, serializeAuthCookies, server, shouldProxyAuthAction, sso, structuredAuthCookies };
|
|
790
1240
|
//# sourceMappingURL=index.js.map
|