@better-auth/sso 1.5.0-beta.8 → 1.5.0

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.
@@ -97,6 +97,10 @@ interface SAMLConfig {
97
97
  Binding: string;
98
98
  Location: string;
99
99
  }>;
100
+ singleLogoutService?: Array<{
101
+ Binding: string;
102
+ Location: string;
103
+ }>;
100
104
  } | undefined;
101
105
  spMetadata: {
102
106
  metadata?: string | undefined;
@@ -109,6 +113,7 @@ interface SAMLConfig {
109
113
  encPrivateKeyPass?: string | undefined;
110
114
  };
111
115
  wantAssertionsSigned?: boolean | undefined;
116
+ authnRequestsSigned?: boolean | undefined;
112
117
  signatureAlgorithm?: string | undefined;
113
118
  digestAlgorithm?: string | undefined;
114
119
  identifierFormat?: string | undefined;
@@ -278,12 +283,20 @@ interface SSOOptions {
278
283
  */
279
284
  enabled?: boolean;
280
285
  /**
281
- * Prefix used to generate the domain verification token
286
+ * Prefix used to generate the domain verification token.
287
+ * An underscore is automatically prepended to follow DNS
288
+ * infrastructure subdomain conventions (RFC 8552), so do
289
+ * not include a leading underscore.
282
290
  *
283
- * @default "better-auth-token-"
291
+ * @default "better-auth-token"
284
292
  */
285
293
  tokenPrefix?: string;
286
294
  };
295
+ /**
296
+ * A shared redirect URI used by all OIDC providers instead of
297
+ * per-provider callback URLs. Can be a path or a full URL.
298
+ */
299
+ redirectURI?: string;
287
300
  /**
288
301
  * SAML security options for AuthnRequest/InResponseTo validation.
289
302
  * This prevents unsolicited responses, replay attacks, and cross-provider injection.
@@ -379,6 +392,26 @@ interface SSOOptions {
379
392
  * @default 102400 (100KB)
380
393
  */
381
394
  maxMetadataSize?: number;
395
+ /**
396
+ * Enable SAML Single Logout
397
+ * @default false
398
+ */
399
+ enableSingleLogout?: boolean;
400
+ /**
401
+ * TTL for LogoutRequest records in milliseconds
402
+ * @default 300000 (5 minutes)
403
+ */
404
+ logoutRequestTTL?: number;
405
+ /**
406
+ * Require signed LogoutRequests from IdP
407
+ * @default false
408
+ */
409
+ wantLogoutRequestSigned?: boolean;
410
+ /**
411
+ * Require signed LogoutResponses from IdP
412
+ * @default false
413
+ */
414
+ wantLogoutResponseSigned?: boolean;
382
415
  };
383
416
  }
384
417
  //#endregion
@@ -481,6 +514,375 @@ declare const verifyDomain: (options: SSOOptions) => better_call0.StrictEndpoint
481
514
  }>)[];
482
515
  }, void>;
483
516
  //#endregion
