@better-auth/sso 1.4.17 → 1.4.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/.turbo/turbo-build.log +10 -8
- package/dist/client.d.mts +7 -2
- package/dist/client.mjs +7 -2
- package/dist/client.mjs.map +1 -0
- package/dist/{index-XUgmj4eH.d.mts → index-D-VInsst.d.mts} +387 -8
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1214 -657
- package/dist/index.mjs.map +1 -0
- package/package.json +4 -3
- package/src/client.ts +5 -1
- package/src/domain-verification.test.ts +46 -4
- package/src/index.ts +45 -6
- package/src/linking/org-assignment.ts +30 -15
- package/src/oidc.test.ts +1 -3
- package/src/providers.test.ts +1326 -0
- package/src/routes/domain-verification.ts +34 -12
- package/src/routes/providers.ts +567 -0
- package/src/routes/schemas.ts +95 -0
- package/src/routes/sso.ts +302 -118
- package/src/saml-state.ts +78 -0
- package/src/saml.test.ts +1660 -229
- package/src/types.ts +13 -2
- package/src/utils.test.ts +103 -0
- package/src/utils.ts +45 -5
- package/tsdown.config.ts +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/sso@1.4.
|
|
2
|
+
> @better-auth/sso@1.4.19 build /home/runner/work/better-auth/better-auth/packages/sso
|
|
3
3
|
> tsdown
|
|
4
4
|
|
|
5
5
|
[34mℹ[39m tsdown [2mv0.17.2[22m powered by rolldown [2mv1.0.0-beta.53[22m
|
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
[34mℹ[39m entry: [34msrc/index.ts, src/client.ts[39m
|
|
8
8
|
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
9
|
[34mℹ[39m Build start
|
|
10
|
-
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [
|
|
11
|
-
[34mℹ[39m [2mdist/[22m[1mclient.mjs[22m [2m
|
|
12
|
-
[34mℹ[39m [2mdist/[
|
|
13
|
-
[34mℹ[39m [2mdist/[
|
|
14
|
-
[34mℹ[39m [2mdist/[22m[
|
|
15
|
-
[34mℹ[39m
|
|
16
|
-
[
|
|
10
|
+
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m120.93 kB[22m [2m│ gzip: 24.08 kB[22m
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mclient.mjs[22m [2m 0.28 kB[22m [2m│ gzip: 0.21 kB[22m
|
|
12
|
+
[34mℹ[39m [2mdist/[22mindex.mjs.map [2m246.56 kB[22m [2m│ gzip: 47.33 kB[22m
|
|
13
|
+
[34mℹ[39m [2mdist/[22mclient.mjs.map [2m 0.94 kB[22m [2m│ gzip: 0.50 kB[22m
|
|
14
|
+
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 1.67 kB[22m [2m│ gzip: 0.57 kB[22m
|
|
15
|
+
[34mℹ[39m [2mdist/[22m[32m[1mclient.d.mts[22m[39m [2m 0.62 kB[22m [2m│ gzip: 0.35 kB[22m
|
|
16
|
+
[34mℹ[39m [2mdist/[22m[32mindex-D-VInsst.d.mts[39m [2m 55.92 kB[22m [2m│ gzip: 9.95 kB[22m
|
|
17
|
+
[34mℹ[39m 7 files, total: 426.92 kB
|
|
18
|
+
[32m✔[39m Build complete in [32m18184ms[39m
|
package/dist/client.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as SSOPlugin } from "./index-
|
|
1
|
+
import { t as SSOPlugin } from "./index-D-VInsst.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/client.d.ts
|
|
4
4
|
interface SSOClientOptions {
|
|
@@ -15,6 +15,11 @@ declare const ssoClient: <CO extends SSOClientOptions>(options?: CO | undefined)
|
|
|
15
15
|
} ? true : false;
|
|
16
16
|
};
|
|
17
17
|
}>;
|
|
18
|
+
pathMethods: {
|
|
19
|
+
"/sso/providers": "GET";
|
|
20
|
+
"/sso/providers/:providerId": "GET";
|
|
21
|
+
};
|
|
18
22
|
};
|
|
19
23
|
//#endregion
|
|
20
|
-
export { ssoClient };
|
|
24
|
+
export { ssoClient };
|
|
25
|
+
//# sourceMappingURL=client.d.mts.map
|
package/dist/client.mjs
CHANGED
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
const ssoClient = (options) => {
|
|
3
3
|
return {
|
|
4
4
|
id: "sso-client",
|
|
5
|
-
$InferServerPlugin: {}
|
|
5
|
+
$InferServerPlugin: {},
|
|
6
|
+
pathMethods: {
|
|
7
|
+
"/sso/providers": "GET",
|
|
8
|
+
"/sso/providers/:providerId": "GET"
|
|
9
|
+
}
|
|
6
10
|
};
|
|
7
11
|
};
|
|
8
12
|
|
|
9
13
|
//#endregion
|
|
10
|
-
export { ssoClient };
|
|
14
|
+
export { ssoClient };
|
|
15
|
+
//# sourceMappingURL=client.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.mjs","names":[],"sources":["../src/client.ts"],"sourcesContent":["import type { BetterAuthClientPlugin } from \"better-auth/client\";\nimport type { SSOPlugin } from \"./index\";\n\ninterface SSOClientOptions {\n\tdomainVerification?:\n\t\t| {\n\t\t\t\tenabled: boolean;\n\t\t }\n\t\t| undefined;\n}\n\nexport const ssoClient = <CO extends SSOClientOptions>(\n\toptions?: CO | undefined,\n) => {\n\treturn {\n\t\tid: \"sso-client\",\n\t\t$InferServerPlugin: {} as SSOPlugin<{\n\t\t\tdomainVerification: {\n\t\t\t\tenabled: CO[\"domainVerification\"] extends { enabled: true }\n\t\t\t\t\t? true\n\t\t\t\t\t: false;\n\t\t\t};\n\t\t}>,\n\t\tpathMethods: {\n\t\t\t\"/sso/providers\": \"GET\",\n\t\t\t\"/sso/providers/:providerId\": \"GET\",\n\t\t},\n\t} satisfies BetterAuthClientPlugin;\n};\n"],"mappings":";AAWA,MAAa,aACZ,YACI;AACJ,QAAO;EACN,IAAI;EACJ,oBAAoB,EAAE;EAOtB,aAAa;GACZ,kBAAkB;GAClB,8BAA8B;GAC9B;EACD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { APIError } from "better-auth/api";
|
|
2
2
|
import * as z$1 from "zod/v4";
|
|
3
3
|
import z from "zod/v4";
|
|
4
|
-
import { Awaitable, OAuth2Tokens, User } from "better-auth";
|
|
4
|
+
import { Awaitable, BetterAuthPlugin, OAuth2Tokens, User } from "better-auth";
|
|
5
5
|
import * as better_call0 from "better-call";
|
|
6
6
|
|
|
7
7
|
//#region src/saml/algorithms.d.ts
|
|
@@ -109,6 +109,7 @@ interface SAMLConfig {
|
|
|
109
109
|
encPrivateKeyPass?: string | undefined;
|
|
110
110
|
};
|
|
111
111
|
wantAssertionsSigned?: boolean | undefined;
|
|
112
|
+
authnRequestsSigned?: boolean | undefined;
|
|
112
113
|
signatureAlgorithm?: string | undefined;
|
|
113
114
|
digestAlgorithm?: string | undefined;
|
|
114
115
|
identifierFormat?: string | undefined;
|
|
@@ -278,9 +279,12 @@ interface SSOOptions {
|
|
|
278
279
|
*/
|
|
279
280
|
enabled?: boolean;
|
|
280
281
|
/**
|
|
281
|
-
* Prefix used to generate the domain verification token
|
|
282
|
+
* Prefix used to generate the domain verification token.
|
|
283
|
+
* An underscore is automatically prepended to follow DNS
|
|
284
|
+
* infrastructure subdomain conventions (RFC 8552), so do
|
|
285
|
+
* not include a leading underscore.
|
|
282
286
|
*
|
|
283
|
-
* @default "better-auth-token
|
|
287
|
+
* @default "better-auth-token"
|
|
284
288
|
*/
|
|
285
289
|
tokenPrefix?: string;
|
|
286
290
|
};
|
|
@@ -481,6 +485,373 @@ declare const verifyDomain: (options: SSOOptions) => better_call0.StrictEndpoint
|
|
|
481
485
|
}>)[];
|
|
482
486
|
}, void>;
|
|
483
487
|
//#endregion
|
|
488
|
+
//#region src/routes/providers.d.ts
|
|
489
|
+
declare const listSSOProviders: () => better_call0.StrictEndpoint<"/sso/providers", {
|
|
490
|
+
method: "GET";
|
|
491
|
+
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
|
|
492
|
+
session: {
|
|
493
|
+
session: Record<string, any> & {
|
|
494
|
+
id: string;
|
|
495
|
+
createdAt: Date;
|
|
496
|
+
updatedAt: Date;
|
|
497
|
+
userId: string;
|
|
498
|
+
expiresAt: Date;
|
|
499
|
+
token: string;
|
|
500
|
+
ipAddress?: string | null | undefined;
|
|
501
|
+
userAgent?: string | null | undefined;
|
|
502
|
+
};
|
|
503
|
+
user: Record<string, any> & {
|
|
504
|
+
id: string;
|
|
505
|
+
createdAt: Date;
|
|
506
|
+
updatedAt: Date;
|
|
507
|
+
email: string;
|
|
508
|
+
emailVerified: boolean;
|
|
509
|
+
name: string;
|
|
510
|
+
image?: string | null | undefined;
|
|
511
|
+
};
|
|
512
|
+
};
|
|
513
|
+
}>)[];
|
|
514
|
+
metadata: {
|
|
515
|
+
openapi: {
|
|
516
|
+
operationId: string;
|
|
517
|
+
summary: string;
|
|
518
|
+
description: string;
|
|
519
|
+
responses: {
|
|
520
|
+
"200": {
|
|
521
|
+
description: string;
|
|
522
|
+
};
|
|
523
|
+
};
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
}, {
|
|
527
|
+
providers: {
|
|
528
|
+
providerId: string;
|
|
529
|
+
type: string;
|
|
530
|
+
issuer: string;
|
|
531
|
+
domain: string;
|
|
532
|
+
organizationId: string | null;
|
|
533
|
+
domainVerified: boolean;
|
|
534
|
+
oidcConfig: {
|
|
535
|
+
discoveryEndpoint: string;
|
|
536
|
+
clientIdLastFour: string;
|
|
537
|
+
pkce: boolean;
|
|
538
|
+
authorizationEndpoint: string | undefined;
|
|
539
|
+
tokenEndpoint: string | undefined;
|
|
540
|
+
userInfoEndpoint: string | undefined;
|
|
541
|
+
jwksEndpoint: string | undefined;
|
|
542
|
+
scopes: string[] | undefined;
|
|
543
|
+
tokenEndpointAuthentication: "client_secret_post" | "client_secret_basic" | undefined;
|
|
544
|
+
} | undefined;
|
|
545
|
+
samlConfig: {
|
|
546
|
+
entryPoint: string;
|
|
547
|
+
callbackUrl: string;
|
|
548
|
+
audience: string | undefined;
|
|
549
|
+
wantAssertionsSigned: boolean | undefined;
|
|
550
|
+
identifierFormat: string | undefined;
|
|
551
|
+
signatureAlgorithm: string | undefined;
|
|
552
|
+
digestAlgorithm: string | undefined;
|
|
553
|
+
certificate: {
|
|
554
|
+
fingerprintSha256: string;
|
|
555
|
+
notBefore: string;
|
|
556
|
+
notAfter: string;
|
|
557
|
+
publicKeyAlgorithm: string;
|
|
558
|
+
} | {
|
|
559
|
+
error: string;
|
|
560
|
+
};
|
|
561
|
+
} | undefined;
|
|
562
|
+
spMetadataUrl: string;
|
|
563
|
+
}[];
|
|
564
|
+
}>;
|
|
565
|
+
declare const getSSOProvider: () => better_call0.StrictEndpoint<"/sso/providers/:providerId", {
|
|
566
|
+
method: "GET";
|
|
567
|
+
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
|
|
568
|
+
session: {
|
|
569
|
+
session: Record<string, any> & {
|
|
570
|
+
id: string;
|
|
571
|
+
createdAt: Date;
|
|
572
|
+
updatedAt: Date;
|
|
573
|
+
userId: string;
|
|
574
|
+
expiresAt: Date;
|
|
575
|
+
token: string;
|
|
576
|
+
ipAddress?: string | null | undefined;
|
|
577
|
+
userAgent?: string | null | undefined;
|
|
578
|
+
};
|
|
579
|
+
user: Record<string, any> & {
|
|
580
|
+
id: string;
|
|
581
|
+
createdAt: Date;
|
|
582
|
+
updatedAt: Date;
|
|
583
|
+
email: string;
|
|
584
|
+
emailVerified: boolean;
|
|
585
|
+
name: string;
|
|
586
|
+
image?: string | null | undefined;
|
|
587
|
+
};
|
|
588
|
+
};
|
|
589
|
+
}>)[];
|
|
590
|
+
params: z.ZodObject<{
|
|
591
|
+
providerId: z.ZodString;
|
|
592
|
+
}, z.core.$strip>;
|
|
593
|
+
metadata: {
|
|
594
|
+
openapi: {
|
|
595
|
+
operationId: string;
|
|
596
|
+
summary: string;
|
|
597
|
+
description: string;
|
|
598
|
+
responses: {
|
|
599
|
+
"200": {
|
|
600
|
+
description: string;
|
|
601
|
+
};
|
|
602
|
+
"404": {
|
|
603
|
+
description: string;
|
|
604
|
+
};
|
|
605
|
+
"403": {
|
|
606
|
+
description: string;
|
|
607
|
+
};
|
|
608
|
+
};
|
|
609
|
+
};
|
|
610
|
+
};
|
|
611
|
+
}, {
|
|
612
|
+
providerId: string;
|
|
613
|
+
type: string;
|
|
614
|
+
issuer: string;
|
|
615
|
+
domain: string;
|
|
616
|
+
organizationId: string | null;
|
|
617
|
+
domainVerified: boolean;
|
|
618
|
+
oidcConfig: {
|
|
619
|
+
discoveryEndpoint: string;
|
|
620
|
+
clientIdLastFour: string;
|
|
621
|
+
pkce: boolean;
|
|
622
|
+
authorizationEndpoint: string | undefined;
|
|
623
|
+
tokenEndpoint: string | undefined;
|
|
624
|
+
userInfoEndpoint: string | undefined;
|
|
625
|
+
jwksEndpoint: string | undefined;
|
|
626
|
+
scopes: string[] | undefined;
|
|
627
|
+
tokenEndpointAuthentication: "client_secret_post" | "client_secret_basic" | undefined;
|
|
628
|
+
} | undefined;
|
|
629
|
+
samlConfig: {
|
|
630
|
+
entryPoint: string;
|
|
631
|
+
callbackUrl: string;
|
|
632
|
+
audience: string | undefined;
|
|
633
|
+
wantAssertionsSigned: boolean | undefined;
|
|
634
|
+
identifierFormat: string | undefined;
|
|
635
|
+
signatureAlgorithm: string | undefined;
|
|
636
|
+
digestAlgorithm: string | undefined;
|
|
637
|
+
certificate: {
|
|
638
|
+
fingerprintSha256: string;
|
|
639
|
+
notBefore: string;
|
|
640
|
+
notAfter: string;
|
|
641
|
+
publicKeyAlgorithm: string;
|
|
642
|
+
} | {
|
|
643
|
+
error: string;
|
|
644
|
+
};
|
|
645
|
+
} | undefined;
|
|
646
|
+
spMetadataUrl: string;
|
|
647
|
+
}>;
|
|
648
|
+
declare const updateSSOProvider: (options: SSOOptions) => better_call0.StrictEndpoint<"/sso/providers/:providerId", {
|
|
649
|
+
method: "PATCH";
|
|
650
|
+
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
|
|
651
|
+
session: {
|
|
652
|
+
session: Record<string, any> & {
|
|
653
|
+
id: string;
|
|
654
|
+
createdAt: Date;
|
|
655
|
+
updatedAt: Date;
|
|
656
|
+
userId: string;
|
|
657
|
+
expiresAt: Date;
|
|
658
|
+
token: string;
|
|
659
|
+
ipAddress?: string | null | undefined;
|
|
660
|
+
userAgent?: string | null | undefined;
|
|
661
|
+
};
|
|
662
|
+
user: Record<string, any> & {
|
|
663
|
+
id: string;
|
|
664
|
+
createdAt: Date;
|
|
665
|
+
updatedAt: Date;
|
|
666
|
+
email: string;
|
|
667
|
+
emailVerified: boolean;
|
|
668
|
+
name: string;
|
|
669
|
+
image?: string | null | undefined;
|
|
670
|
+
};
|
|
671
|
+
};
|
|
672
|
+
}>)[];
|
|
673
|
+
params: z.ZodObject<{
|
|
674
|
+
providerId: z.ZodString;
|
|
675
|
+
}, z.core.$strip>;
|
|
676
|
+
body: z.ZodObject<{
|
|
677
|
+
issuer: z.ZodOptional<z.ZodString>;
|
|
678
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
679
|
+
oidcConfig: z.ZodOptional<z.ZodObject<{
|
|
680
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
681
|
+
clientSecret: z.ZodOptional<z.ZodString>;
|
|
682
|
+
authorizationEndpoint: z.ZodOptional<z.ZodString>;
|
|
683
|
+
tokenEndpoint: z.ZodOptional<z.ZodString>;
|
|
684
|
+
userInfoEndpoint: z.ZodOptional<z.ZodString>;
|
|
685
|
+
tokenEndpointAuthentication: z.ZodOptional<z.ZodEnum<{
|
|
686
|
+
client_secret_post: "client_secret_post";
|
|
687
|
+
client_secret_basic: "client_secret_basic";
|
|
688
|
+
}>>;
|
|
689
|
+
jwksEndpoint: z.ZodOptional<z.ZodString>;
|
|
690
|
+
discoveryEndpoint: z.ZodOptional<z.ZodString>;
|
|
691
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
692
|
+
pkce: z.ZodOptional<z.ZodBoolean>;
|
|
693
|
+
overrideUserInfo: z.ZodOptional<z.ZodBoolean>;
|
|
694
|
+
mapping: z.ZodOptional<z.ZodObject<{
|
|
695
|
+
id: z.ZodOptional<z.ZodString>;
|
|
696
|
+
email: z.ZodOptional<z.ZodString>;
|
|
697
|
+
emailVerified: z.ZodOptional<z.ZodString>;
|
|
698
|
+
name: z.ZodOptional<z.ZodString>;
|
|
699
|
+
image: z.ZodOptional<z.ZodString>;
|
|
700
|
+
extraFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
701
|
+
}, z.core.$strip>>;
|
|
702
|
+
}, z.core.$strip>>;
|
|
703
|
+
samlConfig: z.ZodOptional<z.ZodObject<{
|
|
704
|
+
entryPoint: z.ZodOptional<z.ZodString>;
|
|
705
|
+
cert: z.ZodOptional<z.ZodString>;
|
|
706
|
+
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
707
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
708
|
+
idpMetadata: z.ZodOptional<z.ZodObject<{
|
|
709
|
+
metadata: z.ZodOptional<z.ZodString>;
|
|
710
|
+
entityID: z.ZodOptional<z.ZodString>;
|
|
711
|
+
cert: z.ZodOptional<z.ZodString>;
|
|
712
|
+
privateKey: z.ZodOptional<z.ZodString>;
|
|
713
|
+
privateKeyPass: z.ZodOptional<z.ZodString>;
|
|
714
|
+
isAssertionEncrypted: z.ZodOptional<z.ZodBoolean>;
|
|
715
|
+
encPrivateKey: z.ZodOptional<z.ZodString>;
|
|
716
|
+
encPrivateKeyPass: z.ZodOptional<z.ZodString>;
|
|
717
|
+
singleSignOnService: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
718
|
+
Binding: z.ZodString;
|
|
719
|
+
Location: z.ZodString;
|
|
720
|
+
}, z.core.$strip>>>;
|
|
721
|
+
}, z.core.$strip>>;
|
|
722
|
+
spMetadata: z.ZodOptional<z.ZodObject<{
|
|
723
|
+
metadata: z.ZodOptional<z.ZodString>;
|
|
724
|
+
entityID: z.ZodOptional<z.ZodString>;
|
|
725
|
+
binding: z.ZodOptional<z.ZodString>;
|
|
726
|
+
privateKey: z.ZodOptional<z.ZodString>;
|
|
727
|
+
privateKeyPass: z.ZodOptional<z.ZodString>;
|
|
728
|
+
isAssertionEncrypted: z.ZodOptional<z.ZodBoolean>;
|
|
729
|
+
encPrivateKey: z.ZodOptional<z.ZodString>;
|
|
730
|
+
encPrivateKeyPass: z.ZodOptional<z.ZodString>;
|
|
731
|
+
}, z.core.$strip>>;
|
|
732
|
+
wantAssertionsSigned: z.ZodOptional<z.ZodBoolean>;
|
|
733
|
+
signatureAlgorithm: z.ZodOptional<z.ZodString>;
|
|
734
|
+
digestAlgorithm: z.ZodOptional<z.ZodString>;
|
|
735
|
+
identifierFormat: z.ZodOptional<z.ZodString>;
|
|
736
|
+
privateKey: z.ZodOptional<z.ZodString>;
|
|
737
|
+
decryptionPvk: z.ZodOptional<z.ZodString>;
|
|
738
|
+
additionalParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
739
|
+
mapping: z.ZodOptional<z.ZodObject<{
|
|
740
|
+
id: z.ZodOptional<z.ZodString>;
|
|
741
|
+
email: z.ZodOptional<z.ZodString>;
|
|
742
|
+
emailVerified: z.ZodOptional<z.ZodString>;
|
|
743
|
+
name: z.ZodOptional<z.ZodString>;
|
|
744
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
745
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
746
|
+
extraFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
747
|
+
}, z.core.$strip>>;
|
|
748
|
+
}, z.core.$strip>>;
|
|
749
|
+
}, z.core.$strip>;
|
|
750
|
+
metadata: {
|
|
751
|
+
openapi: {
|
|
752
|
+
operationId: string;
|
|
753
|
+
summary: string;
|
|
754
|
+
description: string;
|
|
755
|
+
responses: {
|
|
756
|
+
"200": {
|
|
757
|
+
description: string;
|
|
758
|
+
};
|
|
759
|
+
"404": {
|
|
760
|
+
description: string;
|
|
761
|
+
};
|
|
762
|
+
"403": {
|
|
763
|
+
description: string;
|
|
764
|
+
};
|
|
765
|
+
};
|
|
766
|
+
};
|
|
767
|
+
};
|
|
768
|
+
}, {
|
|
769
|
+
providerId: string;
|
|
770
|
+
type: string;
|
|
771
|
+
issuer: string;
|
|
772
|
+
domain: string;
|
|
773
|
+
organizationId: string | null;
|
|
774
|
+
domainVerified: boolean;
|
|
775
|
+
oidcConfig: {
|
|
776
|
+
discoveryEndpoint: string;
|
|
777
|
+
clientIdLastFour: string;
|
|
778
|
+
pkce: boolean;
|
|
779
|
+
authorizationEndpoint: string | undefined;
|
|
780
|
+
tokenEndpoint: string | undefined;
|
|
781
|
+
userInfoEndpoint: string | undefined;
|
|
782
|
+
jwksEndpoint: string | undefined;
|
|
783
|
+
scopes: string[] | undefined;
|
|
784
|
+
tokenEndpointAuthentication: "client_secret_post" | "client_secret_basic" | undefined;
|
|
785
|
+
} | undefined;
|
|
786
|
+
samlConfig: {
|
|
787
|
+
entryPoint: string;
|
|
788
|
+
callbackUrl: string;
|
|
789
|
+
audience: string | undefined;
|
|
790
|
+
wantAssertionsSigned: boolean | undefined;
|
|
791
|
+
identifierFormat: string | undefined;
|
|
792
|
+
signatureAlgorithm: string | undefined;
|
|
793
|
+
digestAlgorithm: string | undefined;
|
|
794
|
+
certificate: {
|
|
795
|
+
fingerprintSha256: string;
|
|
796
|
+
notBefore: string;
|
|
797
|
+
notAfter: string;
|
|
798
|
+
publicKeyAlgorithm: string;
|
|
799
|
+
} | {
|
|
800
|
+
error: string;
|
|
801
|
+
};
|
|
802
|
+
} | undefined;
|
|
803
|
+
spMetadataUrl: string;
|
|
804
|
+
}>;
|
|
805
|
+
declare const deleteSSOProvider: () => better_call0.StrictEndpoint<"/sso/providers/:providerId", {
|
|
806
|
+
method: "DELETE";
|
|
807
|
+
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
|
|
808
|
+
session: {
|
|
809
|
+
session: Record<string, any> & {
|
|
810
|
+
id: string;
|
|
811
|
+
createdAt: Date;
|
|
812
|
+
updatedAt: Date;
|
|
813
|
+
userId: string;
|
|
814
|
+
expiresAt: Date;
|
|
815
|
+
token: string;
|
|
816
|
+
ipAddress?: string | null | undefined;
|
|
817
|
+
userAgent?: string | null | undefined;
|
|
818
|
+
};
|
|
819
|
+
user: Record<string, any> & {
|
|
820
|
+
id: string;
|
|
821
|
+
createdAt: Date;
|
|
822
|
+
updatedAt: Date;
|
|
823
|
+
email: string;
|
|
824
|
+
emailVerified: boolean;
|
|
825
|
+
name: string;
|
|
826
|
+
image?: string | null | undefined;
|
|
827
|
+
};
|
|
828
|
+
};
|
|
829
|
+
}>)[];
|
|
830
|
+
params: z.ZodObject<{
|
|
831
|
+
providerId: z.ZodString;
|
|
832
|
+
}, z.core.$strip>;
|
|
833
|
+
metadata: {
|
|
834
|
+
openapi: {
|
|
835
|
+
operationId: string;
|
|
836
|
+
summary: string;
|
|
837
|
+
description: string;
|
|
838
|
+
responses: {
|
|
839
|
+
"200": {
|
|
840
|
+
description: string;
|
|
841
|
+
};
|
|
842
|
+
"404": {
|
|
843
|
+
description: string;
|
|
844
|
+
};
|
|
845
|
+
"403": {
|
|
846
|
+
description: string;
|
|
847
|
+
};
|
|
848
|
+
};
|
|
849
|
+
};
|
|
850
|
+
};
|
|
851
|
+
}, {
|
|
852
|
+
success: boolean;
|
|
853
|
+
}>;
|
|
854
|
+
//#endregion
|
|
484
855
|
//#region src/routes/sso.d.ts
|
|
485
856
|
interface TimestampValidationOptions {
|
|
486
857
|
clockSkew?: number;
|
|
@@ -917,11 +1288,14 @@ declare const callbackSSO: (options?: SSOOptions) => better_call0.StrictEndpoint
|
|
|
917
1288
|
};
|
|
918
1289
|
}, never>;
|
|
919
1290
|
declare const callbackSSOSAML: (options?: SSOOptions) => better_call0.StrictEndpoint<"/sso/saml2/callback/:providerId", {
|
|
920
|
-
method: "POST";
|
|
921
|
-
body: z.ZodObject<{
|
|
1291
|
+
method: ("POST" | "GET")[];
|
|
1292
|
+
body: z.ZodOptional<z.ZodObject<{
|
|
922
1293
|
SAMLResponse: z.ZodString;
|
|
923
1294
|
RelayState: z.ZodOptional<z.ZodString>;
|
|
924
|
-
}, z.core.$strip
|
|
1295
|
+
}, z.core.$strip>>;
|
|
1296
|
+
query: z.ZodOptional<z.ZodObject<{
|
|
1297
|
+
RelayState: z.ZodOptional<z.ZodString>;
|
|
1298
|
+
}, z.core.$strip>>;
|
|
925
1299
|
metadata: {
|
|
926
1300
|
allowedMediaTypes: string[];
|
|
927
1301
|
openapi: {
|
|
@@ -1257,6 +1631,10 @@ type SSOEndpoints<O extends SSOOptions> = {
|
|
|
1257
1631
|
callbackSSO: ReturnType<typeof callbackSSO>;
|
|
1258
1632
|
callbackSSOSAML: ReturnType<typeof callbackSSOSAML>;
|
|
1259
1633
|
acsEndpoint: ReturnType<typeof acsEndpoint>;
|
|
1634
|
+
listSSOProviders: ReturnType<typeof listSSOProviders>;
|
|
1635
|
+
getSSOProvider: ReturnType<typeof getSSOProvider>;
|
|
1636
|
+
updateSSOProvider: ReturnType<typeof updateSSOProvider>;
|
|
1637
|
+
deleteSSOProvider: ReturnType<typeof deleteSSOProvider>;
|
|
1260
1638
|
};
|
|
1261
1639
|
type SSOPlugin<O extends SSOOptions> = {
|
|
1262
1640
|
id: "sso";
|
|
@@ -1273,7 +1651,7 @@ declare function sso<O extends SSOOptions & {
|
|
|
1273
1651
|
}>(options?: O | undefined): {
|
|
1274
1652
|
id: "sso";
|
|
1275
1653
|
endpoints: SSOEndpoints<O> & DomainVerificationEndpoints;
|
|
1276
|
-
schema:
|
|
1654
|
+
schema: NonNullable<BetterAuthPlugin["schema"]>;
|
|
1277
1655
|
options: O;
|
|
1278
1656
|
};
|
|
1279
1657
|
declare function sso<O extends SSOOptions>(options?: O | undefined): {
|
|
@@ -1281,4 +1659,5 @@ declare function sso<O extends SSOOptions>(options?: O | undefined): {
|
|
|
1281
1659
|
endpoints: SSOEndpoints<O>;
|
|
1282
1660
|
};
|
|
1283
1661
|
//#endregion
|
|
1284
|
-
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 };
|
|
1662
|
+
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 };
|
|
1663
|
+
//# sourceMappingURL=index-D-VInsst.d.mts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as DataEncryptionAlgorithm, C as TimestampValidationOptions, D as SSOOptions, E as SAMLConfig, M as DigestAlgorithm, N as KeyEncryptionAlgorithm, O as SSOProvider, P as SignatureAlgorithm, S as SAMLConditions, T as OIDCConfig, _ as REQUIRED_DISCOVERY_FIELDS, a as fetchDiscoveryDocument, b as DEFAULT_MAX_SAML_METADATA_SIZE, c as normalizeUrl, d as validateDiscoveryUrl, f as DiscoverOIDCConfigParams, g as OIDCDiscoveryDocument, h as HydratedOIDCConfig, i as discoverOIDCConfig, j as DeprecatedAlgorithmBehavior, k as AlgorithmValidationOptions, l as selectTokenEndpointAuthMethod, m as DiscoveryErrorCode, n as sso, o as needsRuntimeDiscovery, p as DiscoveryError, r as computeDiscoveryUrl, s as normalizeDiscoveryUrls, t as SSOPlugin, u as validateDiscoveryDocument, v as RequiredDiscoveryField, w as validateSAMLTimestamp, x as DEFAULT_MAX_SAML_RESPONSE_SIZE, y as DEFAULT_CLOCK_SKEW_MS } from "./index-
|
|
1
|
+
import { A as DataEncryptionAlgorithm, C as TimestampValidationOptions, D as SSOOptions, E as SAMLConfig, M as DigestAlgorithm, N as KeyEncryptionAlgorithm, O as SSOProvider, P as SignatureAlgorithm, S as SAMLConditions, T as OIDCConfig, _ as REQUIRED_DISCOVERY_FIELDS, a as fetchDiscoveryDocument, b as DEFAULT_MAX_SAML_METADATA_SIZE, c as normalizeUrl, d as validateDiscoveryUrl, f as DiscoverOIDCConfigParams, g as OIDCDiscoveryDocument, h as HydratedOIDCConfig, i as discoverOIDCConfig, j as DeprecatedAlgorithmBehavior, k as AlgorithmValidationOptions, l as selectTokenEndpointAuthMethod, m as DiscoveryErrorCode, n as sso, o as needsRuntimeDiscovery, p as DiscoveryError, r as computeDiscoveryUrl, s as normalizeDiscoveryUrls, t as SSOPlugin, u as validateDiscoveryDocument, v as RequiredDiscoveryField, w as validateSAMLTimestamp, x as DEFAULT_MAX_SAML_RESPONSE_SIZE, y as DEFAULT_CLOCK_SKEW_MS } from "./index-D-VInsst.mjs";
|
|
2
2
|
export { AlgorithmValidationOptions, DEFAULT_CLOCK_SKEW_MS, DEFAULT_MAX_SAML_METADATA_SIZE, DEFAULT_MAX_SAML_RESPONSE_SIZE, DataEncryptionAlgorithm, DeprecatedAlgorithmBehavior, DigestAlgorithm, DiscoverOIDCConfigParams, DiscoveryError, DiscoveryErrorCode, HydratedOIDCConfig, KeyEncryptionAlgorithm, OIDCConfig, OIDCDiscoveryDocument, REQUIRED_DISCOVERY_FIELDS, RequiredDiscoveryField, SAMLConditions, SAMLConfig, SSOOptions, SSOPlugin, SSOProvider, SignatureAlgorithm, TimestampValidationOptions, computeDiscoveryUrl, discoverOIDCConfig, fetchDiscoveryDocument, needsRuntimeDiscovery, normalizeDiscoveryUrls, normalizeUrl, selectTokenEndpointAuthMethod, sso, validateDiscoveryDocument, validateDiscoveryUrl, validateSAMLTimestamp };
|