@absolutejs/auth 0.26.0-beta.1 → 0.26.0-beta.3
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 +2539 -344
- package/dist/index.js +3679 -1619
- package/dist/index.js.map +33 -13
- package/dist/lockout/redisLockoutStore.d.ts +3 -0
- package/dist/providers/clients.d.ts +3 -3
- 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/stores/redis.d.ts +5 -0
- package/dist/typebox.d.ts +1 -1
- package/dist/types.d.ts +36 -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/package.json +2 -2
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { OAuth2TokenResponse, OIDCIdTokenClaims } from 'citra';
|
|
2
|
+
import type { OrganizationId } from '../tenancy';
|
|
3
|
+
import type { RouteString, UserSessionId } from '../types';
|
|
4
|
+
import type { OidcConnection, SamlConnection, SSOConnectionStore } from './types';
|
|
5
|
+
export declare const DEFAULT_SSO_ROUTE = "/sso";
|
|
6
|
+
export declare const DEFAULT_SSO_SESSION_TTL_MS: number;
|
|
7
|
+
export type SamlProfile = {
|
|
8
|
+
attributes: Record<string, unknown>;
|
|
9
|
+
email?: string;
|
|
10
|
+
nameId: string;
|
|
11
|
+
sessionIndex?: string;
|
|
12
|
+
};
|
|
13
|
+
type SamlAuthorizeRequest = {
|
|
14
|
+
acsUrl: string;
|
|
15
|
+
connection: SamlConnection;
|
|
16
|
+
relayState?: string;
|
|
17
|
+
};
|
|
18
|
+
type SamlAssertionRequest = {
|
|
19
|
+
acsUrl: string;
|
|
20
|
+
connection: SamlConnection;
|
|
21
|
+
relayState?: string;
|
|
22
|
+
samlResponse: string;
|
|
23
|
+
};
|
|
24
|
+
type SamlMetadataRequest = {
|
|
25
|
+
acsUrl: string;
|
|
26
|
+
connection: SamlConnection;
|
|
27
|
+
};
|
|
28
|
+
type SamlLogoutRequest = {
|
|
29
|
+
connection: SamlConnection;
|
|
30
|
+
nameId: string;
|
|
31
|
+
relayState?: string;
|
|
32
|
+
sessionIndex?: string;
|
|
33
|
+
sloUrl: string;
|
|
34
|
+
};
|
|
35
|
+
type SamlLogoutResponseRequest = {
|
|
36
|
+
connection: SamlConnection;
|
|
37
|
+
relayState?: string;
|
|
38
|
+
samlResponse: string;
|
|
39
|
+
sloUrl: string;
|
|
40
|
+
};
|
|
41
|
+
type SamlIdpLogoutRequest = {
|
|
42
|
+
connection: SamlConnection;
|
|
43
|
+
relayState?: string;
|
|
44
|
+
samlRequest: string;
|
|
45
|
+
sloUrl: string;
|
|
46
|
+
};
|
|
47
|
+
type SamlLogoutResponseAck = {
|
|
48
|
+
connection: SamlConnection;
|
|
49
|
+
inResponseTo?: string;
|
|
50
|
+
nameId?: string;
|
|
51
|
+
relayState?: string;
|
|
52
|
+
sloUrl: string;
|
|
53
|
+
};
|
|
54
|
+
export type SamlLogoutInfo = {
|
|
55
|
+
nameId?: string;
|
|
56
|
+
relayState?: string;
|
|
57
|
+
requestId?: string;
|
|
58
|
+
sessionIndex?: string;
|
|
59
|
+
};
|
|
60
|
+
export type SamlAdapter = {
|
|
61
|
+
createAuthorizationUrl: (request: SamlAuthorizeRequest) => Promise<string> | string;
|
|
62
|
+
createLogoutRequestUrl?: (request: SamlLogoutRequest) => Promise<string> | string;
|
|
63
|
+
createLogoutResponseUrl?: (request: SamlLogoutResponseAck) => Promise<string> | string;
|
|
64
|
+
getServiceProviderMetadata: (request: SamlMetadataRequest) => Promise<string> | string;
|
|
65
|
+
validateAssertion: (request: SamlAssertionRequest) => Promise<SamlProfile>;
|
|
66
|
+
validateLogoutRequest?: (request: SamlIdpLogoutRequest) => Promise<SamlLogoutInfo> | SamlLogoutInfo;
|
|
67
|
+
validateLogoutResponse?: (request: SamlLogoutResponseRequest) => Promise<void> | void;
|
|
68
|
+
};
|
|
69
|
+
type SsoIdentityBase = {
|
|
70
|
+
email?: string;
|
|
71
|
+
organizationId: OrganizationId;
|
|
72
|
+
sub: string;
|
|
73
|
+
};
|
|
74
|
+
export type OidcSsoIdentity = SsoIdentityBase & {
|
|
75
|
+
claims: OIDCIdTokenClaims;
|
|
76
|
+
connection: OidcConnection;
|
|
77
|
+
protocol: 'oidc';
|
|
78
|
+
tokenResponse: OAuth2TokenResponse;
|
|
79
|
+
};
|
|
80
|
+
export type SamlSsoIdentity = SsoIdentityBase & {
|
|
81
|
+
attributes: Record<string, unknown>;
|
|
82
|
+
connection: SamlConnection;
|
|
83
|
+
protocol: 'saml';
|
|
84
|
+
sessionIndex?: string;
|
|
85
|
+
};
|
|
86
|
+
export type SsoIdentity = OidcSsoIdentity | SamlSsoIdentity;
|
|
87
|
+
export type SSOConfig<UserType> = {
|
|
88
|
+
getOrganizationByEmailDomain?: (domain: string) => OrganizationId | undefined | Promise<OrganizationId | undefined>;
|
|
89
|
+
getSsoUser: (identity: SsoIdentity) => Promise<UserType> | UserType;
|
|
90
|
+
onSsoCallbackError?: (context: {
|
|
91
|
+
error: unknown;
|
|
92
|
+
organizationId: string;
|
|
93
|
+
}) => void | Promise<void>;
|
|
94
|
+
onSsoCallbackSuccess?: (context: {
|
|
95
|
+
identity: SsoIdentity;
|
|
96
|
+
user: UserType;
|
|
97
|
+
userSessionId: UserSessionId;
|
|
98
|
+
}) => void | Promise<void>;
|
|
99
|
+
samlAdapter?: SamlAdapter;
|
|
100
|
+
sessionDurationMs?: number;
|
|
101
|
+
ssoConnectionStore: SSOConnectionStore;
|
|
102
|
+
ssoRoute?: RouteString;
|
|
103
|
+
};
|
|
104
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import type { OrganizationId } from '../tenancy';
|
|
3
|
+
import type { RouteString } from '../types';
|
|
4
|
+
import type { SSOConnectionStore } from './types';
|
|
5
|
+
type SsoDiscoveryProps = {
|
|
6
|
+
getOrganizationByEmailDomain: (domain: string) => OrganizationId | undefined | Promise<OrganizationId | undefined>;
|
|
7
|
+
ssoConnectionStore: SSOConnectionStore;
|
|
8
|
+
ssoRoute?: RouteString;
|
|
9
|
+
};
|
|
10
|
+
export declare const ssoDiscoveryRoute: ({ getOrganizationByEmailDomain, ssoConnectionStore, ssoRoute }: SsoDiscoveryProps) => Elysia<"", {
|
|
11
|
+
decorator: {};
|
|
12
|
+
store: {};
|
|
13
|
+
derive: {};
|
|
14
|
+
resolve: {};
|
|
15
|
+
}, {
|
|
16
|
+
typebox: {};
|
|
17
|
+
error: {};
|
|
18
|
+
}, {
|
|
19
|
+
schema: {};
|
|
20
|
+
standaloneSchema: {};
|
|
21
|
+
macro: {};
|
|
22
|
+
macroFn: {};
|
|
23
|
+
parser: {};
|
|
24
|
+
response: {};
|
|
25
|
+
}, {
|
|
26
|
+
[x: string]: {
|
|
27
|
+
get: {
|
|
28
|
+
body: unknown;
|
|
29
|
+
params: {};
|
|
30
|
+
query: {
|
|
31
|
+
email?: string | undefined;
|
|
32
|
+
};
|
|
33
|
+
headers: unknown;
|
|
34
|
+
response: {
|
|
35
|
+
200: Response;
|
|
36
|
+
400: "An \"email\" query parameter is required" | "A valid email address is required";
|
|
37
|
+
404: "No SSO organization is configured for this email domain" | "No SSO connection is configured for this organization";
|
|
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
|
+
derive: {};
|
|
52
|
+
resolve: {};
|
|
53
|
+
schema: {};
|
|
54
|
+
standaloneSchema: {};
|
|
55
|
+
response: {};
|
|
56
|
+
}, {
|
|
57
|
+
derive: {};
|
|
58
|
+
resolve: {};
|
|
59
|
+
schema: {};
|
|
60
|
+
standaloneSchema: {};
|
|
61
|
+
response: {};
|
|
62
|
+
}>;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import type { AuthSessionStore } from '../session/types';
|
|
3
|
+
import { type SSOConfig } from './config';
|
|
4
|
+
type OidcRoutesProps<UserType> = SSOConfig<UserType> & {
|
|
5
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
6
|
+
};
|
|
7
|
+
export declare const oidcSsoRoutes: <UserType>({ authSessionStore, getSsoUser, onSsoCallbackError, onSsoCallbackSuccess, sessionDurationMs, ssoConnectionStore, ssoRoute }: OidcRoutesProps<UserType>) => Elysia<"", {
|
|
8
|
+
decorator: {};
|
|
9
|
+
store: {
|
|
10
|
+
session: import("..").SessionRecord<UserType>;
|
|
11
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
12
|
+
};
|
|
13
|
+
derive: {};
|
|
14
|
+
resolve: {};
|
|
15
|
+
}, {
|
|
16
|
+
typebox: {};
|
|
17
|
+
error: {};
|
|
18
|
+
}, {
|
|
19
|
+
schema: {};
|
|
20
|
+
standaloneSchema: {};
|
|
21
|
+
macro: {};
|
|
22
|
+
macroFn: {};
|
|
23
|
+
parser: {};
|
|
24
|
+
response: {};
|
|
25
|
+
}, {
|
|
26
|
+
[x: string]: {
|
|
27
|
+
get: {
|
|
28
|
+
body: unknown;
|
|
29
|
+
params: {
|
|
30
|
+
organizationId: string;
|
|
31
|
+
};
|
|
32
|
+
query: unknown;
|
|
33
|
+
headers: unknown;
|
|
34
|
+
response: {
|
|
35
|
+
200: Response;
|
|
36
|
+
404: "No OIDC connection is configured for this organization";
|
|
37
|
+
422: {
|
|
38
|
+
type: "validation";
|
|
39
|
+
on: string;
|
|
40
|
+
summary?: string;
|
|
41
|
+
message?: string;
|
|
42
|
+
found?: unknown;
|
|
43
|
+
property?: string;
|
|
44
|
+
expected?: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
} & {
|
|
50
|
+
[x: string]: {
|
|
51
|
+
get: {
|
|
52
|
+
body: unknown;
|
|
53
|
+
params: {
|
|
54
|
+
organizationId: string;
|
|
55
|
+
};
|
|
56
|
+
query: {
|
|
57
|
+
code?: string | undefined;
|
|
58
|
+
state?: string | undefined;
|
|
59
|
+
};
|
|
60
|
+
headers: unknown;
|
|
61
|
+
response: {
|
|
62
|
+
200: Response;
|
|
63
|
+
400: "SSO session cookies are missing" | "Invalid SSO callback request" | "SSO organization mismatch" | "OIDC token response is missing an id_token";
|
|
64
|
+
404: "No OIDC connection is configured for this organization";
|
|
65
|
+
422: {
|
|
66
|
+
type: "validation";
|
|
67
|
+
on: string;
|
|
68
|
+
summary?: string;
|
|
69
|
+
message?: string;
|
|
70
|
+
found?: unknown;
|
|
71
|
+
property?: string;
|
|
72
|
+
expected?: string;
|
|
73
|
+
};
|
|
74
|
+
500: "OIDC sign-in failed";
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
}, {
|
|
79
|
+
derive: {};
|
|
80
|
+
resolve: {};
|
|
81
|
+
schema: {};
|
|
82
|
+
standaloneSchema: {};
|
|
83
|
+
response: {};
|
|
84
|
+
}, {
|
|
85
|
+
derive: {};
|
|
86
|
+
resolve: {};
|
|
87
|
+
schema: {};
|
|
88
|
+
standaloneSchema: {};
|
|
89
|
+
response: {};
|
|
90
|
+
} & {
|
|
91
|
+
derive: {};
|
|
92
|
+
resolve: {};
|
|
93
|
+
schema: {};
|
|
94
|
+
standaloneSchema: {};
|
|
95
|
+
response: {};
|
|
96
|
+
}>;
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { type AnyPgDatabase } from '../stores/postgres';
|
|
2
|
+
import type { OidcConnectionConfig, SamlConnectionConfig, SSOConnectionStore, SSOConnectionType } from './types';
|
|
3
|
+
export declare const ssoConnectionsTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
4
|
+
name: "auth_sso_connections";
|
|
5
|
+
schema: undefined;
|
|
6
|
+
columns: {
|
|
7
|
+
config: import("drizzle-orm/pg-core").PgColumn<{
|
|
8
|
+
name: "config";
|
|
9
|
+
tableName: "auth_sso_connections";
|
|
10
|
+
dataType: "json";
|
|
11
|
+
columnType: "PgJsonb";
|
|
12
|
+
data: OidcConnectionConfig | SamlConnectionConfig;
|
|
13
|
+
driverParam: unknown;
|
|
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
|
+
$type: OidcConnectionConfig | SamlConnectionConfig;
|
|
25
|
+
}>;
|
|
26
|
+
connection_id: import("drizzle-orm/pg-core").PgColumn<{
|
|
27
|
+
name: "connection_id";
|
|
28
|
+
tableName: "auth_sso_connections";
|
|
29
|
+
dataType: "string";
|
|
30
|
+
columnType: "PgVarchar";
|
|
31
|
+
data: string;
|
|
32
|
+
driverParam: string;
|
|
33
|
+
notNull: true;
|
|
34
|
+
hasDefault: false;
|
|
35
|
+
isPrimaryKey: true;
|
|
36
|
+
isAutoincrement: false;
|
|
37
|
+
hasRuntimeDefault: false;
|
|
38
|
+
enumValues: [string, ...string[]];
|
|
39
|
+
baseColumn: never;
|
|
40
|
+
identity: undefined;
|
|
41
|
+
generated: undefined;
|
|
42
|
+
}, {}, {
|
|
43
|
+
length: 255;
|
|
44
|
+
}>;
|
|
45
|
+
created_at_ms: import("drizzle-orm/pg-core").PgColumn<{
|
|
46
|
+
name: "created_at_ms";
|
|
47
|
+
tableName: "auth_sso_connections";
|
|
48
|
+
dataType: "number";
|
|
49
|
+
columnType: "PgBigInt53";
|
|
50
|
+
data: number;
|
|
51
|
+
driverParam: string | number;
|
|
52
|
+
notNull: true;
|
|
53
|
+
hasDefault: false;
|
|
54
|
+
isPrimaryKey: false;
|
|
55
|
+
isAutoincrement: false;
|
|
56
|
+
hasRuntimeDefault: false;
|
|
57
|
+
enumValues: undefined;
|
|
58
|
+
baseColumn: never;
|
|
59
|
+
identity: undefined;
|
|
60
|
+
generated: undefined;
|
|
61
|
+
}, {}, {}>;
|
|
62
|
+
enabled: import("drizzle-orm/pg-core").PgColumn<{
|
|
63
|
+
name: "enabled";
|
|
64
|
+
tableName: "auth_sso_connections";
|
|
65
|
+
dataType: "boolean";
|
|
66
|
+
columnType: "PgBoolean";
|
|
67
|
+
data: boolean;
|
|
68
|
+
driverParam: boolean;
|
|
69
|
+
notNull: true;
|
|
70
|
+
hasDefault: true;
|
|
71
|
+
isPrimaryKey: false;
|
|
72
|
+
isAutoincrement: false;
|
|
73
|
+
hasRuntimeDefault: false;
|
|
74
|
+
enumValues: undefined;
|
|
75
|
+
baseColumn: never;
|
|
76
|
+
identity: undefined;
|
|
77
|
+
generated: undefined;
|
|
78
|
+
}, {}, {}>;
|
|
79
|
+
organization_id: import("drizzle-orm/pg-core").PgColumn<{
|
|
80
|
+
name: "organization_id";
|
|
81
|
+
tableName: "auth_sso_connections";
|
|
82
|
+
dataType: "string";
|
|
83
|
+
columnType: "PgVarchar";
|
|
84
|
+
data: string;
|
|
85
|
+
driverParam: string;
|
|
86
|
+
notNull: true;
|
|
87
|
+
hasDefault: false;
|
|
88
|
+
isPrimaryKey: false;
|
|
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
|
+
type: import("drizzle-orm/pg-core").PgColumn<{
|
|
99
|
+
name: "type";
|
|
100
|
+
tableName: "auth_sso_connections";
|
|
101
|
+
dataType: "string";
|
|
102
|
+
columnType: "PgVarchar";
|
|
103
|
+
data: SSOConnectionType;
|
|
104
|
+
driverParam: string;
|
|
105
|
+
notNull: true;
|
|
106
|
+
hasDefault: false;
|
|
107
|
+
isPrimaryKey: false;
|
|
108
|
+
isAutoincrement: false;
|
|
109
|
+
hasRuntimeDefault: false;
|
|
110
|
+
enumValues: [string, ...string[]];
|
|
111
|
+
baseColumn: never;
|
|
112
|
+
identity: undefined;
|
|
113
|
+
generated: undefined;
|
|
114
|
+
}, {}, {
|
|
115
|
+
length: 16;
|
|
116
|
+
$type: SSOConnectionType;
|
|
117
|
+
}>;
|
|
118
|
+
updated_at_ms: import("drizzle-orm/pg-core").PgColumn<{
|
|
119
|
+
name: "updated_at_ms";
|
|
120
|
+
tableName: "auth_sso_connections";
|
|
121
|
+
dataType: "number";
|
|
122
|
+
columnType: "PgBigInt53";
|
|
123
|
+
data: number;
|
|
124
|
+
driverParam: string | number;
|
|
125
|
+
notNull: true;
|
|
126
|
+
hasDefault: false;
|
|
127
|
+
isPrimaryKey: false;
|
|
128
|
+
isAutoincrement: false;
|
|
129
|
+
hasRuntimeDefault: false;
|
|
130
|
+
enumValues: undefined;
|
|
131
|
+
baseColumn: never;
|
|
132
|
+
identity: undefined;
|
|
133
|
+
generated: undefined;
|
|
134
|
+
}, {}, {}>;
|
|
135
|
+
};
|
|
136
|
+
dialect: "pg";
|
|
137
|
+
}>;
|
|
138
|
+
export declare const createNeonSsoConnectionStore: (databaseUrl: string) => SSOConnectionStore;
|
|
139
|
+
export declare const createPostgresSsoConnectionStore: (db: AnyPgDatabase) => SSOConnectionStore;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import type { AuthSessionStore } from '../session/types';
|
|
3
|
+
import type { SessionRecord } from '../types';
|
|
4
|
+
import { type SamlAdapter, type SSOConfig } from './config';
|
|
5
|
+
type SamlRoutesProps<UserType> = SSOConfig<UserType> & {
|
|
6
|
+
authSessionStore?: AuthSessionStore<UserType>;
|
|
7
|
+
samlAdapter: SamlAdapter;
|
|
8
|
+
};
|
|
9
|
+
export declare const samlSsoRoutes: <UserType>({ authSessionStore, getSsoUser, onSsoCallbackError, onSsoCallbackSuccess, samlAdapter, sessionDurationMs, ssoConnectionStore, ssoRoute }: SamlRoutesProps<UserType>) => Elysia<"", {
|
|
10
|
+
decorator: {};
|
|
11
|
+
store: {
|
|
12
|
+
session: SessionRecord<UserType>;
|
|
13
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
14
|
+
};
|
|
15
|
+
derive: {};
|
|
16
|
+
resolve: {};
|
|
17
|
+
}, {
|
|
18
|
+
typebox: {};
|
|
19
|
+
error: {};
|
|
20
|
+
}, {
|
|
21
|
+
schema: {};
|
|
22
|
+
standaloneSchema: {};
|
|
23
|
+
macro: {};
|
|
24
|
+
macroFn: {};
|
|
25
|
+
parser: {};
|
|
26
|
+
response: {};
|
|
27
|
+
}, {
|
|
28
|
+
[x: string]: {
|
|
29
|
+
get: {
|
|
30
|
+
body: unknown;
|
|
31
|
+
params: {
|
|
32
|
+
organizationId: string;
|
|
33
|
+
};
|
|
34
|
+
query: unknown;
|
|
35
|
+
headers: unknown;
|
|
36
|
+
response: {
|
|
37
|
+
200: Response;
|
|
38
|
+
404: "No SAML connection is configured for this organization";
|
|
39
|
+
422: {
|
|
40
|
+
type: "validation";
|
|
41
|
+
on: string;
|
|
42
|
+
summary?: string;
|
|
43
|
+
message?: string;
|
|
44
|
+
found?: unknown;
|
|
45
|
+
property?: string;
|
|
46
|
+
expected?: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
} & {
|
|
52
|
+
[x: string]: {
|
|
53
|
+
post: {
|
|
54
|
+
body: {
|
|
55
|
+
RelayState?: string | undefined;
|
|
56
|
+
SAMLResponse: string;
|
|
57
|
+
};
|
|
58
|
+
params: {
|
|
59
|
+
organizationId: string;
|
|
60
|
+
};
|
|
61
|
+
query: unknown;
|
|
62
|
+
headers: unknown;
|
|
63
|
+
response: {
|
|
64
|
+
200: Response;
|
|
65
|
+
404: "No SAML connection is configured for this organization";
|
|
66
|
+
422: {
|
|
67
|
+
type: "validation";
|
|
68
|
+
on: string;
|
|
69
|
+
summary?: string;
|
|
70
|
+
message?: string;
|
|
71
|
+
found?: unknown;
|
|
72
|
+
property?: string;
|
|
73
|
+
expected?: string;
|
|
74
|
+
};
|
|
75
|
+
500: "SAML sign-in failed";
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
} & {
|
|
80
|
+
[x: string]: {
|
|
81
|
+
get: {
|
|
82
|
+
body: unknown;
|
|
83
|
+
params: {
|
|
84
|
+
organizationId: string;
|
|
85
|
+
};
|
|
86
|
+
query: unknown;
|
|
87
|
+
headers: unknown;
|
|
88
|
+
response: {
|
|
89
|
+
200: Response;
|
|
90
|
+
404: "No SAML connection is configured for this organization";
|
|
91
|
+
422: {
|
|
92
|
+
type: "validation";
|
|
93
|
+
on: string;
|
|
94
|
+
summary?: string;
|
|
95
|
+
message?: string;
|
|
96
|
+
found?: unknown;
|
|
97
|
+
property?: string;
|
|
98
|
+
expected?: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
} & {
|
|
104
|
+
[x: string]: {
|
|
105
|
+
get: {
|
|
106
|
+
body: unknown;
|
|
107
|
+
params: {
|
|
108
|
+
organizationId: string;
|
|
109
|
+
};
|
|
110
|
+
query: unknown;
|
|
111
|
+
headers: unknown;
|
|
112
|
+
response: {
|
|
113
|
+
200: Response;
|
|
114
|
+
422: {
|
|
115
|
+
type: "validation";
|
|
116
|
+
on: string;
|
|
117
|
+
summary?: string;
|
|
118
|
+
message?: string;
|
|
119
|
+
found?: unknown;
|
|
120
|
+
property?: string;
|
|
121
|
+
expected?: string;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
} & {
|
|
127
|
+
[x: string]: {
|
|
128
|
+
get: {
|
|
129
|
+
body: unknown;
|
|
130
|
+
params: {
|
|
131
|
+
organizationId: string;
|
|
132
|
+
};
|
|
133
|
+
query: {
|
|
134
|
+
RelayState?: string | undefined;
|
|
135
|
+
SAMLResponse?: string | undefined;
|
|
136
|
+
SAMLRequest?: string | undefined;
|
|
137
|
+
};
|
|
138
|
+
headers: unknown;
|
|
139
|
+
response: {
|
|
140
|
+
200: Response;
|
|
141
|
+
400: "Missing SAMLRequest or SAMLResponse" | "Invalid SAML LogoutRequest";
|
|
142
|
+
404: "No SAML connection is configured for this organization";
|
|
143
|
+
422: {
|
|
144
|
+
type: "validation";
|
|
145
|
+
on: string;
|
|
146
|
+
summary?: string;
|
|
147
|
+
message?: string;
|
|
148
|
+
found?: unknown;
|
|
149
|
+
property?: string;
|
|
150
|
+
expected?: string;
|
|
151
|
+
};
|
|
152
|
+
500: "SAML logout failed";
|
|
153
|
+
501: "SAML Single Logout is not configured";
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
}, {
|
|
158
|
+
derive: {};
|
|
159
|
+
resolve: {};
|
|
160
|
+
schema: {};
|
|
161
|
+
standaloneSchema: {};
|
|
162
|
+
response: {};
|
|
163
|
+
}, {
|
|
164
|
+
derive: {};
|
|
165
|
+
resolve: {};
|
|
166
|
+
schema: {};
|
|
167
|
+
standaloneSchema: {};
|
|
168
|
+
response: {};
|
|
169
|
+
} & {
|
|
170
|
+
derive: {};
|
|
171
|
+
resolve: {};
|
|
172
|
+
schema: {};
|
|
173
|
+
standaloneSchema: {};
|
|
174
|
+
response: {};
|
|
175
|
+
}>;
|
|
176
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { OrganizationId } from '../tenancy';
|
|
2
|
+
export type SSOConnectionType = 'oidc' | 'saml';
|
|
3
|
+
export type OidcConnectionConfig = {
|
|
4
|
+
clientId: string;
|
|
5
|
+
clientSecret: string;
|
|
6
|
+
issuer: string;
|
|
7
|
+
redirectUri: string;
|
|
8
|
+
scopes: string[];
|
|
9
|
+
};
|
|
10
|
+
export type SamlConnectionConfig = {
|
|
11
|
+
idpEntityId: string;
|
|
12
|
+
idpSloUrl?: string;
|
|
13
|
+
idpSsoUrl: string;
|
|
14
|
+
idpX509Cert: string;
|
|
15
|
+
};
|
|
16
|
+
type SSOConnectionBase = {
|
|
17
|
+
connectionId: string;
|
|
18
|
+
createdAt: number;
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
organizationId: OrganizationId;
|
|
21
|
+
updatedAt: number;
|
|
22
|
+
};
|
|
23
|
+
export type OidcConnection = SSOConnectionBase & {
|
|
24
|
+
config: OidcConnectionConfig;
|
|
25
|
+
type: 'oidc';
|
|
26
|
+
};
|
|
27
|
+
export type SamlConnection = SSOConnectionBase & {
|
|
28
|
+
config: SamlConnectionConfig;
|
|
29
|
+
type: 'saml';
|
|
30
|
+
};
|
|
31
|
+
export type SSOConnection = OidcConnection | SamlConnection;
|
|
32
|
+
export type SSOConnectionStore = {
|
|
33
|
+
deleteConnection: (connectionId: string) => Promise<void>;
|
|
34
|
+
getConnection: (connectionId: string) => Promise<SSOConnection | undefined>;
|
|
35
|
+
getConnectionByOrganization: (organizationId: OrganizationId, type?: SSOConnectionType) => Promise<SSOConnection | undefined>;
|
|
36
|
+
listConnectionsByOrganization: (organizationId: OrganizationId) => Promise<SSOConnection[]>;
|
|
37
|
+
saveConnection: (connection: SSOConnection) => Promise<void>;
|
|
38
|
+
};
|
|
39
|
+
export {};
|
package/dist/typebox.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const authClientOption: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
2
2
|
export declare const authIntentOption: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"login">, import("@sinclair/typebox").TLiteral<"link_identity">, import("@sinclair/typebox").TLiteral<"link_connector">]>>;
|
|
3
3
|
export declare const authProviderOption: import("@sinclair/typebox").TEnum<{
|
|
4
|
-
[k: string]: "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";
|
|
4
|
+
[k: string]: "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";
|
|
5
5
|
}>;
|
|
6
6
|
export declare const userSessionIdTypebox: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"${string}-${string}-${string}-${string}-${string}">>;
|