@better-auth/sso 1.4.0-beta.13 → 1.4.0-beta.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/.turbo/turbo-build.log +10 -10
- package/dist/client.cjs +1 -1
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +1 -1
- package/dist/{index-CL9gq2xe.d.ts → index-CdeDxbNh.d.ts} +52 -52
- package/dist/{index-N2GvRGik.d.cts → index-DJAIa5j3.d.cts} +52 -52
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-KQzfNIm4.js → src-BEPbgggK.js} +5 -5
- package/dist/{src-BYOa9Nr6.cjs → src-BsLnNXTo.cjs} +10 -10
- package/package.json +11 -5
- package/src/index.ts +140 -129
- package/src/oidc.test.ts +5 -5
- package/src/saml.test.ts +17 -17
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/sso@1.4.0-beta.
|
|
2
|
+
> @better-auth/sso@1.4.0-beta.15 build /home/runner/work/better-auth/better-auth/packages/sso
|
|
3
3
|
> tsdown
|
|
4
4
|
|
|
5
|
-
[34mℹ[39m tsdown [2mv0.15.
|
|
5
|
+
[34mℹ[39m tsdown [2mv0.15.11[22m powered by rolldown [2mv1.0.0-beta.45[22m
|
|
6
6
|
[34mℹ[39m Using tsdown config: [4m/home/runner/work/better-auth/better-auth/packages/sso/tsdown.config.ts[24m
|
|
7
7
|
[34mℹ[39m entry: [34msrc/client.ts, src/index.ts[39m
|
|
8
8
|
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
9
|
[34mℹ[39m Build start
|
|
10
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mclient.cjs[22m [2m 0.19 kB[22m [2m│ gzip: 0.
|
|
10
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mclient.cjs[22m [2m 0.19 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
11
11
|
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mindex.cjs[22m [2m 0.08 kB[22m [2m│ gzip: 0.08 kB[22m
|
|
12
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22msrc-
|
|
12
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22msrc-BsLnNXTo.cjs [2m52.34 kB[22m [2m│ gzip: 9.21 kB[22m
|
|
13
13
|
[34mℹ[39m [33m[CJS][39m 3 files, total: 52.61 kB
|
|
14
14
|
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mclient.js[22m [2m 0.18 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
15
15
|
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mindex.js[22m [2m 0.06 kB[22m [2m│ gzip: 0.07 kB[22m
|
|
16
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22msrc-
|
|
16
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22msrc-BEPbgggK.js [2m49.59 kB[22m [2m│ gzip: 8.54 kB[22m
|
|
17
17
|
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m 0.24 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
18
18
|
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mclient.d.ts[22m[39m [2m 0.21 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
19
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-
|
|
20
|
-
[34mℹ[39m [34m[ESM][39m 6 files, total:
|
|
19
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-CdeDxbNh.d.ts[39m [2m22.04 kB[22m [2m│ gzip: 3.15 kB[22m
|
|
20
|
+
[34mℹ[39m [34m[ESM][39m 6 files, total: 72.32 kB
|
|
21
21
|
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mindex.d.cts[22m[39m [2m 0.24 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
22
22
|
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mclient.d.cts[22m[39m [2m 0.21 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
23
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-
|
|
24
|
-
[34mℹ[39m [33m[CJS][39m 3 files, total:
|
|
25
|
-
[32m✔[39m Build complete in [
|
|
23
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-DJAIa5j3.d.cts[39m [2m22.04 kB[22m [2m│ gzip: 3.16 kB[22m
|
|
24
|
+
[34mℹ[39m [33m[CJS][39m 3 files, total: 22.50 kB
|
|
25
|
+
[32m✔[39m Build complete in [32m9377ms[39m
|
package/dist/client.cjs
CHANGED
package/dist/client.d.cts
CHANGED
package/dist/client.d.ts
CHANGED
package/dist/client.js
CHANGED
|
@@ -4,43 +4,43 @@ import * as better_call0 from "better-call";
|
|
|
4
4
|
|
|
5
5
|
//#region src/index.d.ts
|
|
6
6
|
interface OIDCMapping {
|
|
7
|
-
id?: string;
|
|
8
|
-
email?: string;
|
|
9
|
-
emailVerified?: string;
|
|
10
|
-
name?: string;
|
|
11
|
-
image?: string;
|
|
12
|
-
extraFields?: Record<string, string
|
|
7
|
+
id?: string | undefined;
|
|
8
|
+
email?: string | undefined;
|
|
9
|
+
emailVerified?: string | undefined;
|
|
10
|
+
name?: string | undefined;
|
|
11
|
+
image?: string | undefined;
|
|
12
|
+
extraFields?: Record<string, string> | undefined;
|
|
13
13
|
}
|
|
14
14
|
interface SAMLMapping {
|
|
15
|
-
id?: string;
|
|
16
|
-
email?: string;
|
|
17
|
-
emailVerified?: string;
|
|
18
|
-
name?: string;
|
|
19
|
-
firstName?: string;
|
|
20
|
-
lastName?: string;
|
|
21
|
-
extraFields?: Record<string, string
|
|
15
|
+
id?: string | undefined;
|
|
16
|
+
email?: string | undefined;
|
|
17
|
+
emailVerified?: string | undefined;
|
|
18
|
+
name?: string | undefined;
|
|
19
|
+
firstName?: string | undefined;
|
|
20
|
+
lastName?: string | undefined;
|
|
21
|
+
extraFields?: Record<string, string> | undefined;
|
|
22
22
|
}
|
|
23
23
|
interface OIDCConfig {
|
|
24
24
|
issuer: string;
|
|
25
25
|
pkce: boolean;
|
|
26
26
|
clientId: string;
|
|
27
27
|
clientSecret: string;
|
|
28
|
-
authorizationEndpoint?: string;
|
|
28
|
+
authorizationEndpoint?: string | undefined;
|
|
29
29
|
discoveryEndpoint: string;
|
|
30
|
-
userInfoEndpoint?: string;
|
|
31
|
-
scopes?: string[];
|
|
32
|
-
overrideUserInfo?: boolean;
|
|
33
|
-
tokenEndpoint?: string;
|
|
34
|
-
tokenEndpointAuthentication?: "client_secret_post" | "client_secret_basic";
|
|
35
|
-
jwksEndpoint?: string;
|
|
36
|
-
mapping?: OIDCMapping;
|
|
30
|
+
userInfoEndpoint?: string | undefined;
|
|
31
|
+
scopes?: string[] | undefined;
|
|
32
|
+
overrideUserInfo?: boolean | undefined;
|
|
33
|
+
tokenEndpoint?: string | undefined;
|
|
34
|
+
tokenEndpointAuthentication?: ("client_secret_post" | "client_secret_basic") | undefined;
|
|
35
|
+
jwksEndpoint?: string | undefined;
|
|
36
|
+
mapping?: OIDCMapping | undefined;
|
|
37
37
|
}
|
|
38
38
|
interface SAMLConfig {
|
|
39
39
|
issuer: string;
|
|
40
40
|
entryPoint: string;
|
|
41
41
|
cert: string;
|
|
42
42
|
callbackUrl: string;
|
|
43
|
-
audience?: string;
|
|
43
|
+
audience?: string | undefined;
|
|
44
44
|
idpMetadata?: {
|
|
45
45
|
metadata?: string;
|
|
46
46
|
entityID?: string;
|
|
@@ -56,39 +56,39 @@ interface SAMLConfig {
|
|
|
56
56
|
Binding: string;
|
|
57
57
|
Location: string;
|
|
58
58
|
}>;
|
|
59
|
-
};
|
|
59
|
+
} | undefined;
|
|
60
60
|
spMetadata: {
|
|
61
|
-
metadata?: string;
|
|
62
|
-
entityID?: string;
|
|
63
|
-
binding?: string;
|
|
64
|
-
privateKey?: string;
|
|
65
|
-
privateKeyPass?: string;
|
|
66
|
-
isAssertionEncrypted?: boolean;
|
|
67
|
-
encPrivateKey?: string;
|
|
68
|
-
encPrivateKeyPass?: string;
|
|
61
|
+
metadata?: string | undefined;
|
|
62
|
+
entityID?: string | undefined;
|
|
63
|
+
binding?: string | undefined;
|
|
64
|
+
privateKey?: string | undefined;
|
|
65
|
+
privateKeyPass?: string | undefined;
|
|
66
|
+
isAssertionEncrypted?: boolean | undefined;
|
|
67
|
+
encPrivateKey?: string | undefined;
|
|
68
|
+
encPrivateKeyPass?: string | undefined;
|
|
69
69
|
};
|
|
70
|
-
wantAssertionsSigned?: boolean;
|
|
71
|
-
signatureAlgorithm?: string;
|
|
72
|
-
digestAlgorithm?: string;
|
|
73
|
-
identifierFormat?: string;
|
|
74
|
-
privateKey?: string;
|
|
75
|
-
decryptionPvk?: string;
|
|
76
|
-
additionalParams?: Record<string, any
|
|
77
|
-
mapping?: SAMLMapping;
|
|
70
|
+
wantAssertionsSigned?: boolean | undefined;
|
|
71
|
+
signatureAlgorithm?: string | undefined;
|
|
72
|
+
digestAlgorithm?: string | undefined;
|
|
73
|
+
identifierFormat?: string | undefined;
|
|
74
|
+
privateKey?: string | undefined;
|
|
75
|
+
decryptionPvk?: string | undefined;
|
|
76
|
+
additionalParams?: Record<string, any> | undefined;
|
|
77
|
+
mapping?: SAMLMapping | undefined;
|
|
78
78
|
}
|
|
79
79
|
interface SSOProvider {
|
|
80
80
|
issuer: string;
|
|
81
|
-
oidcConfig?: OIDCConfig;
|
|
82
|
-
samlConfig?: SAMLConfig;
|
|
81
|
+
oidcConfig?: OIDCConfig | undefined;
|
|
82
|
+
samlConfig?: SAMLConfig | undefined;
|
|
83
83
|
userId: string;
|
|
84
84
|
providerId: string;
|
|
85
|
-
organizationId?: string;
|
|
85
|
+
organizationId?: string | undefined;
|
|
86
86
|
}
|
|
87
87
|
interface SSOOptions {
|
|
88
88
|
/**
|
|
89
89
|
* custom function to provision a user when they sign in with an SSO provider.
|
|
90
90
|
*/
|
|
91
|
-
provisionUser?: (data: {
|
|
91
|
+
provisionUser?: ((data: {
|
|
92
92
|
/**
|
|
93
93
|
* The user object from the database
|
|
94
94
|
*/
|
|
@@ -105,7 +105,7 @@ interface SSOOptions {
|
|
|
105
105
|
* The SSO provider
|
|
106
106
|
*/
|
|
107
107
|
provider: SSOProvider;
|
|
108
|
-
}) => Promise<void
|
|
108
|
+
}) => Promise<void>) | undefined;
|
|
109
109
|
/**
|
|
110
110
|
* Organization provisioning options
|
|
111
111
|
*/
|
|
@@ -130,7 +130,7 @@ interface SSOOptions {
|
|
|
130
130
|
*/
|
|
131
131
|
provider: SSOProvider;
|
|
132
132
|
}) => Promise<"member" | "admin">;
|
|
133
|
-
};
|
|
133
|
+
} | undefined;
|
|
134
134
|
/**
|
|
135
135
|
* Default SSO provider configurations for testing.
|
|
136
136
|
* These will take the precedence over the database providers.
|
|
@@ -153,17 +153,17 @@ interface SSOOptions {
|
|
|
153
153
|
* OIDC configuration
|
|
154
154
|
*/
|
|
155
155
|
oidcConfig?: OIDCConfig;
|
|
156
|
-
}
|
|
156
|
+
}> | undefined;
|
|
157
157
|
/**
|
|
158
158
|
* Override user info with the provider info.
|
|
159
159
|
* @default false
|
|
160
160
|
*/
|
|
161
|
-
defaultOverrideUserInfo?: boolean;
|
|
161
|
+
defaultOverrideUserInfo?: boolean | undefined;
|
|
162
162
|
/**
|
|
163
163
|
* Disable implicit sign up for new users. When set to true for the provider,
|
|
164
164
|
* sign-in need to be called with with requestSignUp as true to create new users.
|
|
165
165
|
*/
|
|
166
|
-
disableImplicitSignUp?: boolean;
|
|
166
|
+
disableImplicitSignUp?: boolean | undefined;
|
|
167
167
|
/**
|
|
168
168
|
* Configure the maximum number of SSO providers a user can register.
|
|
169
169
|
* You can also pass a function that returns a number.
|
|
@@ -178,14 +178,14 @@ interface SSOOptions {
|
|
|
178
178
|
* ```
|
|
179
179
|
* @default 10
|
|
180
180
|
*/
|
|
181
|
-
providersLimit?: number | ((user: User) => Promise<number> | number);
|
|
181
|
+
providersLimit?: (number | ((user: User) => Promise<number> | number)) | undefined;
|
|
182
182
|
/**
|
|
183
183
|
* Trust the email verified flag from the provider.
|
|
184
184
|
* @default false
|
|
185
185
|
*/
|
|
186
|
-
trustEmailVerified?: boolean;
|
|
186
|
+
trustEmailVerified?: boolean | undefined;
|
|
187
187
|
}
|
|
188
|
-
declare const sso: (options?: SSOOptions) => {
|
|
188
|
+
declare const sso: (options?: SSOOptions | undefined) => {
|
|
189
189
|
id: "sso";
|
|
190
190
|
endpoints: {
|
|
191
191
|
spMetadata: better_call0.StrictEndpoint<"/sso/saml2/sp/metadata", {
|
|
@@ -473,7 +473,7 @@ declare const sso: (options?: SSOOptions) => {
|
|
|
473
473
|
issuer: string;
|
|
474
474
|
userId: string;
|
|
475
475
|
providerId: string;
|
|
476
|
-
organizationId?: string;
|
|
476
|
+
organizationId?: string | undefined;
|
|
477
477
|
}>;
|
|
478
478
|
signInSSO: better_call0.StrictEndpoint<"/sign-in/sso", {
|
|
479
479
|
method: "POST";
|
|
@@ -4,43 +4,43 @@ import * as z from "zod/v4";
|
|
|
4
4
|
|
|
5
5
|
//#region src/index.d.ts
|
|
6
6
|
interface OIDCMapping {
|
|
7
|
-
id?: string;
|
|
8
|
-
email?: string;
|
|
9
|
-
emailVerified?: string;
|
|
10
|
-
name?: string;
|
|
11
|
-
image?: string;
|
|
12
|
-
extraFields?: Record<string, string
|
|
7
|
+
id?: string | undefined;
|
|
8
|
+
email?: string | undefined;
|
|
9
|
+
emailVerified?: string | undefined;
|
|
10
|
+
name?: string | undefined;
|
|
11
|
+
image?: string | undefined;
|
|
12
|
+
extraFields?: Record<string, string> | undefined;
|
|
13
13
|
}
|
|
14
14
|
interface SAMLMapping {
|
|
15
|
-
id?: string;
|
|
16
|
-
email?: string;
|
|
17
|
-
emailVerified?: string;
|
|
18
|
-
name?: string;
|
|
19
|
-
firstName?: string;
|
|
20
|
-
lastName?: string;
|
|
21
|
-
extraFields?: Record<string, string
|
|
15
|
+
id?: string | undefined;
|
|
16
|
+
email?: string | undefined;
|
|
17
|
+
emailVerified?: string | undefined;
|
|
18
|
+
name?: string | undefined;
|
|
19
|
+
firstName?: string | undefined;
|
|
20
|
+
lastName?: string | undefined;
|
|
21
|
+
extraFields?: Record<string, string> | undefined;
|
|
22
22
|
}
|
|
23
23
|
interface OIDCConfig {
|
|
24
24
|
issuer: string;
|
|
25
25
|
pkce: boolean;
|
|
26
26
|
clientId: string;
|
|
27
27
|
clientSecret: string;
|
|
28
|
-
authorizationEndpoint?: string;
|
|
28
|
+
authorizationEndpoint?: string | undefined;
|
|
29
29
|
discoveryEndpoint: string;
|
|
30
|
-
userInfoEndpoint?: string;
|
|
31
|
-
scopes?: string[];
|
|
32
|
-
overrideUserInfo?: boolean;
|
|
33
|
-
tokenEndpoint?: string;
|
|
34
|
-
tokenEndpointAuthentication?: "client_secret_post" | "client_secret_basic";
|
|
35
|
-
jwksEndpoint?: string;
|
|
36
|
-
mapping?: OIDCMapping;
|
|
30
|
+
userInfoEndpoint?: string | undefined;
|
|
31
|
+
scopes?: string[] | undefined;
|
|
32
|
+
overrideUserInfo?: boolean | undefined;
|
|
33
|
+
tokenEndpoint?: string | undefined;
|
|
34
|
+
tokenEndpointAuthentication?: ("client_secret_post" | "client_secret_basic") | undefined;
|
|
35
|
+
jwksEndpoint?: string | undefined;
|
|
36
|
+
mapping?: OIDCMapping | undefined;
|
|
37
37
|
}
|
|
38
38
|
interface SAMLConfig {
|
|
39
39
|
issuer: string;
|
|
40
40
|
entryPoint: string;
|
|
41
41
|
cert: string;
|
|
42
42
|
callbackUrl: string;
|
|
43
|
-
audience?: string;
|
|
43
|
+
audience?: string | undefined;
|
|
44
44
|
idpMetadata?: {
|
|
45
45
|
metadata?: string;
|
|
46
46
|
entityID?: string;
|
|
@@ -56,39 +56,39 @@ interface SAMLConfig {
|
|
|
56
56
|
Binding: string;
|
|
57
57
|
Location: string;
|
|
58
58
|
}>;
|
|
59
|
-
};
|
|
59
|
+
} | undefined;
|
|
60
60
|
spMetadata: {
|
|
61
|
-
metadata?: string;
|
|
62
|
-
entityID?: string;
|
|
63
|
-
binding?: string;
|
|
64
|
-
privateKey?: string;
|
|
65
|
-
privateKeyPass?: string;
|
|
66
|
-
isAssertionEncrypted?: boolean;
|
|
67
|
-
encPrivateKey?: string;
|
|
68
|
-
encPrivateKeyPass?: string;
|
|
61
|
+
metadata?: string | undefined;
|
|
62
|
+
entityID?: string | undefined;
|
|
63
|
+
binding?: string | undefined;
|
|
64
|
+
privateKey?: string | undefined;
|
|
65
|
+
privateKeyPass?: string | undefined;
|
|
66
|
+
isAssertionEncrypted?: boolean | undefined;
|
|
67
|
+
encPrivateKey?: string | undefined;
|
|
68
|
+
encPrivateKeyPass?: string | undefined;
|
|
69
69
|
};
|
|
70
|
-
wantAssertionsSigned?: boolean;
|
|
71
|
-
signatureAlgorithm?: string;
|
|
72
|
-
digestAlgorithm?: string;
|
|
73
|
-
identifierFormat?: string;
|
|
74
|
-
privateKey?: string;
|
|
75
|
-
decryptionPvk?: string;
|
|
76
|
-
additionalParams?: Record<string, any
|
|
77
|
-
mapping?: SAMLMapping;
|
|
70
|
+
wantAssertionsSigned?: boolean | undefined;
|
|
71
|
+
signatureAlgorithm?: string | undefined;
|
|
72
|
+
digestAlgorithm?: string | undefined;
|
|
73
|
+
identifierFormat?: string | undefined;
|
|
74
|
+
privateKey?: string | undefined;
|
|
75
|
+
decryptionPvk?: string | undefined;
|
|
76
|
+
additionalParams?: Record<string, any> | undefined;
|
|
77
|
+
mapping?: SAMLMapping | undefined;
|
|
78
78
|
}
|
|
79
79
|
interface SSOProvider {
|
|
80
80
|
issuer: string;
|
|
81
|
-
oidcConfig?: OIDCConfig;
|
|
82
|
-
samlConfig?: SAMLConfig;
|
|
81
|
+
oidcConfig?: OIDCConfig | undefined;
|
|
82
|
+
samlConfig?: SAMLConfig | undefined;
|
|
83
83
|
userId: string;
|
|
84
84
|
providerId: string;
|
|
85
|
-
organizationId?: string;
|
|
85
|
+
organizationId?: string | undefined;
|
|
86
86
|
}
|
|
87
87
|
interface SSOOptions {
|
|
88
88
|
/**
|
|
89
89
|
* custom function to provision a user when they sign in with an SSO provider.
|
|
90
90
|
*/
|
|
91
|
-
provisionUser?: (data: {
|
|
91
|
+
provisionUser?: ((data: {
|
|
92
92
|
/**
|
|
93
93
|
* The user object from the database
|
|
94
94
|
*/
|
|
@@ -105,7 +105,7 @@ interface SSOOptions {
|
|
|
105
105
|
* The SSO provider
|
|
106
106
|
*/
|
|
107
107
|
provider: SSOProvider;
|
|
108
|
-
}) => Promise<void
|
|
108
|
+
}) => Promise<void>) | undefined;
|
|
109
109
|
/**
|
|
110
110
|
* Organization provisioning options
|
|
111
111
|
*/
|
|
@@ -130,7 +130,7 @@ interface SSOOptions {
|
|
|
130
130
|
*/
|
|
131
131
|
provider: SSOProvider;
|
|
132
132
|
}) => Promise<"member" | "admin">;
|
|
133
|
-
};
|
|
133
|
+
} | undefined;
|
|
134
134
|
/**
|
|
135
135
|
* Default SSO provider configurations for testing.
|
|
136
136
|
* These will take the precedence over the database providers.
|
|
@@ -153,17 +153,17 @@ interface SSOOptions {
|
|
|
153
153
|
* OIDC configuration
|
|
154
154
|
*/
|
|
155
155
|
oidcConfig?: OIDCConfig;
|
|
156
|
-
}
|
|
156
|
+
}> | undefined;
|
|
157
157
|
/**
|
|
158
158
|
* Override user info with the provider info.
|
|
159
159
|
* @default false
|
|
160
160
|
*/
|
|
161
|
-
defaultOverrideUserInfo?: boolean;
|
|
161
|
+
defaultOverrideUserInfo?: boolean | undefined;
|
|
162
162
|
/**
|
|
163
163
|
* Disable implicit sign up for new users. When set to true for the provider,
|
|
164
164
|
* sign-in need to be called with with requestSignUp as true to create new users.
|
|
165
165
|
*/
|
|
166
|
-
disableImplicitSignUp?: boolean;
|
|
166
|
+
disableImplicitSignUp?: boolean | undefined;
|
|
167
167
|
/**
|
|
168
168
|
* Configure the maximum number of SSO providers a user can register.
|
|
169
169
|
* You can also pass a function that returns a number.
|
|
@@ -178,14 +178,14 @@ interface SSOOptions {
|
|
|
178
178
|
* ```
|
|
179
179
|
* @default 10
|
|
180
180
|
*/
|
|
181
|
-
providersLimit?: number | ((user: User) => Promise<number> | number);
|
|
181
|
+
providersLimit?: (number | ((user: User) => Promise<number> | number)) | undefined;
|
|
182
182
|
/**
|
|
183
183
|
* Trust the email verified flag from the provider.
|
|
184
184
|
* @default false
|
|
185
185
|
*/
|
|
186
|
-
trustEmailVerified?: boolean;
|
|
186
|
+
trustEmailVerified?: boolean | undefined;
|
|
187
187
|
}
|
|
188
|
-
declare const sso: (options?: SSOOptions) => {
|
|
188
|
+
declare const sso: (options?: SSOOptions | undefined) => {
|
|
189
189
|
id: "sso";
|
|
190
190
|
endpoints: {
|
|
191
191
|
spMetadata: better_call0.StrictEndpoint<"/sso/saml2/sp/metadata", {
|
|
@@ -473,7 +473,7 @@ declare const sso: (options?: SSOOptions) => {
|
|
|
473
473
|
issuer: string;
|
|
474
474
|
userId: string;
|
|
475
475
|
providerId: string;
|
|
476
|
-
organizationId?: string;
|
|
476
|
+
organizationId?: string | undefined;
|
|
477
477
|
}>;
|
|
478
478
|
signInSSO: better_call0.StrictEndpoint<"/sign-in/sso", {
|
|
479
479
|
method: "POST";
|
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as SSOOptions, i as SAMLMapping, n as OIDCMapping, o as SSOProvider, r as SAMLConfig, s as sso, t as OIDCConfig } from "./index-
|
|
1
|
+
import { a as SSOOptions, i as SAMLMapping, n as OIDCMapping, o as SSOProvider, r as SAMLConfig, s as sso, t as OIDCConfig } from "./index-DJAIa5j3.cjs";
|
|
2
2
|
export { OIDCConfig, OIDCMapping, SAMLConfig, SAMLMapping, SSOOptions, SSOProvider, sso };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as SSOOptions, i as SAMLMapping, n as OIDCMapping, o as SSOProvider, r as SAMLConfig, s as sso, t as OIDCConfig } from "./index-
|
|
1
|
+
import { a as SSOOptions, i as SAMLMapping, n as OIDCMapping, o as SSOProvider, r as SAMLConfig, s as sso, t as OIDCConfig } from "./index-CdeDxbNh.js";
|
|
2
2
|
export { OIDCConfig, OIDCMapping, SAMLConfig, SAMLMapping, SSOOptions, SSOProvider, sso };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { BetterFetchError, betterFetch } from "@better-fetch/fetch";
|
|
1
2
|
import { generateState } from "better-auth";
|
|
2
3
|
import { APIError, sessionMiddleware } from "better-auth/api";
|
|
4
|
+
import { setSessionCookie } from "better-auth/cookies";
|
|
3
5
|
import { createAuthorizationURL, handleOAuthUserInfo, parseState, validateAuthorizationCode, validateToken } from "better-auth/oauth2";
|
|
4
6
|
import { createAuthEndpoint } from "better-auth/plugins";
|
|
5
|
-
import * as z from "zod/v4";
|
|
6
|
-
import * as saml from "samlify";
|
|
7
|
-
import { BetterFetchError, betterFetch } from "@better-fetch/fetch";
|
|
8
|
-
import { decodeJwt } from "jose";
|
|
9
|
-
import { setSessionCookie } from "better-auth/cookies";
|
|
10
7
|
import { XMLValidator } from "fast-xml-parser";
|
|
8
|
+
import { decodeJwt } from "jose";
|
|
9
|
+
import * as saml from "samlify";
|
|
10
|
+
import * as z from "zod/v4";
|
|
11
11
|
|
|
12
12
|
//#region src/index.ts
|
|
13
13
|
saml.setSchemaValidator({ async validate(xml) {
|
|
@@ -21,26 +21,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
}) : target, mod));
|
|
22
22
|
|
|
23
23
|
//#endregion
|
|
24
|
+
let __better_fetch_fetch = require("@better-fetch/fetch");
|
|
25
|
+
__better_fetch_fetch = __toESM(__better_fetch_fetch);
|
|
24
26
|
let better_auth = require("better-auth");
|
|
25
27
|
better_auth = __toESM(better_auth);
|
|
26
28
|
let better_auth_api = require("better-auth/api");
|
|
27
29
|
better_auth_api = __toESM(better_auth_api);
|
|
30
|
+
let better_auth_cookies = require("better-auth/cookies");
|
|
31
|
+
better_auth_cookies = __toESM(better_auth_cookies);
|
|
28
32
|
let better_auth_oauth2 = require("better-auth/oauth2");
|
|
29
33
|
better_auth_oauth2 = __toESM(better_auth_oauth2);
|
|
30
34
|
let better_auth_plugins = require("better-auth/plugins");
|
|
31
35
|
better_auth_plugins = __toESM(better_auth_plugins);
|
|
32
|
-
let zod_v4 = require("zod/v4");
|
|
33
|
-
zod_v4 = __toESM(zod_v4);
|
|
34
|
-
let samlify = require("samlify");
|
|
35
|
-
samlify = __toESM(samlify);
|
|
36
|
-
let __better_fetch_fetch = require("@better-fetch/fetch");
|
|
37
|
-
__better_fetch_fetch = __toESM(__better_fetch_fetch);
|
|
38
|
-
let jose = require("jose");
|
|
39
|
-
jose = __toESM(jose);
|
|
40
|
-
let better_auth_cookies = require("better-auth/cookies");
|
|
41
|
-
better_auth_cookies = __toESM(better_auth_cookies);
|
|
42
36
|
let fast_xml_parser = require("fast-xml-parser");
|
|
43
37
|
fast_xml_parser = __toESM(fast_xml_parser);
|
|
38
|
+
let jose = require("jose");
|
|
39
|
+
jose = __toESM(jose);
|
|
40
|
+
let samlify = require("samlify");
|
|
41
|
+
samlify = __toESM(samlify);
|
|
42
|
+
let zod_v4 = require("zod/v4");
|
|
43
|
+
zod_v4 = __toESM(zod_v4);
|
|
44
44
|
|
|
45
45
|
//#region src/index.ts
|
|
46
46
|
samlify.setSchemaValidator({ async validate(xml) {
|
package/package.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/sso",
|
|
3
3
|
"author": "Bereket Engida",
|
|
4
|
-
"version": "1.4.0-beta.
|
|
4
|
+
"version": "1.4.0-beta.15",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
|
+
"homepage": "https://www.better-auth.com/docs/plugins/sso",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/better-auth/better-auth",
|
|
11
|
+
"directory": "packages/sso"
|
|
12
|
+
},
|
|
7
13
|
"license": "MIT",
|
|
8
14
|
"keywords": [
|
|
9
15
|
"sso",
|
|
@@ -56,15 +62,15 @@
|
|
|
56
62
|
},
|
|
57
63
|
"devDependencies": {
|
|
58
64
|
"@types/body-parser": "^1.19.6",
|
|
59
|
-
"@types/express": "^5.0.
|
|
65
|
+
"@types/express": "^5.0.5",
|
|
60
66
|
"better-call": "1.0.24",
|
|
61
67
|
"body-parser": "^2.2.0",
|
|
62
68
|
"express": "^5.1.0",
|
|
63
|
-
"tsdown": "^0.15.
|
|
64
|
-
"better-auth": "^1.4.0-beta.
|
|
69
|
+
"tsdown": "^0.15.11",
|
|
70
|
+
"better-auth": "^1.4.0-beta.15"
|
|
65
71
|
},
|
|
66
72
|
"peerDependencies": {
|
|
67
|
-
"better-auth": "1.4.0-beta.
|
|
73
|
+
"better-auth": "1.4.0-beta.15"
|
|
68
74
|
},
|
|
69
75
|
"scripts": {
|
|
70
76
|
"test": "vitest",
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { BetterFetchError, betterFetch } from "@better-fetch/fetch";
|
|
1
2
|
import {
|
|
2
|
-
generateState,
|
|
3
3
|
type Account,
|
|
4
4
|
type BetterAuthPlugin,
|
|
5
|
+
generateState,
|
|
5
6
|
type OAuth2Tokens,
|
|
6
7
|
type Session,
|
|
7
8
|
type User,
|
|
8
9
|
} from "better-auth";
|
|
9
10
|
import { APIError, sessionMiddleware } from "better-auth/api";
|
|
11
|
+
import { setSessionCookie } from "better-auth/cookies";
|
|
10
12
|
import {
|
|
11
13
|
createAuthorizationURL,
|
|
12
14
|
handleOAuthUserInfo,
|
|
@@ -14,17 +16,14 @@ import {
|
|
|
14
16
|
validateAuthorizationCode,
|
|
15
17
|
validateToken,
|
|
16
18
|
} from "better-auth/oauth2";
|
|
17
|
-
|
|
18
19
|
import { createAuthEndpoint } from "better-auth/plugins";
|
|
19
|
-
import
|
|
20
|
+
import { XMLValidator } from "fast-xml-parser";
|
|
21
|
+
import { decodeJwt } from "jose";
|
|
20
22
|
import * as saml from "samlify";
|
|
21
23
|
import type { BindingContext } from "samlify/types/src/entity";
|
|
22
|
-
import { betterFetch, BetterFetchError } from "@better-fetch/fetch";
|
|
23
|
-
import { decodeJwt } from "jose";
|
|
24
|
-
import { setSessionCookie } from "better-auth/cookies";
|
|
25
|
-
import type { FlowResult } from "samlify/types/src/flow";
|
|
26
|
-
import { XMLValidator } from "fast-xml-parser";
|
|
27
24
|
import type { IdentityProvider } from "samlify/types/src/entity-idp";
|
|
25
|
+
import type { FlowResult } from "samlify/types/src/flow";
|
|
26
|
+
import * as z from "zod/v4";
|
|
28
27
|
|
|
29
28
|
const fastValidator = {
|
|
30
29
|
async validate(xml: string) {
|
|
@@ -67,22 +66,22 @@ function safeJsonParse<T>(value: string | T | null | undefined): T | null {
|
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
export interface OIDCMapping {
|
|
70
|
-
id?: string;
|
|
71
|
-
email?: string;
|
|
72
|
-
emailVerified?: string;
|
|
73
|
-
name?: string;
|
|
74
|
-
image?: string;
|
|
75
|
-
extraFields?: Record<string, string
|
|
69
|
+
id?: string | undefined;
|
|
70
|
+
email?: string | undefined;
|
|
71
|
+
emailVerified?: string | undefined;
|
|
72
|
+
name?: string | undefined;
|
|
73
|
+
image?: string | undefined;
|
|
74
|
+
extraFields?: Record<string, string> | undefined;
|
|
76
75
|
}
|
|
77
76
|
|
|
78
77
|
export interface SAMLMapping {
|
|
79
|
-
id?: string;
|
|
80
|
-
email?: string;
|
|
81
|
-
emailVerified?: string;
|
|
82
|
-
name?: string;
|
|
83
|
-
firstName?: string;
|
|
84
|
-
lastName?: string;
|
|
85
|
-
extraFields?: Record<string, string
|
|
78
|
+
id?: string | undefined;
|
|
79
|
+
email?: string | undefined;
|
|
80
|
+
emailVerified?: string | undefined;
|
|
81
|
+
name?: string | undefined;
|
|
82
|
+
firstName?: string | undefined;
|
|
83
|
+
lastName?: string | undefined;
|
|
84
|
+
extraFields?: Record<string, string> | undefined;
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
export interface OIDCConfig {
|
|
@@ -90,15 +89,17 @@ export interface OIDCConfig {
|
|
|
90
89
|
pkce: boolean;
|
|
91
90
|
clientId: string;
|
|
92
91
|
clientSecret: string;
|
|
93
|
-
authorizationEndpoint?: string;
|
|
92
|
+
authorizationEndpoint?: string | undefined;
|
|
94
93
|
discoveryEndpoint: string;
|
|
95
|
-
userInfoEndpoint?: string;
|
|
96
|
-
scopes?: string[];
|
|
97
|
-
overrideUserInfo?: boolean;
|
|
98
|
-
tokenEndpoint?: string;
|
|
99
|
-
tokenEndpointAuthentication?:
|
|
100
|
-
|
|
101
|
-
|
|
94
|
+
userInfoEndpoint?: string | undefined;
|
|
95
|
+
scopes?: string[] | undefined;
|
|
96
|
+
overrideUserInfo?: boolean | undefined;
|
|
97
|
+
tokenEndpoint?: string | undefined;
|
|
98
|
+
tokenEndpointAuthentication?:
|
|
99
|
+
| ("client_secret_post" | "client_secret_basic")
|
|
100
|
+
| undefined;
|
|
101
|
+
jwksEndpoint?: string | undefined;
|
|
102
|
+
mapping?: OIDCMapping | undefined;
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
export interface SAMLConfig {
|
|
@@ -106,132 +107,140 @@ export interface SAMLConfig {
|
|
|
106
107
|
entryPoint: string;
|
|
107
108
|
cert: string;
|
|
108
109
|
callbackUrl: string;
|
|
109
|
-
audience?: string;
|
|
110
|
-
idpMetadata?:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
110
|
+
audience?: string | undefined;
|
|
111
|
+
idpMetadata?:
|
|
112
|
+
| {
|
|
113
|
+
metadata?: string;
|
|
114
|
+
entityID?: string;
|
|
115
|
+
entityURL?: string;
|
|
116
|
+
redirectURL?: string;
|
|
117
|
+
cert?: string;
|
|
118
|
+
privateKey?: string;
|
|
119
|
+
privateKeyPass?: string;
|
|
120
|
+
isAssertionEncrypted?: boolean;
|
|
121
|
+
encPrivateKey?: string;
|
|
122
|
+
encPrivateKeyPass?: string;
|
|
123
|
+
singleSignOnService?: Array<{
|
|
124
|
+
Binding: string;
|
|
125
|
+
Location: string;
|
|
126
|
+
}>;
|
|
127
|
+
}
|
|
128
|
+
| undefined;
|
|
126
129
|
spMetadata: {
|
|
127
|
-
metadata?: string;
|
|
128
|
-
entityID?: string;
|
|
129
|
-
binding?: string;
|
|
130
|
-
privateKey?: string;
|
|
131
|
-
privateKeyPass?: string;
|
|
132
|
-
isAssertionEncrypted?: boolean;
|
|
133
|
-
encPrivateKey?: string;
|
|
134
|
-
encPrivateKeyPass?: string;
|
|
130
|
+
metadata?: string | undefined;
|
|
131
|
+
entityID?: string | undefined;
|
|
132
|
+
binding?: string | undefined;
|
|
133
|
+
privateKey?: string | undefined;
|
|
134
|
+
privateKeyPass?: string | undefined;
|
|
135
|
+
isAssertionEncrypted?: boolean | undefined;
|
|
136
|
+
encPrivateKey?: string | undefined;
|
|
137
|
+
encPrivateKeyPass?: string | undefined;
|
|
135
138
|
};
|
|
136
|
-
wantAssertionsSigned?: boolean;
|
|
137
|
-
signatureAlgorithm?: string;
|
|
138
|
-
digestAlgorithm?: string;
|
|
139
|
-
identifierFormat?: string;
|
|
140
|
-
privateKey?: string;
|
|
141
|
-
decryptionPvk?: string;
|
|
142
|
-
additionalParams?: Record<string, any
|
|
143
|
-
mapping?: SAMLMapping;
|
|
139
|
+
wantAssertionsSigned?: boolean | undefined;
|
|
140
|
+
signatureAlgorithm?: string | undefined;
|
|
141
|
+
digestAlgorithm?: string | undefined;
|
|
142
|
+
identifierFormat?: string | undefined;
|
|
143
|
+
privateKey?: string | undefined;
|
|
144
|
+
decryptionPvk?: string | undefined;
|
|
145
|
+
additionalParams?: Record<string, any> | undefined;
|
|
146
|
+
mapping?: SAMLMapping | undefined;
|
|
144
147
|
}
|
|
145
148
|
|
|
146
149
|
export interface SSOProvider {
|
|
147
150
|
issuer: string;
|
|
148
|
-
oidcConfig?: OIDCConfig;
|
|
149
|
-
samlConfig?: SAMLConfig;
|
|
151
|
+
oidcConfig?: OIDCConfig | undefined;
|
|
152
|
+
samlConfig?: SAMLConfig | undefined;
|
|
150
153
|
userId: string;
|
|
151
154
|
providerId: string;
|
|
152
|
-
organizationId?: string;
|
|
155
|
+
organizationId?: string | undefined;
|
|
153
156
|
}
|
|
154
157
|
|
|
155
158
|
export interface SSOOptions {
|
|
156
159
|
/**
|
|
157
160
|
* custom function to provision a user when they sign in with an SSO provider.
|
|
158
161
|
*/
|
|
159
|
-
provisionUser?:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
162
|
+
provisionUser?:
|
|
163
|
+
| ((data: {
|
|
164
|
+
/**
|
|
165
|
+
* The user object from the database
|
|
166
|
+
*/
|
|
167
|
+
user: User & Record<string, any>;
|
|
168
|
+
/**
|
|
169
|
+
* The user info object from the provider
|
|
170
|
+
*/
|
|
171
|
+
userInfo: Record<string, any>;
|
|
172
|
+
/**
|
|
173
|
+
* The OAuth2 tokens from the provider
|
|
174
|
+
*/
|
|
175
|
+
token?: OAuth2Tokens;
|
|
176
|
+
/**
|
|
177
|
+
* The SSO provider
|
|
178
|
+
*/
|
|
179
|
+
provider: SSOProvider;
|
|
180
|
+
}) => Promise<void>)
|
|
181
|
+
| undefined;
|
|
177
182
|
/**
|
|
178
183
|
* Organization provisioning options
|
|
179
184
|
*/
|
|
180
|
-
organizationProvisioning?:
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
185
|
+
organizationProvisioning?:
|
|
186
|
+
| {
|
|
187
|
+
disabled?: boolean;
|
|
188
|
+
defaultRole?: "member" | "admin";
|
|
189
|
+
getRole?: (data: {
|
|
190
|
+
/**
|
|
191
|
+
* The user object from the database
|
|
192
|
+
*/
|
|
193
|
+
user: User & Record<string, any>;
|
|
194
|
+
/**
|
|
195
|
+
* The user info object from the provider
|
|
196
|
+
*/
|
|
197
|
+
userInfo: Record<string, any>;
|
|
198
|
+
/**
|
|
199
|
+
* The OAuth2 tokens from the provider
|
|
200
|
+
*/
|
|
201
|
+
token?: OAuth2Tokens;
|
|
202
|
+
/**
|
|
203
|
+
* The SSO provider
|
|
204
|
+
*/
|
|
205
|
+
provider: SSOProvider;
|
|
206
|
+
}) => Promise<"member" | "admin">;
|
|
207
|
+
}
|
|
208
|
+
| undefined;
|
|
202
209
|
/**
|
|
203
210
|
* Default SSO provider configurations for testing.
|
|
204
211
|
* These will take the precedence over the database providers.
|
|
205
212
|
*/
|
|
206
|
-
defaultSSO?:
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
213
|
+
defaultSSO?:
|
|
214
|
+
| Array<{
|
|
215
|
+
/**
|
|
216
|
+
* The domain to match for this default provider.
|
|
217
|
+
* This is only used to match incoming requests to this default provider.
|
|
218
|
+
*/
|
|
219
|
+
domain: string;
|
|
220
|
+
/**
|
|
221
|
+
* The provider ID to use
|
|
222
|
+
*/
|
|
223
|
+
providerId: string;
|
|
224
|
+
/**
|
|
225
|
+
* SAML configuration
|
|
226
|
+
*/
|
|
227
|
+
samlConfig?: SAMLConfig;
|
|
228
|
+
/**
|
|
229
|
+
* OIDC configuration
|
|
230
|
+
*/
|
|
231
|
+
oidcConfig?: OIDCConfig;
|
|
232
|
+
}>
|
|
233
|
+
| undefined;
|
|
225
234
|
/**
|
|
226
235
|
* Override user info with the provider info.
|
|
227
236
|
* @default false
|
|
228
237
|
*/
|
|
229
|
-
defaultOverrideUserInfo?: boolean;
|
|
238
|
+
defaultOverrideUserInfo?: boolean | undefined;
|
|
230
239
|
/**
|
|
231
240
|
* Disable implicit sign up for new users. When set to true for the provider,
|
|
232
241
|
* sign-in need to be called with with requestSignUp as true to create new users.
|
|
233
242
|
*/
|
|
234
|
-
disableImplicitSignUp?: boolean;
|
|
243
|
+
disableImplicitSignUp?: boolean | undefined;
|
|
235
244
|
/**
|
|
236
245
|
* Configure the maximum number of SSO providers a user can register.
|
|
237
246
|
* You can also pass a function that returns a number.
|
|
@@ -246,15 +255,17 @@ export interface SSOOptions {
|
|
|
246
255
|
* ```
|
|
247
256
|
* @default 10
|
|
248
257
|
*/
|
|
249
|
-
providersLimit?:
|
|
258
|
+
providersLimit?:
|
|
259
|
+
| (number | ((user: User) => Promise<number> | number))
|
|
260
|
+
| undefined;
|
|
250
261
|
/**
|
|
251
262
|
* Trust the email verified flag from the provider.
|
|
252
263
|
* @default false
|
|
253
264
|
*/
|
|
254
|
-
trustEmailVerified?: boolean;
|
|
265
|
+
trustEmailVerified?: boolean | undefined;
|
|
255
266
|
}
|
|
256
267
|
|
|
257
|
-
export const sso = (options?: SSOOptions) => {
|
|
268
|
+
export const sso = (options?: SSOOptions | undefined) => {
|
|
258
269
|
return {
|
|
259
270
|
id: "sso",
|
|
260
271
|
endpoints: {
|
package/src/oidc.test.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
2
|
-
import { getTestInstanceMemory as getTestInstance } from "better-auth/test";
|
|
3
|
-
import { sso } from ".";
|
|
4
|
-
import { OAuth2Server } from "oauth2-mock-server";
|
|
5
1
|
import { betterFetch } from "@better-fetch/fetch";
|
|
6
|
-
import { organization } from "better-auth/plugins";
|
|
7
2
|
import { createAuthClient } from "better-auth/client";
|
|
3
|
+
import { organization } from "better-auth/plugins";
|
|
4
|
+
import { getTestInstanceMemory as getTestInstance } from "better-auth/test";
|
|
5
|
+
import { OAuth2Server } from "oauth2-mock-server";
|
|
6
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
7
|
+
import { sso } from ".";
|
|
8
8
|
import { ssoClient } from "./client";
|
|
9
9
|
|
|
10
10
|
let server = new OAuth2Server();
|
package/src/saml.test.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
afterAll,
|
|
3
|
-
beforeAll,
|
|
4
|
-
beforeEach,
|
|
5
|
-
describe,
|
|
6
|
-
expect,
|
|
7
|
-
it,
|
|
8
|
-
vi,
|
|
9
|
-
} from "vitest";
|
|
1
|
+
import { betterFetch } from "@better-fetch/fetch";
|
|
10
2
|
import { betterAuth } from "better-auth";
|
|
11
3
|
import { memoryAdapter } from "better-auth/adapters/memory";
|
|
12
4
|
import { createAuthClient } from "better-auth/client";
|
|
13
|
-
import { betterFetch } from "@better-fetch/fetch";
|
|
14
5
|
import { setCookieToHeader } from "better-auth/cookies";
|
|
15
6
|
import { bearer } from "better-auth/plugins";
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import * as saml from "samlify";
|
|
7
|
+
import { getTestInstanceMemory } from "better-auth/test";
|
|
8
|
+
import bodyParser from "body-parser";
|
|
9
|
+
import { randomUUID } from "crypto";
|
|
20
10
|
import type {
|
|
21
11
|
Application as ExpressApp,
|
|
22
12
|
Request as ExpressRequest,
|
|
23
13
|
Response as ExpressResponse,
|
|
24
14
|
} from "express";
|
|
25
15
|
import express from "express";
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import {
|
|
16
|
+
import { createServer } from "http";
|
|
17
|
+
import * as saml from "samlify";
|
|
18
|
+
import {
|
|
19
|
+
afterAll,
|
|
20
|
+
beforeAll,
|
|
21
|
+
beforeEach,
|
|
22
|
+
describe,
|
|
23
|
+
expect,
|
|
24
|
+
it,
|
|
25
|
+
vi,
|
|
26
|
+
} from "vitest";
|
|
27
|
+
import { sso } from ".";
|
|
28
|
+
import { ssoClient } from "./client";
|
|
29
29
|
|
|
30
30
|
const spMetadata = `
|
|
31
31
|
<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" entityID="http://localhost:3001/api/sso/saml2/sp/metadata">
|