@better-auth/sso 1.4.0-beta.15 → 1.4.0-beta.17
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 -18
- package/dist/{client.d.cts → client.d.mts} +1 -1
- package/dist/{client.js → client.mjs} +1 -1
- package/dist/{index-CdeDxbNh.d.ts → index-D8XmWYZn.d.mts} +7 -1
- package/dist/{index.d.cts → index.d.mts} +1 -1
- package/dist/index.mjs +3 -0
- package/dist/{src-BEPbgggK.js → src-D0TWWO55.mjs} +1 -1
- package/package.json +14 -16
- package/src/index.ts +7 -1
- package/src/oidc.test.ts +1 -1
- package/src/saml.test.ts +4 -4
- package/tsdown.config.ts +1 -1
- package/dist/client.cjs +0 -12
- package/dist/client.d.ts +0 -9
- package/dist/index-DJAIa5j3.d.cts +0 -688
- package/dist/index.cjs +0 -3
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -3
- package/dist/src-BsLnNXTo.cjs +0 -1256
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/sso@1.4.0-beta.
|
|
2
|
+
> @better-auth/sso@1.4.0-beta.17 build /home/runner/work/better-auth/better-auth/packages/sso
|
|
3
3
|
> tsdown
|
|
4
4
|
|
|
5
|
-
[34mℹ[39m tsdown [2mv0.
|
|
5
|
+
[34mℹ[39m tsdown [2mv0.16.0[22m powered by rolldown [2mv1.0.0-beta.46[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 [
|
|
11
|
-
[34mℹ[39m [
|
|
12
|
-
[34mℹ[39m [
|
|
13
|
-
[34mℹ[39m [
|
|
14
|
-
[34mℹ[39m [
|
|
15
|
-
[34mℹ[39m [
|
|
16
|
-
[34mℹ[39m
|
|
17
|
-
[
|
|
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-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
|
-
[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
|
-
[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-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
|
|
10
|
+
[34mℹ[39m [2mdist/[22m[1mclient.mjs[22m [2m 0.18 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m 0.06 kB[22m [2m│ gzip: 0.07 kB[22m
|
|
12
|
+
[34mℹ[39m [2mdist/[22msrc-D0TWWO55.mjs [2m49.60 kB[22m [2m│ gzip: 8.54 kB[22m
|
|
13
|
+
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 0.24 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
14
|
+
[34mℹ[39m [2mdist/[22m[32m[1mclient.d.mts[22m[39m [2m 0.21 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
15
|
+
[34mℹ[39m [2mdist/[22m[32mindex-D8XmWYZn.d.mts[39m [2m22.51 kB[22m [2m│ gzip: 3.39 kB[22m
|
|
16
|
+
[34mℹ[39m 6 files, total: 72.81 kB
|
|
17
|
+
[32m✔[39m Build complete in [32m11481ms[39m
|
|
@@ -181,6 +181,12 @@ interface SSOOptions {
|
|
|
181
181
|
providersLimit?: (number | ((user: User) => Promise<number> | number)) | undefined;
|
|
182
182
|
/**
|
|
183
183
|
* Trust the email verified flag from the provider.
|
|
184
|
+
*
|
|
185
|
+
* ⚠️ Use this with caution — it can lead to account takeover if misused. Only enable it if users **cannot freely register new providers**. You can
|
|
186
|
+
* prevent that by using `disabledPaths` or other safeguards to block provider registration from the client.
|
|
187
|
+
*
|
|
188
|
+
* If you want to allow account linking for specific trusted providers, enable the `accountLinking` option in your auth config and specify those
|
|
189
|
+
* providers in the `trustedProviders` list.
|
|
184
190
|
* @default false
|
|
185
191
|
*/
|
|
186
192
|
trustEmailVerified?: boolean | undefined;
|
|
@@ -193,8 +199,8 @@ declare const sso: (options?: SSOOptions | undefined) => {
|
|
|
193
199
|
query: z.ZodObject<{
|
|
194
200
|
providerId: z.ZodString;
|
|
195
201
|
format: z.ZodDefault<z.ZodEnum<{
|
|
196
|
-
json: "json";
|
|
197
202
|
xml: "xml";
|
|
203
|
+
json: "json";
|
|
198
204
|
}>>;
|
|
199
205
|
}, z.core.$strip>;
|
|
200
206
|
metadata: {
|
|
@@ -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-D8XmWYZn.mjs";
|
|
2
2
|
export { OIDCConfig, OIDCMapping, SAMLConfig, SAMLMapping, SSOOptions, SSOProvider, sso };
|
package/dist/index.mjs
ADDED
|
@@ -504,7 +504,7 @@ const sso = (options) => {
|
|
|
504
504
|
if (body.providerType === "saml" && !provider.samlConfig) throw new APIError("BAD_REQUEST", { message: "SAML provider is not configured" });
|
|
505
505
|
}
|
|
506
506
|
if (provider.oidcConfig && body.providerType !== "saml") {
|
|
507
|
-
const state = await generateState(ctx);
|
|
507
|
+
const state = await generateState(ctx, void 0, false);
|
|
508
508
|
const redirectURI = `${ctx.context.baseURL}/sso/callback/${provider.providerId}`;
|
|
509
509
|
const authorizationURL = await createAuthorizationURL({
|
|
510
510
|
id: provider.issuer,
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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.17",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "dist/index.
|
|
6
|
+
"main": "dist/index.mjs",
|
|
7
7
|
"homepage": "https://www.better-auth.com/docs/plugins/sso",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -26,29 +26,27 @@
|
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
|
-
"module": "dist/index.
|
|
29
|
+
"module": "dist/index.mjs",
|
|
30
30
|
"description": "SSO plugin for Better Auth",
|
|
31
31
|
"exports": {
|
|
32
32
|
".": {
|
|
33
33
|
"better-auth-dev-source": "./src/index.ts",
|
|
34
|
-
"types": "./dist/index.d.
|
|
35
|
-
"
|
|
36
|
-
"require": "./dist/index.cjs"
|
|
34
|
+
"types": "./dist/index.d.mts",
|
|
35
|
+
"default": "./dist/index.mjs"
|
|
37
36
|
},
|
|
38
37
|
"./client": {
|
|
39
38
|
"better-auth-dev-source": "./src/client.ts",
|
|
40
|
-
"types": "./dist/client.d.
|
|
41
|
-
"
|
|
42
|
-
"require": "./dist/client.cjs"
|
|
39
|
+
"types": "./dist/client.d.mts",
|
|
40
|
+
"default": "./dist/client.mjs"
|
|
43
41
|
}
|
|
44
42
|
},
|
|
45
43
|
"typesVersions": {
|
|
46
44
|
"*": {
|
|
47
45
|
"*": [
|
|
48
|
-
"./dist/index.d.
|
|
46
|
+
"./dist/index.d.mts"
|
|
49
47
|
],
|
|
50
48
|
"client": [
|
|
51
|
-
"./dist/client.d.
|
|
49
|
+
"./dist/client.d.mts"
|
|
52
50
|
]
|
|
53
51
|
}
|
|
54
52
|
},
|
|
@@ -56,21 +54,21 @@
|
|
|
56
54
|
"@better-fetch/fetch": "1.1.18",
|
|
57
55
|
"fast-xml-parser": "^5.2.5",
|
|
58
56
|
"jose": "^6.1.0",
|
|
59
|
-
"oauth2-mock-server": "^7.2.1",
|
|
60
57
|
"samlify": "^2.10.1",
|
|
61
58
|
"zod": "^4.1.5"
|
|
62
59
|
},
|
|
63
60
|
"devDependencies": {
|
|
64
61
|
"@types/body-parser": "^1.19.6",
|
|
65
62
|
"@types/express": "^5.0.5",
|
|
66
|
-
"better-call": "1.0.
|
|
63
|
+
"better-call": "1.0.26",
|
|
67
64
|
"body-parser": "^2.2.0",
|
|
68
65
|
"express": "^5.1.0",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
66
|
+
"oauth2-mock-server": "^7.2.1",
|
|
67
|
+
"tsdown": "^0.16.0",
|
|
68
|
+
"better-auth": "^1.4.0-beta.17"
|
|
71
69
|
},
|
|
72
70
|
"peerDependencies": {
|
|
73
|
-
"better-auth": "1.4.0-beta.
|
|
71
|
+
"better-auth": "1.4.0-beta.17"
|
|
74
72
|
},
|
|
75
73
|
"scripts": {
|
|
76
74
|
"test": "vitest",
|
package/src/index.ts
CHANGED
|
@@ -260,6 +260,12 @@ export interface SSOOptions {
|
|
|
260
260
|
| undefined;
|
|
261
261
|
/**
|
|
262
262
|
* Trust the email verified flag from the provider.
|
|
263
|
+
*
|
|
264
|
+
* ⚠️ Use this with caution — it can lead to account takeover if misused. Only enable it if users **cannot freely register new providers**. You can
|
|
265
|
+
* prevent that by using `disabledPaths` or other safeguards to block provider registration from the client.
|
|
266
|
+
*
|
|
267
|
+
* If you want to allow account linking for specific trusted providers, enable the `accountLinking` option in your auth config and specify those
|
|
268
|
+
* providers in the `trustedProviders` list.
|
|
263
269
|
* @default false
|
|
264
270
|
*/
|
|
265
271
|
trustEmailVerified?: boolean | undefined;
|
|
@@ -1149,7 +1155,7 @@ export const sso = (options?: SSOOptions | undefined) => {
|
|
|
1149
1155
|
}
|
|
1150
1156
|
}
|
|
1151
1157
|
if (provider.oidcConfig && body.providerType !== "saml") {
|
|
1152
|
-
const state = await generateState(ctx);
|
|
1158
|
+
const state = await generateState(ctx, undefined, false);
|
|
1153
1159
|
const redirectURI = `${ctx.context.baseURL}/sso/callback/${provider.providerId}`;
|
|
1154
1160
|
const authorizationURL = await createAuthorizationURL({
|
|
1155
1161
|
id: provider.issuer,
|
package/src/oidc.test.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { betterFetch } from "@better-fetch/fetch";
|
|
2
2
|
import { createAuthClient } from "better-auth/client";
|
|
3
3
|
import { organization } from "better-auth/plugins";
|
|
4
|
-
import {
|
|
4
|
+
import { getTestInstance } from "better-auth/test";
|
|
5
5
|
import { OAuth2Server } from "oauth2-mock-server";
|
|
6
6
|
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
7
7
|
import { sso } from ".";
|
package/src/saml.test.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { memoryAdapter } from "better-auth/adapters/memory";
|
|
|
4
4
|
import { createAuthClient } from "better-auth/client";
|
|
5
5
|
import { setCookieToHeader } from "better-auth/cookies";
|
|
6
6
|
import { bearer } from "better-auth/plugins";
|
|
7
|
-
import {
|
|
7
|
+
import { getTestInstance } from "better-auth/test";
|
|
8
8
|
import bodyParser from "body-parser";
|
|
9
9
|
import { randomUUID } from "crypto";
|
|
10
10
|
import type {
|
|
@@ -926,7 +926,7 @@ describe("SAML SSO", async () => {
|
|
|
926
926
|
});
|
|
927
927
|
|
|
928
928
|
it("should not allow creating a provider if limit is set to 0", async () => {
|
|
929
|
-
const { auth, signInWithTestUser } = await
|
|
929
|
+
const { auth, signInWithTestUser } = await getTestInstance({
|
|
930
930
|
plugins: [sso({ providersLimit: 0 })],
|
|
931
931
|
});
|
|
932
932
|
const { headers } = await signInWithTestUser();
|
|
@@ -957,7 +957,7 @@ describe("SAML SSO", async () => {
|
|
|
957
957
|
});
|
|
958
958
|
|
|
959
959
|
it("should not allow creating a provider if limit is reached", async () => {
|
|
960
|
-
const { auth, signInWithTestUser } = await
|
|
960
|
+
const { auth, signInWithTestUser } = await getTestInstance({
|
|
961
961
|
plugins: [sso({ providersLimit: 1 })],
|
|
962
962
|
});
|
|
963
963
|
const { headers } = await signInWithTestUser();
|
|
@@ -1011,7 +1011,7 @@ describe("SAML SSO", async () => {
|
|
|
1011
1011
|
});
|
|
1012
1012
|
|
|
1013
1013
|
it("should not allow creating a provider if limit from function is reached", async () => {
|
|
1014
|
-
const { auth, signInWithTestUser } = await
|
|
1014
|
+
const { auth, signInWithTestUser } = await getTestInstance({
|
|
1015
1015
|
plugins: [
|
|
1016
1016
|
sso({
|
|
1017
1017
|
providersLimit: async (user) => {
|
package/tsdown.config.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { defineConfig } from "tsdown";
|
|
|
2
2
|
|
|
3
3
|
export default defineConfig({
|
|
4
4
|
dts: { build: true, incremental: true },
|
|
5
|
-
format: ["esm"
|
|
5
|
+
format: ["esm"],
|
|
6
6
|
entry: ["./src/index.ts", "./src/client.ts"],
|
|
7
7
|
external: ["better-auth", "better-call", "@better-fetch/fetch", "stripe"],
|
|
8
8
|
});
|
package/dist/client.cjs
DELETED