517
+ //#region src/routes/providers.d.ts
518
+ declare const listSSOProviders: () => better_call0.StrictEndpoint<"/sso/providers", {
519
+ method: "GET";
520
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
521
+ session: {
522
+ session: Record<string, any> & {
523
+ id: string;
524
+ createdAt: Date;
525
+ updatedAt: Date;
526
+ userId: string;
527
+ expiresAt: Date;
528
+ token: string;
529
+ ipAddress?: string | null | undefined;
530
+ userAgent?: string | null | undefined;
531
+ };
532
+ user: Record<string, any> & {
533
+ id: string;
534
+ createdAt: Date;
535
+ updatedAt: Date;
536
+ email: string;
537
+ emailVerified: boolean;
538
+ name: string;
539
+ image?: string | null | undefined;
540
+ };
541
+ };
542
+ }>)[];
543
+ metadata: {
544
+ openapi: {
545
+ operationId: string;
546
+ summary: string;
547
+ description: string;
548
+ responses: {
549
+ "200": {
550
+ description: string;
551
+ };
552
+ };
553
+ };
554
+ };
555
+ }, {
556
+ providers: {
557
+ providerId: string;
558
+ type: string;
559
+ issuer: string;
560
+ domain: string;
561
+ organizationId: string | null;
562
+ domainVerified: boolean;
563
+ oidcConfig: {
564
+ discoveryEndpoint: string;
565
+ clientIdLastFour: string;
566
+ pkce: boolean;
567
+ authorizationEndpoint: string | undefined;
568
+ tokenEndpoint: string | undefined;
569
+ userInfoEndpoint: string | undefined;
570
+ jwksEndpoint: string | undefined;
571
+ scopes: string[] | undefined;
572
+ tokenEndpointAuthentication: "client_secret_post" | "client_secret_basic" | undefined;
573
+ } | undefined;
574
+ samlConfig: {
575
+ entryPoint: string;
576
+ callbackUrl: string;
577
+ audience: string | undefined;
578
+ wantAssertionsSigned: boolean | undefined;
579
+ authnRequestsSigned: boolean | undefined;
580
+ identifierFormat: string | undefined;
581
+ signatureAlgorithm: string | undefined;
582
+ digestAlgorithm: string | undefined;
583
+ certificate: {
584
+ fingerprintSha256: string;
585
+ notBefore: string;
586
+ notAfter: string;
587
+ publicKeyAlgorithm: string;
588
+ } | {
589
+ error: string;
590
+ };
591
+ } | undefined;
592
+ spMetadataUrl: string;
593
+ }[];
594
+ }>;
595
+ declare const getSSOProvider: () => better_call0.StrictEndpoint<"/sso/get-provider", {
596
+ method: "GET";
597
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
598
+ session: {
599
+ session: Record<string, any> & {
600
+ id: string;
601
+ createdAt: Date;
602
+ updatedAt: Date;
603
+ userId: string;
604
+ expiresAt: Date;
605
+ token: string;
606
+ ipAddress?: string | null | undefined;
607
+ userAgent?: string | null | undefined;
608
+ };
609
+ user: Record<string, any> & {
610
+ id: string;
611
+ createdAt: Date;
612
+ updatedAt: Date;
613
+ email: string;
614
+ emailVerified: boolean;
615
+ name: string;
616
+ image?: string | null | undefined;
617
+ };
618
+ };
619
+ }>)[];
620
+ query: z.ZodObject<{
621
+ providerId: z.ZodString;
622
+ }, z.core.$strip>;
623
+ metadata: {
624
+ openapi: {
625
+ operationId: string;
626
+ summary: string;
627
+ description: string;
628
+ responses: {
629
+ "200": {
630
+ description: string;
631
+ };
632
+ "404": {
633
+ description: string;
634
+ };
635
+ "403": {
636
+ description: string;
637
+ };
638
+ };
639
+ };
640
+ };
641
+ }, {
642
+ providerId: string;
643
+ type: string;
644
+ issuer: string;
645
+ domain: string;
646
+ organizationId: string | null;
647
+ domainVerified: boolean;
648
+ oidcConfig: {
649
+ discoveryEndpoint: string;
650
+ clientIdLastFour: string;
651
+ pkce: boolean;
652
+ authorizationEndpoint: string | undefined;
653
+ tokenEndpoint: string | undefined;
654
+ userInfoEndpoint: string | undefined;
655
+ jwksEndpoint: string | undefined;
656
+ scopes: string[] | undefined;
657
+ tokenEndpointAuthentication: "client_secret_post" | "client_secret_basic" | undefined;
658
+ } | undefined;
659
+ samlConfig: {
660
+ entryPoint: string;
661
+ callbackUrl: string;
662
+ audience: string | undefined;
663
+ wantAssertionsSigned: boolean | undefined;
664
+ authnRequestsSigned: boolean | undefined;
665
+ identifierFormat: string | undefined;
666
+ signatureAlgorithm: string | undefined;
667
+ digestAlgorithm: string | undefined;
668
+ certificate: {
669
+ fingerprintSha256: string;
670
+ notBefore: string;
671
+ notAfter: string;
672
+ publicKeyAlgorithm: string;
673
+ } | {
674
+ error: string;
675
+ };
676
+ } | undefined;
677
+ spMetadataUrl: string;
678
+ }>;
679
+ declare const updateSSOProvider: (options: SSOOptions) => better_call0.StrictEndpoint<"/sso/update-provider", {
680
+ method: "POST";
681
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
682
+ session: {
683
+ session: Record<string, any> & {
684
+ id: string;
685
+ createdAt: Date;
686
+ updatedAt: Date;
687
+ userId: string;
688
+ expiresAt: Date;
689
+ token: string;
690
+ ipAddress?: string | null | undefined;
691
+ userAgent?: string | null | undefined;
692
+ };
693
+ user: Record<string, any> & {
694
+ id: string;
695
+ createdAt: Date;
696
+ updatedAt: Date;
697
+ email: string;
698
+ emailVerified: boolean;
699
+ name: string;
700
+ image?: string | null | undefined;
701
+ };
702
+ };
703
+ }>)[];
704
+ body: z.ZodObject<{
705
+ issuer: z.ZodOptional<z.ZodString>;
706
+ domain: z.ZodOptional<z.ZodString>;
707
+ oidcConfig: z.ZodOptional<z.ZodObject<{
708
+ clientId: z.ZodOptional<z.ZodString>;
709
+ clientSecret: z.ZodOptional<z.ZodString>;
710
+ authorizationEndpoint: z.ZodOptional<z.ZodString>;
711
+ tokenEndpoint: z.ZodOptional<z.ZodString>;
712
+ userInfoEndpoint: z.ZodOptional<z.ZodString>;
713
+ tokenEndpointAuthentication: z.ZodOptional<z.ZodEnum<{
714
+ client_secret_post: "client_secret_post";
715
+ client_secret_basic: "client_secret_basic";
716
+ }>>;
717
+ jwksEndpoint: z.ZodOptional<z.ZodString>;
718
+ discoveryEndpoint: z.ZodOptional<z.ZodString>;
719
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
720
+ pkce: z.ZodOptional<z.ZodBoolean>;
721
+ overrideUserInfo: z.ZodOptional<z.ZodBoolean>;
722
+ mapping: z.ZodOptional<z.ZodObject<{
723
+ id: z.ZodOptional<z.ZodString>;
724
+ email: z.ZodOptional<z.ZodString>;
725
+ emailVerified: z.ZodOptional<z.ZodString>;
726
+ name: z.ZodOptional<z.ZodString>;
727
+ image: z.ZodOptional<z.ZodString>;
728
+ extraFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
729
+ }, z.core.$strip>>;
730
+ }, z.core.$strip>>;
731
+ samlConfig: z.ZodOptional<z.ZodObject<{
732
+ entryPoint: z.ZodOptional<z.ZodString>;
733
+ cert: z.ZodOptional<z.ZodString>;
734
+ callbackUrl: z.ZodOptional<z.ZodString>;
735
+ audience: z.ZodOptional<z.ZodString>;
736
+ idpMetadata: z.ZodOptional<z.ZodObject<{
737
+ metadata: z.ZodOptional<z.ZodString>;
738
+ entityID: z.ZodOptional<z.ZodString>;
739
+ cert: z.ZodOptional<z.ZodString>;
740
+ privateKey: z.ZodOptional<z.ZodString>;
741
+ privateKeyPass: z.ZodOptional<z.ZodString>;
742
+ isAssertionEncrypted: z.ZodOptional<z.ZodBoolean>;
743
+ encPrivateKey: z.ZodOptional<z.ZodString>;
744
+ encPrivateKeyPass: z.ZodOptional<z.ZodString>;
745
+ singleSignOnService: z.ZodOptional<z.ZodArray<z.ZodObject<{
746
+ Binding: z.ZodString;
747
+ Location: z.ZodString;
748
+ }, z.core.$strip>>>;
749
+ }, z.core.$strip>>;
750
+ spMetadata: z.ZodOptional<z.ZodObject<{
751
+ metadata: z.ZodOptional<z.ZodString>;
752
+ entityID: z.ZodOptional<z.ZodString>;
753
+ binding: z.ZodOptional<z.ZodString>;
754
+ privateKey: z.ZodOptional<z.ZodString>;
755
+ privateKeyPass: z.ZodOptional<z.ZodString>;
756
+ isAssertionEncrypted: z.ZodOptional<z.ZodBoolean>;
757
+ encPrivateKey: z.ZodOptional<z.ZodString>;
758
+ encPrivateKeyPass: z.ZodOptional<z.ZodString>;
759
+ }, z.core.$strip>>;
760
+ wantAssertionsSigned: z.ZodOptional<z.ZodBoolean>;
761
+ authnRequestsSigned: z.ZodOptional<z.ZodBoolean>;
762
+ signatureAlgorithm: z.ZodOptional<z.ZodString>;
763
+ digestAlgorithm: z.ZodOptional<z.ZodString>;
764
+ identifierFormat: z.ZodOptional<z.ZodString>;
765
+ privateKey: z.ZodOptional<z.ZodString>;
766
+ decryptionPvk: z.ZodOptional<z.ZodString>;
767
+ additionalParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
768
+ mapping: z.ZodOptional<z.ZodObject<{
769
+ id: z.ZodOptional<z.ZodString>;
770
+ email: z.ZodOptional<z.ZodString>;
771
+ emailVerified: z.ZodOptional<z.ZodString>;
772
+ name: z.ZodOptional<z.ZodString>;
773
+ firstName: z.ZodOptional<z.ZodString>;
774
+ lastName: z.ZodOptional<z.ZodString>;
775
+ extraFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
776
+ }, z.core.$strip>>;
777
+ }, z.core.$strip>>;
778
+ providerId: z.ZodString;
779
+ }, z.core.$strip>;
780
+ metadata: {
781
+ openapi: {
782
+ operationId: string;
783
+ summary: string;
784
+ description: string;
785
+ responses: {
786
+ "200": {
787
+ description: string;
788
+ };
789
+ "404": {
790
+ description: string;
791
+ };
792
+ "403": {
793
+ description: string;
794
+ };
795
+ };
796
+ };
797
+ };
798
+ }, {
799
+ providerId: string;
800
+ type: string;
801
+ issuer: string;
802
+ domain: string;
803
+ organizationId: string | null;
804
+ domainVerified: boolean;
805
+ oidcConfig: {
806
+ discoveryEndpoint: string;
807
+ clientIdLastFour: string;
808
+ pkce: boolean;
809
+ authorizationEndpoint: string | undefined;
810
+ tokenEndpoint: string | undefined;
811
+ userInfoEndpoint: string | undefined;
812
+ jwksEndpoint: string | undefined;
813
+ scopes: string[] | undefined;
814
+ tokenEndpointAuthentication: "client_secret_post" | "client_secret_basic" | undefined;
815
+ } | undefined;
816
+ samlConfig: {
817
+ entryPoint: string;
818
+ callbackUrl: string;
819
+ audience: string | undefined;
820
+ wantAssertionsSigned: boolean | undefined;
821
+ authnRequestsSigned: boolean | undefined;
822
+ identifierFormat: string | undefined;
823
+ signatureAlgorithm: string | undefined;
824
+ digestAlgorithm: string | undefined;
825
+ certificate: {
826
+ fingerprintSha256: string;
827
+ notBefore: string;
828
+ notAfter: string;
829
+ publicKeyAlgorithm: string;
830
+ } | {
831
+ error: string;
832
+ };
833
+ } | undefined;
834
+ spMetadataUrl: string;
835
+ }>;
836
+ declare const deleteSSOProvider: () => better_call0.StrictEndpoint<"/sso/delete-provider", {
837
+ method: "POST";
838
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
839
+ session: {
840
+ session: Record<string, any> & {
841
+ id: string;
842
+ createdAt: Date;
843
+ updatedAt: Date;
844
+ userId: string;
845
+ expiresAt: Date;
846
+ token: string;
847
+ ipAddress?: string | null | undefined;
848
+ userAgent?: string | null | undefined;
849
+ };
850
+ user: Record<string, any> & {
851
+ id: string;
852
+ createdAt: Date;
853
+ updatedAt: Date;
854
+ email: string;
855
+ emailVerified: boolean;
856
+ name: string;
857
+ image?: string | null | undefined;
858
+ };
859
+ };
860
+ }>)[];
861
+ body: z.ZodObject<{
862
+ providerId: z.ZodString;
863
+ }, z.core.$strip>;
864
+ metadata: {
865
+ openapi: {
866
+ operationId: string;
867
+ summary: string;
868
+ description: string;
869
+ responses: {
870
+ "200": {
871
+ description: string;
872
+ };
873
+ "404": {
874
+ description: string;
875
+ };
876
+ "403": {
877
+ description: string;
878
+ };
879
+ };
880
+ };
881
+ };
882
+ }, {
883
+ success: boolean;
884
+ }>;
885
+ //#endregion
484
886
  //#region src/routes/sso.d.ts
