@better-auth/sso 1.3.7-beta.2 → 1.3.7-beta.4
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 +4 -4
- package/dist/index.cjs +20 -0
- package/dist/index.mjs +20 -0
- package/package.json +3 -3
- package/src/index.ts +20 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/sso@1.3.7-beta.
|
|
2
|
+
> @better-auth/sso@1.3.7-beta.4 build /home/runner/work/better-auth/better-auth/packages/sso
|
|
3
3
|
> unbuild
|
|
4
4
|
|
|
5
5
|
[info] Automatically detected entries: src/index, src/client [esm] [cjs] [dts]
|
|
6
6
|
[info] Building sso
|
|
7
7
|
[success] Build succeeded for sso
|
|
8
|
-
[log] dist/index.cjs (total size:
|
|
8
|
+
[log] dist/index.cjs (total size: 48.1 kB, chunk size: 48.1 kB, exports: sso)
|
|
9
9
|
|
|
10
10
|
[log] dist/client.cjs (total size: 141 B, chunk size: 141 B, exports: ssoClient)
|
|
11
11
|
|
|
12
|
-
[log] dist/index.mjs (total size: 46.
|
|
12
|
+
[log] dist/index.mjs (total size: 46.8 kB, chunk size: 46.8 kB, exports: sso)
|
|
13
13
|
|
|
14
14
|
[log] dist/client.mjs (total size: 117 B, chunk size: 117 B, exports: ssoClient)
|
|
15
15
|
|
|
16
|
-
Σ Total dist size (byte size):
|
|
16
|
+
Σ Total dist size (byte size): 205 kB
|
|
17
17
|
[log]
|
package/dist/index.cjs
CHANGED
|
@@ -382,6 +382,26 @@ const sso = (options) => {
|
|
|
382
382
|
message: "Invalid issuer. Must be a valid URL"
|
|
383
383
|
});
|
|
384
384
|
}
|
|
385
|
+
if (ctx.body.organizationId) {
|
|
386
|
+
const organization = await ctx.context.adapter.findOne({
|
|
387
|
+
model: "member",
|
|
388
|
+
where: [
|
|
389
|
+
{
|
|
390
|
+
field: "userId",
|
|
391
|
+
value: user.id
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
field: "organizationId",
|
|
395
|
+
value: ctx.body.organizationId
|
|
396
|
+
}
|
|
397
|
+
]
|
|
398
|
+
});
|
|
399
|
+
if (!organization) {
|
|
400
|
+
throw new api.APIError("BAD_REQUEST", {
|
|
401
|
+
message: "You are not a member of the organization"
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
}
|
|
385
405
|
const provider = await ctx.context.adapter.create({
|
|
386
406
|
model: "ssoProvider",
|
|
387
407
|
data: {
|
package/dist/index.mjs
CHANGED
|
@@ -365,6 +365,26 @@ const sso = (options) => {
|
|
|
365
365
|
message: "Invalid issuer. Must be a valid URL"
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
|
+
if (ctx.body.organizationId) {
|
|
369
|
+
const organization = await ctx.context.adapter.findOne({
|
|
370
|
+
model: "member",
|
|
371
|
+
where: [
|
|
372
|
+
{
|
|
373
|
+
field: "userId",
|
|
374
|
+
value: user.id
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
field: "organizationId",
|
|
378
|
+
value: ctx.body.organizationId
|
|
379
|
+
}
|
|
380
|
+
]
|
|
381
|
+
});
|
|
382
|
+
if (!organization) {
|
|
383
|
+
throw new APIError("BAD_REQUEST", {
|
|
384
|
+
message: "You are not a member of the organization"
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
368
388
|
const provider = await ctx.context.adapter.create({
|
|
369
389
|
model: "ssoProvider",
|
|
370
390
|
data: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/sso",
|
|
3
3
|
"author": "Bereket Engida",
|
|
4
|
-
"version": "1.3.7-beta.
|
|
4
|
+
"version": "1.3.7-beta.4",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"zod": "3.25.0 || ^4.0.0"
|
|
47
|
+
"zod": "^3.25.0 || ^4.0.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@better-fetch/fetch": "^1.1.18",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"jose": "^5.9.6",
|
|
53
53
|
"oauth2-mock-server": "^7.2.0",
|
|
54
54
|
"samlify": "^2.10.0",
|
|
55
|
-
"better-auth": "^1.3.7-beta.
|
|
55
|
+
"better-auth": "^1.3.7-beta.4"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/body-parser": "^1.19.6",
|
package/src/index.ts
CHANGED
|
@@ -589,6 +589,26 @@ export const sso = (options?: SSOOptions) => {
|
|
|
589
589
|
message: "Invalid issuer. Must be a valid URL",
|
|
590
590
|
});
|
|
591
591
|
}
|
|
592
|
+
if (ctx.body.organizationId) {
|
|
593
|
+
const organization = await ctx.context.adapter.findOne({
|
|
594
|
+
model: "member",
|
|
595
|
+
where: [
|
|
596
|
+
{
|
|
597
|
+
field: "userId",
|
|
598
|
+
value: user.id,
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
field: "organizationId",
|
|
602
|
+
value: ctx.body.organizationId,
|
|
603
|
+
},
|
|
604
|
+
],
|
|
605
|
+
});
|
|
606
|
+
if (!organization) {
|
|
607
|
+
throw new APIError("BAD_REQUEST", {
|
|
608
|
+
message: "You are not a member of the organization",
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
}
|
|
592
612
|
const provider = await ctx.context.adapter.create<
|
|
593
613
|
Record<string, any>,
|
|
594
614
|
SSOProvider
|