@better-auth/sso 1.5.0-beta.18 → 1.5.0-beta.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # Better Auth SSO Plugin
2
+
3
+ Single Sign-On plugin for [Better Auth](https://www.better-auth.com) — add SAML and OIDC enterprise SSO to your application.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @better-auth/sso
9
+ ```
10
+
11
+ ## Documentation
12
+
13
+ For full documentation, visit [better-auth.com/docs/plugins/sso](https://www.better-auth.com/docs/plugins/sso).
14
+
15
+ ## License
16
+
17
+ MIT
package/package.json CHANGED
@@ -1,34 +1,37 @@
1
1
  {
2
2
  "name": "@better-auth/sso",
3
- "author": "Bereket Engida",
4
- "version": "1.5.0-beta.18",
3
+ "version": "1.5.0-beta.19",
4
+ "description": "SSO plugin for Better Auth",
5
5
  "type": "module",
6
- "main": "dist/index.mjs",
7
- "types": "dist/index.d.mts",
6
+ "license": "MIT",
8
7
  "homepage": "https://www.better-auth.com/docs/plugins/sso",
9
8
  "repository": {
10
9
  "type": "git",
11
10
  "url": "git+https://github.com/better-auth/better-auth.git",
12
11
  "directory": "packages/sso"
13
12
  },
14
- "license": "MIT",
13
+ "author": "Bereket Engida",
15
14
  "keywords": [
16
15
  "sso",
17
16
  "auth",
18
- "sso",
19
17
  "saml",
20
18
  "oauth",
21
19
  "oidc",
22
20
  "openid",
23
21
  "openid connect",
24
- "openid connect",
25
- "single sign on"
22
+ "single sign on",
23
+ "typescript",
24
+ "better-auth"
26
25
  ],
27
26
  "publishConfig": {
28
27
  "access": "public"
29
28
  },
30
- "module": "dist/index.mjs",
31
- "description": "SSO plugin for Better Auth",
29
+ "files": [
30
+ "dist"
31
+ ],
32
+ "main": "./dist/index.mjs",
33
+ "module": "./dist/index.mjs",
34
+ "types": "./dist/index.d.mts",
32
35
  "exports": {
33
36
  ".": {
34
37
  "dev-source": "./src/index.ts",
@@ -67,22 +70,22 @@
67
70
  "express": "^5.2.1",
68
71
  "oauth2-mock-server": "^8.2.1",
69
72
  "tsdown": "^0.20.3",
70
- "@better-auth/core": "1.5.0-beta.18",
71
- "better-auth": "1.5.0-beta.18"
73
+ "@better-auth/core": "1.5.0-beta.19",
74
+ "better-auth": "1.5.0-beta.19"
72
75
  },
73
76
  "peerDependencies": {
74
77
  "@better-auth/utils": "0.3.1",
75
78
  "better-call": "1.3.2",
76
- "@better-auth/core": "1.5.0-beta.18",
77
- "better-auth": "1.5.0-beta.18"
79
+ "@better-auth/core": "1.5.0-beta.19",
80
+ "better-auth": "1.5.0-beta.19"
78
81
  },
79
82
  "scripts": {
80
- "test": "vitest",
81
- "coverage": "vitest run --coverage --coverage.provider=istanbul",
82
- "lint:package": "publint run --strict",
83
- "lint:types": "attw --profile esm-only --pack .",
84
83
  "build": "tsdown",
85
84
  "dev": "tsdown --watch",
86
- "typecheck": "tsc --project tsconfig.json"
85
+ "lint:package": "publint run --strict",
86
+ "lint:types": "attw --profile esm-only --pack .",
87
+ "typecheck": "tsc --project tsconfig.json",
88
+ "test": "vitest",
89
+ "coverage": "vitest run --coverage --coverage.provider=istanbul"
87
90
  }
88
91
  }
@@ -1,20 +0,0 @@
1
-
2
- > @better-auth/sso@1.5.0-beta.18 build /home/runner/work/better-auth/better-auth/packages/sso
3
- > tsdown
4
-
5
- ℹ tsdown v0.20.3 powered by rolldown v1.0.0-rc.3
6
- ℹ config file: /home/runner/work/better-auth/better-auth/packages/sso/tsdown.config.ts
7
- ℹ entry: src/index.ts, src/client.ts
8
- ℹ tsconfig: tsconfig.json
9
- ℹ Build start
10
- ℹ dist/index.mjs 139.98 kB │ gzip: 27.81 kB
11
- ℹ dist/client.mjs  0.27 kB │ gzip: 0.21 kB
12
- ℹ dist/index.mjs.map 280.84 kB │ gzip: 53.93 kB
13
- ℹ dist/client.mjs.map  0.93 kB │ gzip: 0.50 kB
14
- ℹ dist/index.d.mts  3.79 kB │ gzip: 1.20 kB
15
- ℹ dist/client.d.mts  0.63 kB │ gzip: 0.36 kB
16
- ℹ dist/index-CbKvQr9M.d.mts  58.40 kB │ gzip: 10.28 kB
17
- ℹ 7 files, total: 484.83 kB
18
- [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugin `rolldown-plugin-dts:generate`. See https://rolldown.rs/options/checks#plugintimings for more details.
19
-
20
- ✔ Build complete in 34748ms
package/src/client.ts DELETED
@@ -1,29 +0,0 @@
1
- import type { BetterAuthClientPlugin } from "better-auth/client";
2
- import type { SSOPlugin } from "./index";
3
-
4
- interface SSOClientOptions {
5
- domainVerification?:
6
- | {
7
- enabled: boolean;
8
- }
9
- | undefined;
10
- }
11
-
12
- export const ssoClient = <CO extends SSOClientOptions>(
13
- options?: CO | undefined,
14
- ) => {
15
- return {
16
- id: "sso-client",
17
- $InferServerPlugin: {} as SSOPlugin<{
18
- domainVerification: {
19
- enabled: CO["domainVerification"] extends { enabled: true }
20
- ? true
21
- : false;
22
- };
23
- }>,
24
- pathMethods: {
25
- "/sso/providers": "GET",
26
- "/sso/get-provider": "GET",
27
- },
28
- } satisfies BetterAuthClientPlugin;
29
- };
package/src/constants.ts DELETED
@@ -1,79 +0,0 @@
1
- /**
2
- * SAML Constants
3
- *
4
- * Centralized constants for SAML SSO functionality.
5
- */
6
-
7
- // ============================================================================
8
- // Key Prefixes (for verification table storage)
9
- // ============================================================================
10
-
11
- /** Prefix for AuthnRequest IDs used in InResponseTo validation */
12
- export const AUTHN_REQUEST_KEY_PREFIX = "saml-authn-request:";
13
-
14
- /** Prefix for used Assertion IDs used in replay protection */
15
- export const USED_ASSERTION_KEY_PREFIX = "saml-used-assertion:";
16
-
17
- /** Prefix for SAML session data (NameID + SessionIndex) for SLO */
18
- export const SAML_SESSION_KEY_PREFIX = "saml-session:";
19
-
20
- /** Prefix for reverse lookup of SAML session by Better Auth session ID */
21
- export const SAML_SESSION_BY_ID_PREFIX = "saml-session-by-id:";
22
-
23
- /** Prefix for LogoutRequest IDs used in SP-initiated SLO validation */
24
- export const LOGOUT_REQUEST_KEY_PREFIX = "saml-logout-request:";
25
-
26
- // ============================================================================
27
- // Time-To-Live (TTL) Defaults
28
- // ============================================================================
29
-
30
- /**
31
- * Default TTL for AuthnRequest records (5 minutes).
32
- * This should be sufficient for most IdPs while protecting against stale requests.
33
- */
34
- export const DEFAULT_AUTHN_REQUEST_TTL_MS = 5 * 60 * 1000;
35
-
36
- /**
37
- * Default TTL for used assertion records (15 minutes).
38
- * This should match the maximum expected NotOnOrAfter window plus clock skew.
39
- */
40
- export const DEFAULT_ASSERTION_TTL_MS = 15 * 60 * 1000;
41
-
42
- /**
43
- * Default TTL for LogoutRequest records (5 minutes).
44
- * Should be sufficient for IdP to process and respond.
45
- */
46
- export const DEFAULT_LOGOUT_REQUEST_TTL_MS = 5 * 60 * 1000;
47
-
48
- /**
49
- * Default clock skew tolerance (5 minutes).
50
- * Allows for minor time differences between IdP and SP servers.
51
- *
52
- * Accommodates:
53
- * - Network latency and processing time
54
- * - Clock synchronization differences (NTP drift)
55
- * - Distributed systems across timezones
56
- */
57
- export const DEFAULT_CLOCK_SKEW_MS = 5 * 60 * 1000;
58
-
59
- // ============================================================================
60
- // Size Limits (DoS Protection)
61
- // ============================================================================
62
-
63
- /**
64
- * Default maximum size for SAML responses (256 KB).
65
- * Protects against memory exhaustion from oversized SAML payloads.
66
- */
67
- export const DEFAULT_MAX_SAML_RESPONSE_SIZE = 256 * 1024;
68
-
69
- /**
70
- * Default maximum size for IdP metadata (100 KB).
71
- * Protects against oversized metadata documents.
72
- */
73
- export const DEFAULT_MAX_SAML_METADATA_SIZE = 100 * 1024;
74
-
75
- // ============================================================================
76
- // SAML Status Codes
77
- // ============================================================================
78
-
79
- export const SAML_STATUS_SUCCESS = "urn:oasis:names:tc:SAML:2.0:status:Success";