485
887
  interface TimestampValidationOptions {
486
888
  clockSkew?: number;
@@ -500,13 +902,13 @@ interface SAMLConditions {
500
902
  * @throws {APIError} If timestamps are invalid, expired, or not yet valid
501
903
  */
502
904
  declare function validateSAMLTimestamp(conditions: SAMLConditions | undefined, options?: TimestampValidationOptions): void;
503
- declare const spMetadata: () => better_call0.StrictEndpoint<"/sso/saml2/sp/metadata", {
905
+ declare const spMetadata: (options?: SSOOptions) => better_call0.StrictEndpoint<"/sso/saml2/sp/metadata", {
504
906
  method: "GET";
505
907
  query: z.ZodObject<{
506
908
  providerId: z.ZodString;
507
909
  format: z.ZodDefault<z.ZodEnum<{
508
- xml: "xml";
509
910
  json: "json";
911
+ xml: "xml";
510
912
  }>>;
511
913
  }, z.core.$strip>;
512
914
  metadata: {
@@ -582,6 +984,7 @@ declare const registerSSOProvider: <O extends SSOOptions>(options: O) => better_
582
984
  encPrivateKeyPass: z.ZodOptional<z.ZodString>;
583
985
  }, z.core.$strip>;
584
986
  wantAssertionsSigned: z.ZodOptional<z.ZodBoolean>;
987
+ authnRequestsSigned: z.ZodOptional<z.ZodBoolean>;
585
988
  signatureAlgorithm: z.ZodOptional<z.ZodString>;
586
989
  digestAlgorithm: z.ZodOptional<z.ZodString>;
587
990
  identifierFormat: z.ZodOptional<z.ZodString>;
@@ -901,7 +1304,7 @@ declare const callbackSSO: (options?: SSOOptions) => better_call0.StrictEndpoint
901
1304
  error: z.ZodOptional<z.ZodString>;
902
1305
  error_description: z.ZodOptional<z.ZodString>;
903
1306
  }, z.core.$strip>;
904
- allowedMediaTypes: string[];
1307
+ allowedMediaTypes: readonly ["application/x-www-form-urlencoded", "application/json"];
905
1308
  metadata: {
906
1309
  openapi: {
907
1310
  operationId: string;
@@ -915,7 +1318,35 @@ declare const callbackSSO: (options?: SSOOptions) => better_call0.StrictEndpoint
915
1318
  };
916
1319
  scope: "server";
917
1320
  };
918
- }, never>;
1321
+ }, void>;
1322
+ /**
1323
+ * Shared OIDC callback endpoint (no `:providerId` in path).
1324
+ * Used when `options.redirectURI` is set — the `providerId` is read from
1325
+ * the OAuth state instead of the URL path.
1326
+ */
1327
+ declare const callbackSSOShared: (options?: SSOOptions) => better_call0.StrictEndpoint<"/sso/callback", {
1328
+ metadata: {
1329
+ openapi: {
1330
+ operationId: string;
1331
+ summary: string;
1332
+ description: string;
1333
+ responses: {
1334
+ "302": {
1335
+ description: string;
1336
+ };
1337
+ };
1338
+ };
1339
+ scope: "server";
1340
+ };
1341
+ method: "GET";
1342
+ query: z.ZodObject<{
1343
+ code: z.ZodOptional<z.ZodString>;
1344
+ state: z.ZodString;
1345
+ error: z.ZodOptional<z.ZodString>;
1346
+ error_description: z.ZodOptional<z.ZodString>;
1347
+ }, z.core.$strip>;
1348
+ allowedMediaTypes: readonly ["application/x-www-form-urlencoded", "application/json"];
1349
+ }, void>;
919
1350
  declare const callbackSSOSAML: (options?: SSOOptions) => better_call0.StrictEndpoint<"/sso/saml2/callback/:providerId", {
920
1351
  method: ("POST" | "GET")[];
921
1352
  body: z.ZodOptional<z.ZodObject<{
@@ -948,9 +1379,6 @@ declare const callbackSSOSAML: (options?: SSOOptions) => better_call0.StrictEndp
948
1379
  }, never>;
949
1380
  declare const acsEndpoint: (options?: SSOOptions) => better_call0.StrictEndpoint<"/sso/saml2/sp/acs/:providerId", {
950
1381
  method: "POST";
951
- params: z.ZodObject<{
952
- providerId: z.ZodOptional<z.ZodString>;
953
- }, z.core.$strip>;
954
1382
  body: z.ZodObject<{
955
1383
  SAMLResponse: z.ZodString;
956
1384
  RelayState: z.ZodOptional<z.ZodString>;
@@ -970,6 +1398,59 @@ declare const acsEndpoint: (options?: SSOOptions) => better_call0.StrictEndpoint
970
1398
  scope: "server";
971
1399
  };
972
1400
  }, never>;
1401
+ declare const sloEndpoint: (options?: SSOOptions) => better_call0.StrictEndpoint<"/sso/saml2/sp/slo/:providerId", {
1402
+ method: ("POST" | "GET")[];
1403
+ body: z.ZodOptional<z.ZodObject<{
1404
+ SAMLRequest: z.ZodOptional<z.ZodString>;
1405
+ SAMLResponse: z.ZodOptional<z.ZodString>;
1406
+ RelayState: z.ZodOptional<z.ZodString>;
1407
+ SigAlg: z.ZodOptional<z.ZodString>;
1408
+ Signature: z.ZodOptional<z.ZodString>;
1409
+ }, z.core.$strip>>;
1410
+ query: z.ZodOptional<z.ZodObject<{
1411
+ SAMLRequest: z.ZodOptional<z.ZodString>;
1412
+ SAMLResponse: z.ZodOptional<z.ZodString>;
1413
+ RelayState: z.ZodOptional<z.ZodString>;
1414
+ SigAlg: z.ZodOptional<z.ZodString>;
1415
+ Signature: z.ZodOptional<z.ZodString>;
1416
+ }, z.core.$strip>>;
1417
+ metadata: {
1418
+ allowedMediaTypes: string[];
1419
+ scope: "server";
1420
+ };
1421
+ }, void | Response>;
1422
+ declare const initiateSLO: (options?: SSOOptions) => better_call0.StrictEndpoint<"/sso/saml2/logout/:providerId", {
1423
+ method: "POST";
1424
+ body: z.ZodObject<{
1425
+ callbackURL: z.ZodOptional<z.ZodString>;
1426
+ }, z.core.$strip>;
1427
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
1428
+ session: {
1429
+ session: Record<string, any> & {
1430
+ id: string;
1431
+ createdAt: Date;
1432
+ updatedAt: Date;
1433
+ userId: string;
1434
+ expiresAt: Date;
1435
+ token: string;
1436
+ ipAddress?: string | null | undefined;
1437
+ userAgent?: string | null | undefined;
1438
+ };
1439
+ user: Record<string, any> & {
1440
+ id: string;
1441
+ createdAt: Date;
1442
+ updatedAt: Date;
1443
+ email: string;
1444
+ emailVerified: boolean;
1445
+ name: string;
1446
+ image?: string | null | undefined;
1447
+ };
1448
+ };
1449
+ }>)[];
1450
+ metadata: {
1451
+ readonly scope: "server";
1452
+ };
1453
+ }, never>;
973
1454
  //#endregion
