cabloy 5.1.183 → 5.1.185

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/.cabloy-version CHANGED
@@ -1 +1 @@
1
- 5.1.183
1
+ 5.1.185
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.1.185
4
+
5
+ ### Features
6
+
7
+ - Add GitHub authentication support.
8
+
9
+ ## 5.1.184
10
+
11
+ ### Improvements
12
+
13
+ - Update guard demonstration examples.
14
+
3
15
  ## 5.1.183
4
16
 
5
17
  ### Improvements
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cabloy",
3
- "version": "5.1.183",
3
+ "version": "5.1.185",
4
4
  "gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
5
5
  "description": "A Node.js fullstack framework",
6
6
  "keywords": [
package/vona/env/.env CHANGED
@@ -11,13 +11,13 @@ CORS_WHITE_LIST =
11
11
  SERVER_KEYS = vona__1596889047267_3245
12
12
  SERVER_GLOBALPREFIX = /api
13
13
  SERVER_PUBLICDIR =
14
- SERVER_SUBDOMAINOFFSET = 2
15
14
  SERVER_WORKERS =
16
15
  SERVER_LISTEN_HOSTNAME = 0.0.0.0
17
16
  SERVER_LISTEN_PORT = 7102
18
17
  SERVER_LISTEN_DISABLE =
19
18
  SERVER_SERVE_PROTOCOL =
20
19
  SERVER_SERVE_HOST =
20
+ SERVER_SUBDOMAINOFFSET = 2
21
21
 
22
22
  # project
23
23
 
@@ -92,6 +92,11 @@ HOME_USER_DISABLE_USER_ADMIN = false
92
92
  HOME_USER_BUILTIN_ROLE_REGISTERED_USER_SITE_IDS = *
93
93
  HOME_USER_BUILTIN_ROLE_SYSTEM_ADMIN_SITE_IDS = *
94
94
 
95
+ # auth
96
+
97
+ AUTH_GITHUB_CLIENTID =
98
+ AUTH_GITHUB_CLIENTSECRET =
99
+
95
100
  # payment
96
101
 
97
102
  PAY_MOCK_DEFAULT_CREDENTIAL = pay-mock-dev-credential
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vona",
3
- "version": "5.1.95",
3
+ "version": "5.1.96",
4
4
  "gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
5
5
  "description": "Vona is an intuitive, elegant and powerful Node.js framework for rapidly developing enterprise applications of any size",
6
6
  "keywords": [
@@ -1,7 +1,7 @@
1
1
  import type { Next } from 'vona';
2
2
  import type { IDecoratorGuardOptionsGlobal, IGuardExecute } from 'vona-module-a-aspect';
3
3
 
4
- import { BeanBase, Global, useApp } from 'vona';
4
+ import { $protocolKey, BeanBase, Global, useApp } from 'vona';
5
5
  import { Guard } from 'vona-module-a-aspect';
6
6
 
7
7
  const app = useApp();
@@ -40,12 +40,19 @@ export interface IGuardOptionsDemonstration extends IDecoratorGuardOptionsGlobal
40
40
  '/home/user/passport/createPassportJwtFromOauthCode',
41
41
  '/home/user/passport/createTempAuthToken',
42
42
  '/auth/passport/callback',
43
+ '/auth/mock/authorize',
44
+ '/captcha/create',
45
+ '/image/upload-policy',
46
+ '/file/upload-policy',
43
47
  ],
44
48
  dependencies: 'a-user:passport',
45
49
  })
46
50
  @Global()
47
51
  export class GuardDemonstration extends BeanBase implements IGuardExecute {
48
52
  async execute(options: IGuardOptionsDemonstration, next: Next): Promise<boolean> {
53
+ const headerOpenapiSchema = this.ctx.headers[$protocolKey('x-vona-openapi-schema')];
54
+ if (headerOpenapiSchema?.toString() === 'true') return next();
55
+
49
56
  const method = this.ctx.method.toUpperCase();
50
57
  if (!options.methodsForWrite.some(item => item.toUpperCase() === method)) {
51
58
  return next();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vona-module-auth-oauth",
3
- "version": "5.0.10",
3
+ "version": "5.0.11",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "Vona Module"
@@ -7,6 +7,7 @@ import type {
7
7
  } from 'vona-module-a-auth';
8
8
 
9
9
  import StrategyGithub from 'passport-github';
10
+ import { useApp } from 'vona';
10
11
  import { AuthProvider, BeanAuthProviderOauth2Base } from 'vona-module-a-auth';
11
12
 
12
13
  export interface IAuthProviderOauthClientOptionsGithub extends IAuthProviderOauthClientOptions {
@@ -27,6 +28,8 @@ export interface IAuthProviderOptionsOauth extends IDecoratorAuthProviderOptions
27
28
  IAuthProviderOauthClientOptions
28
29
  > {}
29
30
 
31
+ const app = useApp();
32
+
30
33
  @AuthProvider<IAuthProviderOptionsOauth>({
31
34
  base: {
32
35
  confirmed: true,
@@ -36,6 +39,8 @@ export interface IAuthProviderOptionsOauth extends IDecoratorAuthProviderOptions
36
39
  clients: {
37
40
  github: {
38
41
  Strategy: StrategyGithub,
42
+ clientID: app.meta.env.AUTH_GITHUB_CLIENTID,
43
+ clientSecret: app.meta.env.AUTH_GITHUB_CLIENTSECRET,
39
44
  },
40
45
  },
41
46
  })
@@ -1 +1,2 @@
1
+ export * from './types/index.ts';
1
2
  export * from './.metadata/index.ts';
@@ -0,0 +1,8 @@
1
+ declare module 'vona' {
2
+ export interface VonaConfigEnv {
3
+ AUTH_GITHUB_CLIENTID: string | undefined;
4
+ AUTH_GITHUB_CLIENTSECRET: string | undefined;
5
+ }
6
+ }
7
+
8
+ export {};
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vona-suite-a-auth",
3
- "version": "5.1.24",
3
+ "version": "5.1.25",
4
4
  "gitHead": "a79189b882c17af5911573896a781bbb0046d37d",
5
5
  "description": "",
6
6
  "author": "",
@@ -8,7 +8,7 @@
8
8
  "type": "module",
9
9
  "dependencies": {
10
10
  "vona-module-a-auth": "workspace:^",
11
- "vona-module-auth-oauth": "^5.0.10",
11
+ "vona-module-auth-oauth": "^5.0.11",
12
12
  "vona-module-auth-simple": "workspace:^"
13
13
  },
14
14
  "title": "a-auth"