@better-auth/sso 1.5.0-beta.13 → 1.5.0-beta.16

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/src/types.ts CHANGED
@@ -60,6 +60,10 @@ export interface SAMLConfig {
60
60
  Binding: string;
61
61
  Location: string;
62
62
  }>;
63
+ singleLogoutService?: Array<{
64
+ Binding: string;
65
+ Location: string;
66
+ }>;
63
67
  }
64
68
  | undefined;
65
69
  spMetadata: {
@@ -83,6 +87,25 @@ export interface SAMLConfig {
83
87
  mapping?: SAMLMapping | undefined;
84
88
  }
85
89
 
90
+ /** Session data stored during SAML login for Single Logout */
91
+ export interface SAMLSessionRecord {
92
+ sessionId: string;
93
+ providerId: string;
94
+ nameID: string;
95
+ sessionIndex?: string;
96
+ }
97
+
98
+ /** Parsed SAML assertion extract from samlify */
99
+ export interface SAMLAssertionExtract {
100
+ nameID?: string;
101
+ sessionIndex?: string;
102
+ inResponseTo?: string;
103
+ conditions?: {
104
+ notBefore?: string;
105
+ notOnOrAfter?: string;
106
+ };
107
+ }
108
+
86
109
  type BaseSSOProvider = {
87
110
  issuer: string;
88
111
  oidcConfig?: OIDCConfig | undefined;
@@ -253,12 +276,20 @@ export interface SSOOptions {
253
276
  */
254
277
  enabled?: boolean;
255
278
  /**
256
- * Prefix used to generate the domain verification token
279
+ * Prefix used to generate the domain verification token.
280
+ * An underscore is automatically prepended to follow DNS
281
+ * infrastructure subdomain conventions (RFC 8552), so do
282
+ * not include a leading underscore.
257
283
  *
258
- * @default "better-auth-token-"
284
+ * @default "better-auth-token"
259
285
  */
260
286
  tokenPrefix?: string;
261
287
  };
288
+ /**
289
+ * A shared redirect URI used by all OIDC providers instead of
290
+ * per-provider callback URLs. Can be a path or a full URL.
291
+ */
292
+ redirectURI?: string;
262
293
  /**
263
294
  * SAML security options for AuthnRequest/InResponseTo validation.
264
295
  * This prevents unsolicited responses, replay attacks, and cross-provider injection.
@@ -354,6 +385,26 @@ export interface SSOOptions {
354
385
  * @default 102400 (100KB)
355
386
  */
356
387
  maxMetadataSize?: number;
388
+ /**
389
+ * Enable SAML Single Logout
390
+ * @default false
391
+ */
392
+ enableSingleLogout?: boolean;
393
+ /**
394
+ * TTL for LogoutRequest records in milliseconds
395
+ * @default 300000 (5 minutes)
396
+ */
397
+ logoutRequestTTL?: number;
398
+ /**
399
+ * Require signed LogoutRequests from IdP
400
+ * @default false
401
+ */
402
+ wantLogoutRequestSigned?: boolean;
403
+ /**
404
+ * Require signed LogoutResponses from IdP
405
+ * @default false
406
+ */
407
+ wantLogoutResponseSigned?: boolean;
357
408
  };
358
409
  }
359
410
 
package/src/utils.test.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { describe, expect, it } from "vitest";
2
2
  import { validateEmailDomain } from "./utils";
3
3
 
4
+ /**
5
+ * @see https://github.com/better-auth/better-auth/issues/7324
6
+ */
4
7
  describe("validateEmailDomain", () => {
5
8
  // Tests for issue #7324: Enterprise multi-domain SSO support
6
9
  // https://github.com/better-auth/better-auth/issues/7324
package/vitest.config.ts CHANGED
@@ -1,3 +1,8 @@
1
1
  import { defineProject } from "vitest/config";
2
2
 
3
- export default defineProject({});
3
+ export default defineProject({
4
+ test: {
5
+ clearMocks: true,
6
+ restoreMocks: true,
7
+ },
8
+ });