974
1455
  //#region src/constants.d.ts
975
1456
  /**
@@ -1068,16 +1549,7 @@ interface OIDCDiscoveryDocument {
1068
1549
  /**
1069
1550
  * Error codes for OIDC discovery operations.
1070
1551
  */
1071
- type DiscoveryErrorCode = /** Request to discovery endpoint timed out */
1072
- "discovery_timeout"
1073
- /** Discovery endpoint returned 404 or similar */ | "discovery_not_found"
1074
- /** Discovery endpoint returned invalid JSON */ | "discovery_invalid_json"
1075
- /** Discovery URL is invalid or malformed */ | "discovery_invalid_url"
1076
- /** Discovery URL is not trusted by the trusted origins configuration */ | "discovery_untrusted_origin"
1077
- /** Discovery document issuer doesn't match configured issuer */ | "issuer_mismatch"
1078
- /** Discovery document is missing required fields */ | "discovery_incomplete"
1079
- /** IdP only advertises token auth methods that Better Auth doesn't currently support */ | "unsupported_token_auth_method"
1080
- /** Catch-all for unexpected errors */ | "discovery_unexpected_error";
1552
+ type DiscoveryErrorCode = /** Request to discovery endpoint timed out */"discovery_timeout" /** Discovery endpoint returned 404 or similar */ | "discovery_not_found" /** Discovery endpoint returned invalid JSON */ | "discovery_invalid_json" /** Discovery URL is invalid or malformed */ | "discovery_invalid_url" /** Discovery URL is not trusted by the trusted origins configuration */ | "discovery_untrusted_origin" /** Discovery document issuer doesn't match configured issuer */ | "issuer_mismatch" /** Discovery document is missing required fields */ | "discovery_incomplete" /** IdP only advertises token auth methods that Better Auth doesn't currently support */ | "unsupported_token_auth_method" /** Catch-all for unexpected errors */ | "discovery_unexpected_error";
1081
1553
  /**
1082
1554
  * Custom error class for OIDC discovery failures.
1083
1555
  * Can be caught and mapped to APIError at the edge.
@@ -1242,56 +1714,12 @@ declare function selectTokenEndpointAuthMethod(doc: OIDCDiscoveryDocument, exist
1242
1714
  * and validation. Specifically checks for:
1243
1715
  * - `tokenEndpoint` - required for exchanging authorization code for tokens
1244
1716
  * - `jwksEndpoint` - required for validating ID token signatures
1245
- *
1246
- * Note: `authorizationEndpoint` is handled separately in the sign-in flow,
1247
- * so it's not checked here.
1717
+ * - `authorizationEndpoint` - required for redirecting users to the IdP for login
1248
1718
  *
1249
1719
  * @param config - Partial OIDC config from the provider
1250
1720
  * @returns true if runtime discovery should be performed
1251
1721
  */
