@absolutejs/auth 0.26.0-beta.2 → 0.26.0-beta.4
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/dist/audit/config.d.ts +2 -1
- package/dist/audit/types.d.ts +1 -1
- package/dist/authorization/config.d.ts +19 -0
- package/dist/authorization/protectPermission.d.ts +52 -0
- package/dist/compliance/cipher.d.ts +5 -0
- package/dist/compliance/config.d.ts +18 -0
- package/dist/compliance/redaction.d.ts +8 -0
- package/dist/compliance/routes.d.ts +89 -0
- package/dist/htmx/index.js +494 -98
- package/dist/htmx/index.js.map +3 -3
- package/dist/index.d.ts +7578 -430
- package/dist/index.js +4601 -1490
- package/dist/index.js.map +50 -13
- package/dist/organizations/config.d.ts +46 -0
- package/dist/organizations/inMemoryOrganizationStore.d.ts +2 -0
- package/dist/organizations/operations.d.ts +32 -0
- package/dist/organizations/postgresOrganizationStore.d.ts +412 -0
- package/dist/organizations/routes.d.ts +299 -0
- package/dist/organizations/types.d.ts +44 -0
- package/dist/passwordless/config.d.ts +42 -0
- package/dist/passwordless/inMemoryPasswordlessTokenStore.d.ts +2 -0
- package/dist/passwordless/postgresPasswordlessTokenStore.d.ts +66 -0
- package/dist/passwordless/routes.d.ts +163 -0
- package/dist/passwordless/types.d.ts +9 -0
- package/dist/providers/clients.d.ts +3 -3
- package/dist/roles/config.d.ts +27 -0
- package/dist/roles/inMemoryRoleStore.d.ts +2 -0
- package/dist/roles/operations.d.ts +8 -0
- package/dist/roles/postgresRoleStore.d.ts +102 -0
- package/dist/roles/resolver.d.ts +17 -0
- package/dist/roles/routes.d.ts +106 -0
- package/dist/roles/types.d.ts +14 -0
- package/dist/routes/authorize.d.ts +2 -2
- package/dist/routes/protectRoute.d.ts +2 -2
- package/dist/scim/config.d.ts +55 -0
- package/dist/scim/inMemoryScimTokenStore.d.ts +2 -0
- package/dist/scim/postgresScimTokenStore.d.ts +102 -0
- package/dist/scim/routes.d.ts +296 -0
- package/dist/scim/serialize.d.ts +45 -0
- package/dist/scim/types.d.ts +52 -0
- package/dist/session/promote.d.ts +9 -2
- package/dist/sso/config.d.ts +104 -0
- package/dist/sso/discoveryRoute.d.ts +63 -0
- package/dist/sso/inMemorySsoConnectionStore.d.ts +2 -0
- package/dist/sso/oidcRoutes.d.ts +97 -0
- package/dist/sso/postgresSsoConnectionStore.d.ts +139 -0
- package/dist/sso/samlRoutes.d.ts +176 -0
- package/dist/sso/types.d.ts +39 -0
- package/dist/typebox.d.ts +1 -1
- package/dist/types.d.ts +59 -0
- package/dist/webauthn/adapter.d.ts +59 -0
- package/dist/webauthn/config.d.ts +35 -0
- package/dist/webauthn/inMemoryWebAuthnCredentialStore.d.ts +2 -0
- package/dist/webauthn/postgresWebAuthnCredentialStore.d.ts +172 -0
- package/dist/webauthn/routes.d.ts +155 -0
- package/dist/webauthn/types.d.ts +17 -0
- package/dist/webhooks/config.d.ts +21 -0
- package/dist/webhooks/dispatcher.d.ts +3 -0
- package/dist/webhooks/sign.d.ts +11 -0
- package/dist/webhooks/types.d.ts +11 -0
- package/package.json +2 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AuditEmitter } from '../audit/config';
|
|
2
|
+
import type { OrganizationMembership, OrganizationStore } from '../organizations/types';
|
|
3
|
+
import type { AuthSessionStore } from '../session/types';
|
|
4
|
+
import type { OrganizationId } from '../tenancy';
|
|
5
|
+
import type { RouteString } from '../types';
|
|
6
|
+
import type { RoleStore } from './types';
|
|
7
|
+
export declare const DEFAULT_ROLES_ROUTE: RouteString;
|
|
8
|
+
export type RolesConfig<UserType> = {
|
|
9
|
+
getUserId: (user: UserType) => string;
|
|
10
|
+
organizationStore: OrganizationStore;
|
|
11
|
+
roleStore: RoleStore;
|
|
12
|
+
canManageRoles?: (context: {
|
|
13
|
+
membership?: OrganizationMembership;
|
|
14
|
+
organizationId: OrganizationId;
|
|
15
|
+
user: UserType;
|
|
16
|
+
}) => boolean | Promise<boolean>;
|
|
17
|
+
onRolesAssigned?: (context: {
|
|
18
|
+
organizationId: OrganizationId;
|
|
19
|
+
roles: string[];
|
|
20
|
+
userId: string;
|
|
21
|
+
}) => void | Promise<void>;
|
|
22
|
+
rolesRoute?: RouteString;
|
|
23
|
+
};
|
|
24
|
+
export type RolesRouteProps<UserType> = RolesConfig<UserType> & {
|
|
25
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
26
|
+
emit?: AuditEmitter;
|
|
27
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OrganizationMembership, OrganizationStore } from '../organizations/types';
|
|
2
|
+
import type { OrganizationId } from '../tenancy';
|
|
3
|
+
export declare const setMemberRoles: ({ organizationId, organizationStore, roles, userId }: {
|
|
4
|
+
organizationId: OrganizationId;
|
|
5
|
+
organizationStore: OrganizationStore;
|
|
6
|
+
roles: string[];
|
|
7
|
+
userId: string;
|
|
8
|
+
}) => Promise<OrganizationMembership | undefined>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { type AnyPgDatabase } from '../stores/postgres';
|
|
2
|
+
import type { RoleStore } from './types';
|
|
3
|
+
export declare const rolesTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
4
|
+
name: "auth_roles";
|
|
5
|
+
schema: undefined;
|
|
6
|
+
columns: {
|
|
7
|
+
created_at_ms: import("drizzle-orm/pg-core").PgColumn<{
|
|
8
|
+
name: "created_at_ms";
|
|
9
|
+
tableName: "auth_roles";
|
|
10
|
+
dataType: "number";
|
|
11
|
+
columnType: "PgBigInt53";
|
|
12
|
+
data: number;
|
|
13
|
+
driverParam: string | number;
|
|
14
|
+
notNull: true;
|
|
15
|
+
hasDefault: false;
|
|
16
|
+
isPrimaryKey: false;
|
|
17
|
+
isAutoincrement: false;
|
|
18
|
+
hasRuntimeDefault: false;
|
|
19
|
+
enumValues: undefined;
|
|
20
|
+
baseColumn: never;
|
|
21
|
+
identity: undefined;
|
|
22
|
+
generated: undefined;
|
|
23
|
+
}, {}, {}>;
|
|
24
|
+
organization_id: import("drizzle-orm/pg-core").PgColumn<{
|
|
25
|
+
name: "organization_id";
|
|
26
|
+
tableName: "auth_roles";
|
|
27
|
+
dataType: "string";
|
|
28
|
+
columnType: "PgVarchar";
|
|
29
|
+
data: string;
|
|
30
|
+
driverParam: string;
|
|
31
|
+
notNull: true;
|
|
32
|
+
hasDefault: true;
|
|
33
|
+
isPrimaryKey: false;
|
|
34
|
+
isAutoincrement: false;
|
|
35
|
+
hasRuntimeDefault: false;
|
|
36
|
+
enumValues: [string, ...string[]];
|
|
37
|
+
baseColumn: never;
|
|
38
|
+
identity: undefined;
|
|
39
|
+
generated: undefined;
|
|
40
|
+
}, {}, {
|
|
41
|
+
length: 255;
|
|
42
|
+
}>;
|
|
43
|
+
permissions: import("drizzle-orm/pg-core").PgColumn<{
|
|
44
|
+
name: "permissions";
|
|
45
|
+
tableName: "auth_roles";
|
|
46
|
+
dataType: "json";
|
|
47
|
+
columnType: "PgJsonb";
|
|
48
|
+
data: string[];
|
|
49
|
+
driverParam: unknown;
|
|
50
|
+
notNull: true;
|
|
51
|
+
hasDefault: true;
|
|
52
|
+
isPrimaryKey: false;
|
|
53
|
+
isAutoincrement: false;
|
|
54
|
+
hasRuntimeDefault: false;
|
|
55
|
+
enumValues: undefined;
|
|
56
|
+
baseColumn: never;
|
|
57
|
+
identity: undefined;
|
|
58
|
+
generated: undefined;
|
|
59
|
+
}, {}, {
|
|
60
|
+
$type: string[];
|
|
61
|
+
}>;
|
|
62
|
+
slug: import("drizzle-orm/pg-core").PgColumn<{
|
|
63
|
+
name: "slug";
|
|
64
|
+
tableName: "auth_roles";
|
|
65
|
+
dataType: "string";
|
|
66
|
+
columnType: "PgVarchar";
|
|
67
|
+
data: string;
|
|
68
|
+
driverParam: string;
|
|
69
|
+
notNull: true;
|
|
70
|
+
hasDefault: false;
|
|
71
|
+
isPrimaryKey: false;
|
|
72
|
+
isAutoincrement: false;
|
|
73
|
+
hasRuntimeDefault: false;
|
|
74
|
+
enumValues: [string, ...string[]];
|
|
75
|
+
baseColumn: never;
|
|
76
|
+
identity: undefined;
|
|
77
|
+
generated: undefined;
|
|
78
|
+
}, {}, {
|
|
79
|
+
length: 128;
|
|
80
|
+
}>;
|
|
81
|
+
updated_at_ms: import("drizzle-orm/pg-core").PgColumn<{
|
|
82
|
+
name: "updated_at_ms";
|
|
83
|
+
tableName: "auth_roles";
|
|
84
|
+
dataType: "number";
|
|
85
|
+
columnType: "PgBigInt53";
|
|
86
|
+
data: number;
|
|
87
|
+
driverParam: string | number;
|
|
88
|
+
notNull: true;
|
|
89
|
+
hasDefault: false;
|
|
90
|
+
isPrimaryKey: false;
|
|
91
|
+
isAutoincrement: false;
|
|
92
|
+
hasRuntimeDefault: false;
|
|
93
|
+
enumValues: undefined;
|
|
94
|
+
baseColumn: never;
|
|
95
|
+
identity: undefined;
|
|
96
|
+
generated: undefined;
|
|
97
|
+
}, {}, {}>;
|
|
98
|
+
};
|
|
99
|
+
dialect: "pg";
|
|
100
|
+
}>;
|
|
101
|
+
export declare const createNeonRoleStore: (databaseUrl: string) => RoleStore;
|
|
102
|
+
export declare const createPostgresRoleStore: (db: AnyPgDatabase) => RoleStore;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { OrganizationStore } from '../organizations/types';
|
|
2
|
+
import type { OrganizationId } from '../tenancy';
|
|
3
|
+
import type { RoleStore } from './types';
|
|
4
|
+
export declare const createMembershipPermissionResolver: <UserType>({ getUserId, organizationStore, roleStore }: {
|
|
5
|
+
getUserId: (user: UserType) => string;
|
|
6
|
+
organizationStore: OrganizationStore;
|
|
7
|
+
roleStore: RoleStore;
|
|
8
|
+
}) => ({ organizationId, permission, user }: {
|
|
9
|
+
organizationId?: OrganizationId;
|
|
10
|
+
permission: string;
|
|
11
|
+
user: UserType;
|
|
12
|
+
}) => Promise<boolean>;
|
|
13
|
+
export declare const resolvePermissions: ({ organizationId, roleStore, roles }: {
|
|
14
|
+
organizationId?: OrganizationId;
|
|
15
|
+
roleStore: RoleStore;
|
|
16
|
+
roles: string[];
|
|
17
|
+
}) => Promise<Set<string>>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import type { SessionRecord } from '../types';
|
|
3
|
+
import { type RolesRouteProps } from './config';
|
|
4
|
+
export declare const roleRoutes: <UserType>({ authSessionStore, canManageRoles, emit, getUserId, onRolesAssigned, organizationStore, roleStore, rolesRoute }: RolesRouteProps<UserType>) => Elysia<"", {
|
|
5
|
+
decorator: {};
|
|
6
|
+
store: {
|
|
7
|
+
session: SessionRecord<UserType>;
|
|
8
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
9
|
+
};
|
|
10
|
+
derive: {};
|
|
11
|
+
resolve: {};
|
|
12
|
+
}, {
|
|
13
|
+
typebox: {};
|
|
14
|
+
error: {};
|
|
15
|
+
}, {
|
|
16
|
+
schema: {};
|
|
17
|
+
standaloneSchema: {};
|
|
18
|
+
macro: {};
|
|
19
|
+
macroFn: {};
|
|
20
|
+
parser: {};
|
|
21
|
+
response: {};
|
|
22
|
+
}, {
|
|
23
|
+
[x: string]: {
|
|
24
|
+
":organizationId": {
|
|
25
|
+
get: {
|
|
26
|
+
body: unknown;
|
|
27
|
+
params: {
|
|
28
|
+
organizationId: string;
|
|
29
|
+
};
|
|
30
|
+
query: unknown;
|
|
31
|
+
headers: unknown;
|
|
32
|
+
response: {
|
|
33
|
+
200: {
|
|
34
|
+
readonly roles: readonly import("./types").Role[];
|
|
35
|
+
};
|
|
36
|
+
401: "Authentication required";
|
|
37
|
+
403: "Cannot manage roles";
|
|
38
|
+
422: {
|
|
39
|
+
type: "validation";
|
|
40
|
+
on: string;
|
|
41
|
+
summary?: string;
|
|
42
|
+
message?: string;
|
|
43
|
+
found?: unknown;
|
|
44
|
+
property?: string;
|
|
45
|
+
expected?: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
} & {
|
|
52
|
+
[x: string]: {
|
|
53
|
+
":organizationId": {
|
|
54
|
+
members: {
|
|
55
|
+
":userId": {
|
|
56
|
+
put: {
|
|
57
|
+
body: {
|
|
58
|
+
roles: string[];
|
|
59
|
+
};
|
|
60
|
+
params: {
|
|
61
|
+
userId: string;
|
|
62
|
+
organizationId: string;
|
|
63
|
+
};
|
|
64
|
+
query: unknown;
|
|
65
|
+
headers: unknown;
|
|
66
|
+
response: {
|
|
67
|
+
200: {
|
|
68
|
+
readonly roles: string[];
|
|
69
|
+
};
|
|
70
|
+
401: "Authentication required";
|
|
71
|
+
403: "Cannot manage roles";
|
|
72
|
+
404: "Membership not found";
|
|
73
|
+
422: {
|
|
74
|
+
type: "validation";
|
|
75
|
+
on: string;
|
|
76
|
+
summary?: string;
|
|
77
|
+
message?: string;
|
|
78
|
+
found?: unknown;
|
|
79
|
+
property?: string;
|
|
80
|
+
expected?: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
}, {
|
|
89
|
+
derive: {};
|
|
90
|
+
resolve: {};
|
|
91
|
+
schema: {};
|
|
92
|
+
standaloneSchema: {};
|
|
93
|
+
response: {};
|
|
94
|
+
}, {
|
|
95
|
+
derive: {};
|
|
96
|
+
resolve: {};
|
|
97
|
+
schema: {};
|
|
98
|
+
standaloneSchema: {};
|
|
99
|
+
response: {};
|
|
100
|
+
} & {
|
|
101
|
+
derive: {};
|
|
102
|
+
resolve: {};
|
|
103
|
+
schema: {};
|
|
104
|
+
standaloneSchema: {};
|
|
105
|
+
response: {};
|
|
106
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OrganizationId } from '../tenancy';
|
|
2
|
+
export type Role = {
|
|
3
|
+
createdAt: number;
|
|
4
|
+
organizationId?: OrganizationId;
|
|
5
|
+
permissions: string[];
|
|
6
|
+
slug: string;
|
|
7
|
+
updatedAt: number;
|
|
8
|
+
};
|
|
9
|
+
export type RoleStore = {
|
|
10
|
+
deleteRole: (slug: string, organizationId?: OrganizationId) => Promise<void>;
|
|
11
|
+
getRole: (slug: string, organizationId?: OrganizationId) => Promise<Role | undefined>;
|
|
12
|
+
listRoles: (organizationId?: OrganizationId) => Promise<Role[]>;
|
|
13
|
+
saveRole: (role: Role) => Promise<void>;
|
|
14
|
+
};
|
|
@@ -27,7 +27,7 @@ export declare const authorize: ({ clientProviders, authorizeRoute, onAuthorizeS
|
|
|
27
27
|
get: {
|
|
28
28
|
body: unknown;
|
|
29
29
|
params: {
|
|
30
|
-
provider: "42" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "auth0" | "authentik" | "autodesk" | "battlenet" | "bitbucket" | "box" | "bungie" | "coinbase" | "discord" | "donationalerts" | "dribbble" | "dropbox" | "epicgames" | "etsy" | "facebook" | "figma" | "gitea" | "github" | "gitlab" | "google" | "intuit" | "kakao" | "keycloak" | "kick" | "lichess" | "line" | "linear" | "linkedin" | "mastodon" | "mercadolibre" | "mercadopago" | "microsoftentraid" | "myanimelist" | "naver" | "notion" | "okta" | "osu" | "patreon" | "polar" | "polaraccesslink" | "polarteampro" | "reddit" | "roblox" | "salesforce" | "shikimori" | "slack" | "spotify" | "startgg" | "strava" | "synology" | "tiktok" | "tiltify" | "tumblr" | "twitch" | "twitter" | "vk" | "withings" | "workos" | "yahoo" | "yandex" | "zoom";
|
|
30
|
+
provider: "42" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "battlenet" | "bitbucket" | "box" | "bungie" | "close" | "coinbase" | "discord" | "donationalerts" | "dribbble" | "dropbox" | "epicgames" | "etsy" | "facebook" | "figma" | "gitea" | "github" | "gitlab" | "gohighlevel" | "google" | "hubspot" | "intuit" | "kakao" | "keycloak" | "kick" | "lichess" | "line" | "linear" | "linkedin" | "mastodon" | "mercadolibre" | "mercadopago" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "notion" | "okta" | "osu" | "patreon" | "pipedrive" | "polar" | "polaraccesslink" | "polarteampro" | "reddit" | "roblox" | "salesforce" | "shikimori" | "slack" | "spotify" | "startgg" | "strava" | "synology" | "tiktok" | "tiltify" | "tumblr" | "twitch" | "twitter" | "vk" | "withings" | "workos" | "yahoo" | "yandex" | "zoho" | "zoom";
|
|
31
31
|
};
|
|
32
32
|
query: {
|
|
33
33
|
client?: string | undefined;
|
|
@@ -59,7 +59,7 @@ export declare const authorize: ({ clientProviders, authorizeRoute, onAuthorizeS
|
|
|
59
59
|
get: {
|
|
60
60
|
body: unknown;
|
|
61
61
|
params: {
|
|
62
|
-
provider: "42" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "auth0" | "authentik" | "autodesk" | "battlenet" | "bitbucket" | "box" | "bungie" | "coinbase" | "discord" | "donationalerts" | "dribbble" | "dropbox" | "epicgames" | "etsy" | "facebook" | "figma" | "gitea" | "github" | "gitlab" | "google" | "intuit" | "kakao" | "keycloak" | "kick" | "lichess" | "line" | "linear" | "linkedin" | "mastodon" | "mercadolibre" | "mercadopago" | "microsoftentraid" | "myanimelist" | "naver" | "notion" | "okta" | "osu" | "patreon" | "polar" | "polaraccesslink" | "polarteampro" | "reddit" | "roblox" | "salesforce" | "shikimori" | "slack" | "spotify" | "startgg" | "strava" | "synology" | "tiktok" | "tiltify" | "tumblr" | "twitch" | "twitter" | "vk" | "withings" | "workos" | "yahoo" | "yandex" | "zoom";
|
|
62
|
+
provider: "42" | "amazoncognito" | "anilist" | "apple" | "atlassian" | "attio" | "auth0" | "authentik" | "autodesk" | "battlenet" | "bitbucket" | "box" | "bungie" | "close" | "coinbase" | "discord" | "donationalerts" | "dribbble" | "dropbox" | "epicgames" | "etsy" | "facebook" | "figma" | "gitea" | "github" | "gitlab" | "gohighlevel" | "google" | "hubspot" | "intuit" | "kakao" | "keycloak" | "kick" | "lichess" | "line" | "linear" | "linkedin" | "mastodon" | "mercadolibre" | "mercadopago" | "microsoftentraid" | "monday" | "myanimelist" | "naver" | "notion" | "okta" | "osu" | "patreon" | "pipedrive" | "polar" | "polaraccesslink" | "polarteampro" | "reddit" | "roblox" | "salesforce" | "shikimori" | "slack" | "spotify" | "startgg" | "strava" | "synology" | "tiktok" | "tiltify" | "tumblr" | "twitch" | "twitter" | "vk" | "withings" | "workos" | "yahoo" | "yandex" | "zoho" | "zoom";
|
|
63
63
|
};
|
|
64
64
|
query: {
|
|
65
65
|
client?: string | undefined;
|
|
@@ -16,7 +16,7 @@ export declare const protectRoutePlugin: <UserType>({ authSessionStore }?: {
|
|
|
16
16
|
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
17
17
|
};
|
|
18
18
|
derive: {
|
|
19
|
-
readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AuthFailError) => AuthFailReturn) => Promise<
|
|
19
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AuthFailError) => AuthFailReturn) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
|
|
20
20
|
};
|
|
21
21
|
resolve: {};
|
|
22
22
|
}, {
|
|
@@ -33,7 +33,7 @@ export declare const protectRoutePlugin: <UserType>({ authSessionStore }?: {
|
|
|
33
33
|
macroFn: {};
|
|
34
34
|
parser: {};
|
|
35
35
|
response: import("elysia").ExtractErrorFromHandle<{
|
|
36
|
-
readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AuthFailError) => AuthFailReturn) => Promise<
|
|
36
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: (error: AuthFailError) => AuthFailReturn) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
|
|
37
37
|
}>;
|
|
38
38
|
}, {}, {
|
|
39
39
|
derive: {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { OrganizationId } from '../tenancy';
|
|
2
|
+
import type { RouteString } from '../types';
|
|
3
|
+
import type { ScimFilter, ScimGroup, ScimGroupInput, ScimTokenStore, ScimUser, ScimUserInput } from './types';
|
|
4
|
+
export declare const DEFAULT_SCIM_ROUTE = "/scim/v2";
|
|
5
|
+
export type ScimConfig = {
|
|
6
|
+
getScimGroup?: (context: {
|
|
7
|
+
id: string;
|
|
8
|
+
organizationId: OrganizationId;
|
|
9
|
+
}) => ScimGroup | undefined | Promise<ScimGroup | undefined>;
|
|
10
|
+
getScimUser: (context: {
|
|
11
|
+
id: string;
|
|
12
|
+
organizationId: OrganizationId;
|
|
13
|
+
}) => ScimUser | undefined | Promise<ScimUser | undefined>;
|
|
14
|
+
listScimGroups?: (context: {
|
|
15
|
+
filter?: ScimFilter;
|
|
16
|
+
organizationId: OrganizationId;
|
|
17
|
+
}) => ScimGroup[] | Promise<ScimGroup[]>;
|
|
18
|
+
listScimUsers: (context: {
|
|
19
|
+
filter?: ScimFilter;
|
|
20
|
+
organizationId: OrganizationId;
|
|
21
|
+
}) => ScimUser[] | Promise<ScimUser[]>;
|
|
22
|
+
onScimGroupCreate?: (context: {
|
|
23
|
+
input: ScimGroupInput;
|
|
24
|
+
organizationId: OrganizationId;
|
|
25
|
+
}) => ScimGroup | Promise<ScimGroup>;
|
|
26
|
+
onScimGroupDelete?: (context: {
|
|
27
|
+
id: string;
|
|
28
|
+
organizationId: OrganizationId;
|
|
29
|
+
}) => void | Promise<void>;
|
|
30
|
+
onScimGroupReplace?: (context: {
|
|
31
|
+
id: string;
|
|
32
|
+
input: ScimGroupInput;
|
|
33
|
+
organizationId: OrganizationId;
|
|
34
|
+
}) => ScimGroup | undefined | Promise<ScimGroup | undefined>;
|
|
35
|
+
onScimUserCreate: (context: {
|
|
36
|
+
input: ScimUserInput;
|
|
37
|
+
organizationId: OrganizationId;
|
|
38
|
+
}) => ScimUser | Promise<ScimUser>;
|
|
39
|
+
onScimUserDeactivate: (context: {
|
|
40
|
+
id: string;
|
|
41
|
+
organizationId: OrganizationId;
|
|
42
|
+
}) => void | Promise<void>;
|
|
43
|
+
onScimUserReplace: (context: {
|
|
44
|
+
id: string;
|
|
45
|
+
input: ScimUserInput;
|
|
46
|
+
organizationId: OrganizationId;
|
|
47
|
+
}) => ScimUser | undefined | Promise<ScimUser | undefined>;
|
|
48
|
+
scimRoute?: RouteString;
|
|
49
|
+
scimTokenStore: ScimTokenStore;
|
|
50
|
+
};
|
|
51
|
+
export declare const createScimToken: (scimTokenStore: ScimTokenStore, organizationId: OrganizationId) => Promise<{
|
|
52
|
+
token: string;
|
|
53
|
+
tokenId: string;
|
|
54
|
+
}>;
|
|
55
|
+
export declare const resolveScimOrganization: (scimTokenStore: ScimTokenStore, authorization: string | undefined) => Promise<string | undefined>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { type AnyPgDatabase } from '../stores/postgres';
|
|
2
|
+
import type { ScimTokenStore } from './types';
|
|
3
|
+
export declare const scimTokensTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
4
|
+
name: "auth_scim_tokens";
|
|
5
|
+
schema: undefined;
|
|
6
|
+
columns: {
|
|
7
|
+
created_at_ms: import("drizzle-orm/pg-core").PgColumn<{
|
|
8
|
+
name: "created_at_ms";
|
|
9
|
+
tableName: "auth_scim_tokens";
|
|
10
|
+
dataType: "number";
|
|
11
|
+
columnType: "PgBigInt53";
|
|
12
|
+
data: number;
|
|
13
|
+
driverParam: string | number;
|
|
14
|
+
notNull: true;
|
|
15
|
+
hasDefault: false;
|
|
16
|
+
isPrimaryKey: false;
|
|
17
|
+
isAutoincrement: false;
|
|
18
|
+
hasRuntimeDefault: false;
|
|
19
|
+
enumValues: undefined;
|
|
20
|
+
baseColumn: never;
|
|
21
|
+
identity: undefined;
|
|
22
|
+
generated: undefined;
|
|
23
|
+
}, {}, {}>;
|
|
24
|
+
hashed_token: import("drizzle-orm/pg-core").PgColumn<{
|
|
25
|
+
name: "hashed_token";
|
|
26
|
+
tableName: "auth_scim_tokens";
|
|
27
|
+
dataType: "string";
|
|
28
|
+
columnType: "PgVarchar";
|
|
29
|
+
data: string;
|
|
30
|
+
driverParam: string;
|
|
31
|
+
notNull: true;
|
|
32
|
+
hasDefault: false;
|
|
33
|
+
isPrimaryKey: false;
|
|
34
|
+
isAutoincrement: false;
|
|
35
|
+
hasRuntimeDefault: false;
|
|
36
|
+
enumValues: [string, ...string[]];
|
|
37
|
+
baseColumn: never;
|
|
38
|
+
identity: undefined;
|
|
39
|
+
generated: undefined;
|
|
40
|
+
}, {}, {
|
|
41
|
+
length: 255;
|
|
42
|
+
}>;
|
|
43
|
+
last_used_at_ms: import("drizzle-orm/pg-core").PgColumn<{
|
|
44
|
+
name: "last_used_at_ms";
|
|
45
|
+
tableName: "auth_scim_tokens";
|
|
46
|
+
dataType: "number";
|
|
47
|
+
columnType: "PgBigInt53";
|
|
48
|
+
data: number;
|
|
49
|
+
driverParam: string | number;
|
|
50
|
+
notNull: false;
|
|
51
|
+
hasDefault: false;
|
|
52
|
+
isPrimaryKey: false;
|
|
53
|
+
isAutoincrement: false;
|
|
54
|
+
hasRuntimeDefault: false;
|
|
55
|
+
enumValues: undefined;
|
|
56
|
+
baseColumn: never;
|
|
57
|
+
identity: undefined;
|
|
58
|
+
generated: undefined;
|
|
59
|
+
}, {}, {}>;
|
|
60
|
+
organization_id: import("drizzle-orm/pg-core").PgColumn<{
|
|
61
|
+
name: "organization_id";
|
|
62
|
+
tableName: "auth_scim_tokens";
|
|
63
|
+
dataType: "string";
|
|
64
|
+
columnType: "PgVarchar";
|
|
65
|
+
data: string;
|
|
66
|
+
driverParam: string;
|
|
67
|
+
notNull: true;
|
|
68
|
+
hasDefault: false;
|
|
69
|
+
isPrimaryKey: false;
|
|
70
|
+
isAutoincrement: false;
|
|
71
|
+
hasRuntimeDefault: false;
|
|
72
|
+
enumValues: [string, ...string[]];
|
|
73
|
+
baseColumn: never;
|
|
74
|
+
identity: undefined;
|
|
75
|
+
generated: undefined;
|
|
76
|
+
}, {}, {
|
|
77
|
+
length: 255;
|
|
78
|
+
}>;
|
|
79
|
+
token_id: import("drizzle-orm/pg-core").PgColumn<{
|
|
80
|
+
name: "token_id";
|
|
81
|
+
tableName: "auth_scim_tokens";
|
|
82
|
+
dataType: "string";
|
|
83
|
+
columnType: "PgVarchar";
|
|
84
|
+
data: string;
|
|
85
|
+
driverParam: string;
|
|
86
|
+
notNull: true;
|
|
87
|
+
hasDefault: false;
|
|
88
|
+
isPrimaryKey: true;
|
|
89
|
+
isAutoincrement: false;
|
|
90
|
+
hasRuntimeDefault: false;
|
|
91
|
+
enumValues: [string, ...string[]];
|
|
92
|
+
baseColumn: never;
|
|
93
|
+
identity: undefined;
|
|
94
|
+
generated: undefined;
|
|
95
|
+
}, {}, {
|
|
96
|
+
length: 255;
|
|
97
|
+
}>;
|
|
98
|
+
};
|
|
99
|
+
dialect: "pg";
|
|
100
|
+
}>;
|
|
101
|
+
export declare const createNeonScimTokenStore: (databaseUrl: string) => ScimTokenStore;
|
|
102
|
+
export declare const createPostgresScimTokenStore: (db: AnyPgDatabase) => ScimTokenStore;
|