@tachybase/plugin-auth-cas 1.6.0 → 1.6.3

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/README.md CHANGED
@@ -7,6 +7,5 @@
7
7
  > 首先你要开启此插件
8
8
 
9
9
  1. 在 Authentication 中添加一个 Auth Type 为 CAS 类型的登录方式
10
- <img src="https://github.com/tachybase/tachybase/assets/29533304/a9dd6965-afce-4ff3-85d8-ff0c1baa7298">
11
10
  2. 然后你将在登录页看到一个名为 CAS Login 的按钮
12
11
  3. 完成
package/README.zh-CN.md CHANGED
@@ -7,6 +7,5 @@
7
7
  > 首先你要开启此插件
8
8
 
9
9
  1. 在 Authentication 中添加一个 Auth Type 为 CAS 类型的登录方式
10
- <img src="https://github.com/tachybase/tachybase/assets/29533304/a9dd6965-afce-4ff3-85d8-ff0c1baa7298">
11
10
  2. 然后你将在登录页看到一个名为 CAS Login 的按钮
12
11
  3. 完成
@@ -1,12 +1,12 @@
1
1
  module.exports = {
2
2
  "react": "18.3.1",
3
- "@tachybase/client": "1.6.0",
3
+ "@tachybase/client": "1.6.3",
4
4
  "antd": "5.22.5",
5
- "@tachybase/module-auth": "1.6.0",
6
- "@ant-design/icons": "5.6.1",
7
- "@tego/client": "1.3.52",
5
+ "@tachybase/module-auth": "1.6.3",
6
+ "@ant-design/icons": "6.1.0",
7
+ "@tego/client": "1.6.1",
8
8
  "react-router-dom": "6.28.1",
9
- "@tego/server": "1.3.52",
9
+ "@tego/server": "1.6.1",
10
10
  "axios": "1.13.0",
11
11
  "react-i18next": "16.2.1"
12
12
  };
@@ -22,9 +22,9 @@ __export(login_exports, {
22
22
  module.exports = __toCommonJS(login_exports);
23
23
  const login = async (ctx, next) => {
24
24
  const { authenticator, redirect = "/admin" } = ctx.action.params;
25
- const auth = await ctx.app.authManager.get(authenticator, ctx);
25
+ const auth = await ctx.tego.authManager.get(authenticator, ctx);
26
26
  const { casUrl } = auth.getOptions();
27
- const service = auth.getService(authenticator, ctx.app.name, redirect);
27
+ const service = auth.getService(authenticator, ctx.tego.name, redirect);
28
28
  ctx.redirect(`${casUrl}/login?service=${service}`);
29
29
  next();
30
30
  };
@@ -30,7 +30,7 @@ const service = async (ctx, next) => {
30
30
  prefix += `apps/${appName}`;
31
31
  }
32
32
  }
33
- const auth = await ctx.app.authManager.get(authenticator, ctx);
33
+ const auth = await ctx.tego.authManager.get(authenticator, ctx);
34
34
  if (prefix.endsWith("/")) {
35
35
  prefix = prefix.slice(0, -1);
36
36
  }
@@ -37,7 +37,8 @@ class CASAuth extends import_server.BaseAuth {
37
37
  const { ctx } = config;
38
38
  super({
39
39
  ...config,
40
- userCollection: ctx.db.getCollection("users")
40
+ userCollection: ctx.db.getCollection("users"),
41
+ userStatusCollection: ctx.db.getCollection("userStatuses")
41
42
  });
42
43
  }
43
44
  getOptions() {
File without changes
@@ -35,7 +35,7 @@ class CasPlugin extends import_server.Plugin {
35
35
  this.app.authManager.registerTypes(import_constants.authType, {
36
36
  auth: import_auth.CASAuth
37
37
  });
38
- this.app.resource({
38
+ this.app.resourcer.define({
39
39
  name: "cas",
40
40
  actions: {
41
41
  service: import_service.service,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tachybase/plugin-auth-cas",
3
3
  "displayName": "Auth: CAS",
4
- "version": "1.6.0",
4
+ "version": "1.6.3",
5
5
  "description": "CAS authentication.",
6
6
  "keywords": [
7
7
  "Authentication"
@@ -10,16 +10,16 @@
10
10
  "main": "./dist/server/index.js",
11
11
  "dependencies": {},
12
12
  "devDependencies": {
13
- "@ant-design/icons": "^5.6.1",
14
- "@tachybase/test": "1.3.52",
15
- "@tego/client": "1.3.52",
16
- "@tego/server": "1.3.52",
13
+ "@ant-design/icons": "^6.1.0",
14
+ "@tachybase/test": "1.6.1",
15
+ "@tego/client": "1.6.1",
16
+ "@tego/server": "1.6.1",
17
17
  "antd": "5.22.5",
18
18
  "axios": "1.13.0",
19
19
  "react-i18next": "16.2.1",
20
20
  "react-router-dom": "6.28.1",
21
- "@tachybase/client": "1.6.0",
22
- "@tachybase/module-auth": "1.6.0"
21
+ "@tachybase/module-auth": "1.6.3",
22
+ "@tachybase/client": "1.6.3"
23
23
  },
24
24
  "description.zh-CN": "通过 CAS 协议认证身份。",
25
25
  "displayName.zh-CN": "认证:CAS",
@@ -4,9 +4,9 @@ import { CASAuth } from '../auth';
4
4
 
5
5
  export const login = async (ctx: Context, next: Next) => {
6
6
  const { authenticator, redirect = '/admin' } = ctx.action.params;
7
- const auth = (await ctx.app.authManager.get(authenticator, ctx)) as CASAuth;
7
+ const auth = (await ctx.tego.authManager.get(authenticator, ctx)) as CASAuth;
8
8
  const { casUrl } = auth.getOptions();
9
- const service = auth.getService(authenticator, ctx.app.name, redirect);
9
+ const service = auth.getService(authenticator, ctx.tego.name, redirect);
10
10
  ctx.redirect(`${casUrl}/login?service=${service}`);
11
11
  next();
12
12
  };
@@ -13,7 +13,7 @@ export const service = async (ctx: Context, next: Next) => {
13
13
  }
14
14
  }
15
15
 
16
- const auth = (await ctx.app.authManager.get(authenticator, ctx)) as CASAuth;
16
+ const auth = (await ctx.tego.authManager.get(authenticator, ctx)) as CASAuth;
17
17
 
18
18
  if (prefix.endsWith('/')) {
19
19
  prefix = prefix.slice(0, -1);
@@ -1,6 +1,6 @@
1
1
  import { AuthModel } from '@tachybase/module-auth';
2
-
3
2
  import { AuthConfig, BaseAuth, Model } from '@tego/server';
3
+
4
4
  import axios from 'axios';
5
5
 
6
6
  export class CASAuth extends BaseAuth {
@@ -9,6 +9,7 @@ export class CASAuth extends BaseAuth {
9
9
  super({
10
10
  ...config,
11
11
  userCollection: ctx.db.getCollection('users'),
12
+ userStatusCollection: ctx.db.getCollection('userStatuses'),
12
13
  });
13
14
  }
14
15
 
@@ -15,7 +15,7 @@ export class CasPlugin extends Plugin {
15
15
  auth: CASAuth,
16
16
  });
17
17
 
18
- this.app.resource({
18
+ this.app.resourcer.define({
19
19
  name: 'cas',
20
20
  actions: {
21
21
  service,