1252
1722
  declare function needsRuntimeDiscovery(config: Partial<HydratedOIDCConfig> | undefined): boolean;
1253
1723
  //#endregion
1254
- //#region src/index.d.ts
1255
- declare module "@better-auth/core" {
1256
- interface BetterAuthPluginRegistry<Auth, Context> {
1257
- sso: {
1258
- creator: typeof sso;
1259
- };
1260
- }
1261
- }
1262
- type DomainVerificationEndpoints = {
1263
- requestDomainVerification: ReturnType<typeof requestDomainVerification>;
1264
- verifyDomain: ReturnType<typeof verifyDomain>;
1265
- };
1266
- type SSOEndpoints<O extends SSOOptions> = {
1267
- spMetadata: ReturnType<typeof spMetadata>;
1268
- registerSSOProvider: ReturnType<typeof registerSSOProvider<O>>;
1269
- signInSSO: ReturnType<typeof signInSSO>;
1270
- callbackSSO: ReturnType<typeof callbackSSO>;
1271
- callbackSSOSAML: ReturnType<typeof callbackSSOSAML>;
1272
- acsEndpoint: ReturnType<typeof acsEndpoint>;
1273
- };
1274
- type SSOPlugin<O extends SSOOptions> = {
1275
- id: "sso";
1276
- endpoints: SSOEndpoints<O> & (O extends {
1277
- domainVerification: {
1278
- enabled: true;
1279
- };
1280
- } ? DomainVerificationEndpoints : {});
1281
- };
1282
- declare function sso<O extends SSOOptions & {
1283
- domainVerification?: {
1284
- enabled: true;
1285
- };
1286
- }>(options?: O | undefined): {
1287
- id: "sso";
1288
- endpoints: SSOEndpoints<O> & DomainVerificationEndpoints;
1289
- schema: any;
1290
- options: O;
1291
- };
1292
- declare function sso<O extends SSOOptions>(options?: O | undefined): {
1293
- id: "sso";
1294
- endpoints: SSOEndpoints<O>;
1295
- };
1296
- //#endregion
1297
- export { DataEncryptionAlgorithm as A, TimestampValidationOptions as C, SSOOptions as D, SAMLConfig as E, DigestAlgorithm as M, KeyEncryptionAlgorithm as N, SSOProvider as O, SignatureAlgorithm as P, SAMLConditions as S, OIDCConfig as T, REQUIRED_DISCOVERY_FIELDS as _, fetchDiscoveryDocument as a, DEFAULT_MAX_SAML_METADATA_SIZE as b, normalizeUrl as c, validateDiscoveryUrl as d, DiscoverOIDCConfigParams as f, OIDCDiscoveryDocument as g, HydratedOIDCConfig as h, discoverOIDCConfig as i, DeprecatedAlgorithmBehavior as j, AlgorithmValidationOptions as k, selectTokenEndpointAuthMethod as l, DiscoveryErrorCode as m, sso as n, needsRuntimeDiscovery as o, DiscoveryError as p, computeDiscoveryUrl as r, normalizeDiscoveryUrls as s, SSOPlugin as t, validateDiscoveryDocument as u, RequiredDiscoveryField as v, validateSAMLTimestamp as w, DEFAULT_MAX_SAML_RESPONSE_SIZE as x, DEFAULT_CLOCK_SKEW_MS as y };
1724
+ export { spMetadata as A, SSOOptions as B, callbackSSO as C, registerSSOProvider as D, initiateSLO as E, updateSSOProvider as F, DigestAlgorithm as G, AlgorithmValidationOptions as H, requestDomainVerification as I, KeyEncryptionAlgorithm as K, verifyDomain as L, deleteSSOProvider as M, getSSOProvider as N, signInSSO as O, listSSOProviders as P, OIDCConfig as R, acsEndpoint as S, callbackSSOShared as T, DataEncryptionAlgorithm as U, SSOProvider as V, DeprecatedAlgorithmBehavior as W, DEFAULT_CLOCK_SKEW_MS as _, normalizeDiscoveryUrls as a, SAMLConditions as b, validateDiscoveryDocument as c, DiscoveryError as d, DiscoveryErrorCode as f, RequiredDiscoveryField as g, REQUIRED_DISCOVERY_FIELDS as h, needsRuntimeDiscovery as i, validateSAMLTimestamp as j, sloEndpoint as k, validateDiscoveryUrl as l, OIDCDiscoveryDocument as m, discoverOIDCConfig as n, normalizeUrl as o, HydratedOIDCConfig as p, SignatureAlgorithm as q, fetchDiscoveryDocument as r, selectTokenEndpointAuthMethod as s, computeDiscoveryUrl as t, DiscoverOIDCConfigParams as u, DEFAULT_MAX_SAML_METADATA_SIZE as v, callbackSSOSAML as w, TimestampValidationOptions as x, DEFAULT_MAX_SAML_RESPONSE_SIZE as y, SAMLConfig as z };
1725
+ //# sourceMappingURL=index-BQp9TZiG.d.mts.map