@tachybase/plugin-auth-main-app 1.5.1 → 1.6.1
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/externalVersion.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@tachybase/client": "1.
|
|
3
|
-
"@tachybase/module-auth": "1.
|
|
2
|
+
"@tachybase/client": "1.6.1",
|
|
3
|
+
"@tachybase/module-auth": "1.6.1",
|
|
4
4
|
"react": "18.3.1",
|
|
5
|
-
"@tachybase/schema": "1.
|
|
5
|
+
"@tachybase/schema": "1.6.0-alpha.9",
|
|
6
6
|
"antd": "5.22.5",
|
|
7
|
-
"@tego/server": "1.
|
|
7
|
+
"@tego/server": "1.6.0-alpha.9"
|
|
8
8
|
};
|
|
@@ -74,7 +74,7 @@ class AuthMainAppController {
|
|
|
74
74
|
__runInitializers(_init, 5, this);
|
|
75
75
|
}
|
|
76
76
|
async getMainUser(ctx, next) {
|
|
77
|
-
if (ctx.
|
|
77
|
+
if (ctx.tego.name === "main") {
|
|
78
78
|
ctx.body = {};
|
|
79
79
|
return next();
|
|
80
80
|
}
|
|
@@ -93,7 +93,7 @@ class AuthMainAppController {
|
|
|
93
93
|
const multiAppRepo = mainApp.db.getRepository("applications");
|
|
94
94
|
const multiApp = await multiAppRepo.findOne({
|
|
95
95
|
filter: {
|
|
96
|
-
$and: [{ name: ctx.
|
|
96
|
+
$and: [{ name: ctx.tego.name }, { $or: [{ createdById: user.userId }, { partners: { id: user.userId } }] }]
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
99
|
if (!multiApp) {
|
|
@@ -138,7 +138,7 @@ class AuthMainAppController {
|
|
|
138
138
|
const currentUserData = currentUser == null ? void 0 : currentUser.dataValues;
|
|
139
139
|
const tokenInfo = await mainApp.authManager.tokenController.add({ userId: currentUserData.id });
|
|
140
140
|
const expiresIn = Math.floor((await mainApp.authManager.tokenController.getConfig()).tokenExpirationTime / 1e3);
|
|
141
|
-
const newToken = ctx.
|
|
141
|
+
const newToken = ctx.tego.authManager.jwt.sign(
|
|
142
142
|
{
|
|
143
143
|
userId: currentUserData.id,
|
|
144
144
|
temp: true,
|
|
@@ -169,7 +169,7 @@ class AuthMainAppController {
|
|
|
169
169
|
}
|
|
170
170
|
async set(ctx, next) {
|
|
171
171
|
const { selfSignIn, authMainApp } = ctx.action.params.values;
|
|
172
|
-
if (ctx.
|
|
172
|
+
if (ctx.tego.name === "main" && !selfSignIn) {
|
|
173
173
|
ctx.throw(400, ctx.t("Unable to disable all authenticators in the main application.", { ns: import_constants.NAMESPACE }));
|
|
174
174
|
}
|
|
175
175
|
if (!selfSignIn && !authMainApp) {
|
|
@@ -109,7 +109,7 @@ class AuthMainAppService {
|
|
|
109
109
|
addMiddleWare() {
|
|
110
110
|
this.app.resourcer.use(
|
|
111
111
|
async (ctx, next) => {
|
|
112
|
-
if (ctx.
|
|
112
|
+
if (ctx.tego.name === "main") {
|
|
113
113
|
return next();
|
|
114
114
|
}
|
|
115
115
|
const { resourceName, actionName } = ctx.action.params;
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/plugin-auth-main-app",
|
|
3
3
|
"displayName": "Single Sign-On on multi app (SSO)",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.1",
|
|
5
5
|
"description": "Users log in via the main application; sub-applications can disable their standalone login.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Authentication"
|
|
8
8
|
],
|
|
9
9
|
"main": "dist/server/index.js",
|
|
10
10
|
"devDependencies": {
|
|
11
|
-
"@tachybase/schema": "1.
|
|
12
|
-
"@tachybase/test": "1.
|
|
13
|
-
"@tego/client": "1.
|
|
14
|
-
"@tego/server": "1.
|
|
11
|
+
"@tachybase/schema": "1.6.0-alpha.9",
|
|
12
|
+
"@tachybase/test": "1.6.0-alpha.9",
|
|
13
|
+
"@tego/client": "1.6.0-alpha.9",
|
|
14
|
+
"@tego/server": "1.6.0-alpha.9",
|
|
15
15
|
"antd": "5.22.5",
|
|
16
|
-
"@tachybase/
|
|
17
|
-
"@tachybase/
|
|
16
|
+
"@tachybase/module-auth": "1.6.1",
|
|
17
|
+
"@tachybase/client": "1.6.1"
|
|
18
18
|
},
|
|
19
19
|
"description.zh-CN": "通过主应用登录子应用,子应用可关闭登录",
|
|
20
20
|
"displayName.zh-CN": "多应用统一登录"
|