@bigso/auth-sdk 0.5.5 → 0.5.6
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/dist/browser/index.d.cts +1 -1
- package/dist/browser/index.d.ts +1 -1
- package/dist/express/index.cjs +3 -2
- package/dist/express/index.d.cts +1 -1
- package/dist/express/index.d.ts +1 -1
- package/dist/express/index.js +3 -2
- package/dist/node/index.d.cts +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/types-B51l8wWh.d.cts +82 -0
- package/dist/types-B51l8wWh.d.ts +82 -0
- package/package.json +1 -1
package/dist/browser/index.d.cts
CHANGED
package/dist/browser/index.d.ts
CHANGED
package/dist/express/index.cjs
CHANGED
|
@@ -42,14 +42,15 @@ function ssoAuthMiddleware(options) {
|
|
|
42
42
|
res.status(401).json({ error: "Invalid or expired access token" });
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
-
const
|
|
45
|
+
const selectedTenantId = payload.tenantId;
|
|
46
|
+
const tenantInfo = payload.tenants.find((t) => t.id === selectedTenantId);
|
|
46
47
|
req.user = {
|
|
47
48
|
userId: payload.sub,
|
|
48
49
|
email: "",
|
|
49
50
|
firstName: "",
|
|
50
51
|
lastName: ""
|
|
51
52
|
};
|
|
52
|
-
req.tenant =
|
|
53
|
+
req.tenant = tenantInfo;
|
|
53
54
|
req.tokenPayload = payload;
|
|
54
55
|
next();
|
|
55
56
|
} catch (error) {
|
package/dist/express/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Request, Response, NextFunction, Router } from 'express';
|
|
2
2
|
import { BigsoSsoClient } from '../node/index.cjs';
|
|
3
|
-
import { S as SsoJwtTenant, b as SsoTokenPayload, V as V2ExchangeResponse } from '../types-
|
|
3
|
+
import { S as SsoJwtTenant, b as SsoTokenPayload, V as V2ExchangeResponse } from '../types-B51l8wWh.cjs';
|
|
4
4
|
|
|
5
5
|
interface SsoAuthMiddlewareOptions {
|
|
6
6
|
ssoClient: BigsoSsoClient;
|
package/dist/express/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Request, Response, NextFunction, Router } from 'express';
|
|
2
2
|
import { BigsoSsoClient } from '../node/index.js';
|
|
3
|
-
import { S as SsoJwtTenant, b as SsoTokenPayload, V as V2ExchangeResponse } from '../types-
|
|
3
|
+
import { S as SsoJwtTenant, b as SsoTokenPayload, V as V2ExchangeResponse } from '../types-B51l8wWh.js';
|
|
4
4
|
|
|
5
5
|
interface SsoAuthMiddlewareOptions {
|
|
6
6
|
ssoClient: BigsoSsoClient;
|
package/dist/express/index.js
CHANGED
|
@@ -13,14 +13,15 @@ function ssoAuthMiddleware(options) {
|
|
|
13
13
|
res.status(401).json({ error: "Invalid or expired access token" });
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
const
|
|
16
|
+
const selectedTenantId = payload.tenantId;
|
|
17
|
+
const tenantInfo = payload.tenants.find((t) => t.id === selectedTenantId);
|
|
17
18
|
req.user = {
|
|
18
19
|
userId: payload.sub,
|
|
19
20
|
email: "",
|
|
20
21
|
firstName: "",
|
|
21
22
|
lastName: ""
|
|
22
23
|
};
|
|
23
|
-
req.tenant =
|
|
24
|
+
req.tenant = tenantInfo;
|
|
24
25
|
req.tokenPayload = payload;
|
|
25
26
|
next();
|
|
26
27
|
} catch (error) {
|
package/dist/node/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as SsoTokenPayload, c as V2LoginResponse, V as V2ExchangeResponse, d as V2RefreshResponse } from '../types-
|
|
1
|
+
import { b as SsoTokenPayload, c as V2LoginResponse, V as V2ExchangeResponse, d as V2RefreshResponse } from '../types-B51l8wWh.cjs';
|
|
2
2
|
|
|
3
3
|
interface SsoClientOptions {
|
|
4
4
|
ssoBackendUrl: string;
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as SsoTokenPayload, c as V2LoginResponse, V as V2ExchangeResponse, d as V2RefreshResponse } from '../types-
|
|
1
|
+
import { b as SsoTokenPayload, c as V2LoginResponse, V as V2ExchangeResponse, d as V2RefreshResponse } from '../types-B51l8wWh.js';
|
|
2
2
|
|
|
3
3
|
interface SsoClientOptions {
|
|
4
4
|
ssoBackendUrl: string;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
interface BigsoAuthOptions {
|
|
2
|
+
clientId: string;
|
|
3
|
+
ssoOrigin: string;
|
|
4
|
+
jwksUrl: string;
|
|
5
|
+
timeout?: number;
|
|
6
|
+
debug?: boolean;
|
|
7
|
+
redirectUri?: string;
|
|
8
|
+
tenantHint?: string;
|
|
9
|
+
theme?: 'light' | 'dark';
|
|
10
|
+
}
|
|
11
|
+
interface SsoUser {
|
|
12
|
+
userId: string;
|
|
13
|
+
email: string;
|
|
14
|
+
firstName: string;
|
|
15
|
+
lastName: string;
|
|
16
|
+
}
|
|
17
|
+
interface SsoTenant {
|
|
18
|
+
tenantId: string;
|
|
19
|
+
name: string;
|
|
20
|
+
slug: string;
|
|
21
|
+
role: string;
|
|
22
|
+
}
|
|
23
|
+
interface SsoJwtTenant {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
slug: string;
|
|
27
|
+
role: string;
|
|
28
|
+
apps: string[];
|
|
29
|
+
}
|
|
30
|
+
interface SsoTokenPayload {
|
|
31
|
+
sub: string;
|
|
32
|
+
jti: string;
|
|
33
|
+
iss: string;
|
|
34
|
+
aud: string;
|
|
35
|
+
exp: number;
|
|
36
|
+
iat: number;
|
|
37
|
+
tenants: SsoJwtTenant[];
|
|
38
|
+
tenantId: string;
|
|
39
|
+
systemRole: string;
|
|
40
|
+
scope?: string[];
|
|
41
|
+
deviceFingerprint?: string;
|
|
42
|
+
}
|
|
43
|
+
interface V2LoginResponse {
|
|
44
|
+
success: boolean;
|
|
45
|
+
tokens: {
|
|
46
|
+
accessToken: string;
|
|
47
|
+
expiresIn: number;
|
|
48
|
+
};
|
|
49
|
+
user: SsoUser;
|
|
50
|
+
}
|
|
51
|
+
interface V2ExchangeResponse {
|
|
52
|
+
success: boolean;
|
|
53
|
+
tokens: {
|
|
54
|
+
accessToken: string;
|
|
55
|
+
refreshToken: string;
|
|
56
|
+
expiresIn: number;
|
|
57
|
+
};
|
|
58
|
+
user: SsoUser;
|
|
59
|
+
tenant: SsoTenant;
|
|
60
|
+
}
|
|
61
|
+
interface V2RefreshResponse {
|
|
62
|
+
success: boolean;
|
|
63
|
+
tokens: {
|
|
64
|
+
accessToken: string;
|
|
65
|
+
expiresIn: number;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
interface BigsoAuthResult {
|
|
69
|
+
code: string;
|
|
70
|
+
state: string;
|
|
71
|
+
nonce: string;
|
|
72
|
+
codeVerifier: string;
|
|
73
|
+
signed_payload: string;
|
|
74
|
+
tenant?: SsoTenant;
|
|
75
|
+
jti?: string;
|
|
76
|
+
iss?: string;
|
|
77
|
+
aud?: string;
|
|
78
|
+
exp?: number;
|
|
79
|
+
iat?: number;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export type { BigsoAuthOptions as B, SsoJwtTenant as S, V2ExchangeResponse as V, BigsoAuthResult as a, SsoTokenPayload as b, V2LoginResponse as c, V2RefreshResponse as d };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
interface BigsoAuthOptions {
|
|
2
|
+
clientId: string;
|
|
3
|
+
ssoOrigin: string;
|
|
4
|
+
jwksUrl: string;
|
|
5
|
+
timeout?: number;
|
|
6
|
+
debug?: boolean;
|
|
7
|
+
redirectUri?: string;
|
|
8
|
+
tenantHint?: string;
|
|
9
|
+
theme?: 'light' | 'dark';
|
|
10
|
+
}
|
|
11
|
+
interface SsoUser {
|
|
12
|
+
userId: string;
|
|
13
|
+
email: string;
|
|
14
|
+
firstName: string;
|
|
15
|
+
lastName: string;
|
|
16
|
+
}
|
|
17
|
+
interface SsoTenant {
|
|
18
|
+
tenantId: string;
|
|
19
|
+
name: string;
|
|
20
|
+
slug: string;
|
|
21
|
+
role: string;
|
|
22
|
+
}
|
|
23
|
+
interface SsoJwtTenant {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
slug: string;
|
|
27
|
+
role: string;
|
|
28
|
+
apps: string[];
|
|
29
|
+
}
|
|
30
|
+
interface SsoTokenPayload {
|
|
31
|
+
sub: string;
|
|
32
|
+
jti: string;
|
|
33
|
+
iss: string;
|
|
34
|
+
aud: string;
|
|
35
|
+
exp: number;
|
|
36
|
+
iat: number;
|
|
37
|
+
tenants: SsoJwtTenant[];
|
|
38
|
+
tenantId: string;
|
|
39
|
+
systemRole: string;
|
|
40
|
+
scope?: string[];
|
|
41
|
+
deviceFingerprint?: string;
|
|
42
|
+
}
|
|
43
|
+
interface V2LoginResponse {
|
|
44
|
+
success: boolean;
|
|
45
|
+
tokens: {
|
|
46
|
+
accessToken: string;
|
|
47
|
+
expiresIn: number;
|
|
48
|
+
};
|
|
49
|
+
user: SsoUser;
|
|
50
|
+
}
|
|
51
|
+
interface V2ExchangeResponse {
|
|
52
|
+
success: boolean;
|
|
53
|
+
tokens: {
|
|
54
|
+
accessToken: string;
|
|
55
|
+
refreshToken: string;
|
|
56
|
+
expiresIn: number;
|
|
57
|
+
};
|
|
58
|
+
user: SsoUser;
|
|
59
|
+
tenant: SsoTenant;
|
|
60
|
+
}
|
|
61
|
+
interface V2RefreshResponse {
|
|
62
|
+
success: boolean;
|
|
63
|
+
tokens: {
|
|
64
|
+
accessToken: string;
|
|
65
|
+
expiresIn: number;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
interface BigsoAuthResult {
|
|
69
|
+
code: string;
|
|
70
|
+
state: string;
|
|
71
|
+
nonce: string;
|
|
72
|
+
codeVerifier: string;
|
|
73
|
+
signed_payload: string;
|
|
74
|
+
tenant?: SsoTenant;
|
|
75
|
+
jti?: string;
|
|
76
|
+
iss?: string;
|
|
77
|
+
aud?: string;
|
|
78
|
+
exp?: number;
|
|
79
|
+
iat?: number;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export type { BigsoAuthOptions as B, SsoJwtTenant as S, V2ExchangeResponse as V, BigsoAuthResult as a, SsoTokenPayload as b, V2LoginResponse as c, V2RefreshResponse as d };
|