very-express 0.5.11 → 0.5.13
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/index.js +231 -226
- package/dist/templates/_controllers/_ControllerFactory.ts +1 -0
- package/dist/templates/_middlewares/Authentication.ts +0 -2
- package/dist/templates/_plugins/auth/JWTKeyStore.ts +0 -1
- package/dist/templates/_plugins/auth/jwt.ts +0 -1
- package/dist/templates/_plugins/auth/oauthVerify.ts +2 -3
- package/dist/templates/_plugins/auth/profileMapping.ts +0 -1
- package/dist/templates/_plugins/auth/token.ts +0 -1
- package/dist/templates/{root/.env → _projectSettings/env} +4 -4
- package/dist/templates/_roles/_RoleFactory.ts +1 -0
- package/dist/templates/_routes/oauth/OAuthRouteFactory.ts +0 -1
- package/dist/templates/_services/VexDbConnector.ts +0 -1
- package/dist/templates/_services/VexSystem.ts +0 -1
- package/dist/templates/_utils/common.ts +0 -1
- package/package.json +1 -1
- package/tsconfig.json +1 -1
- package/vex.config.json +35 -35
- /package/dist/templates/{root → _projectSettings}/package.json +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// {{headerComment}}
|
|
2
|
-
|
|
3
2
|
import { UserModel, UserDocument } from "./../../_models/UserModel.gen";
|
|
4
3
|
import { User } from "./../../_types/User.gen";
|
|
5
4
|
import profileMapping, { IProfile } from "./profileMapping.gen";
|
|
@@ -15,7 +14,7 @@ export default async function oauthVerify(accessToken: string, refreshToken: str
|
|
|
15
14
|
// find user by authProfiles.authId or email
|
|
16
15
|
const existingUser = await UserModel.findOne<UserDocument>({
|
|
17
16
|
email: authUser.email,
|
|
18
|
-
$or: authUser.authProfiles?.map((p) => {
|
|
17
|
+
$or: authUser.authProfiles?.map((p:any) => {
|
|
19
18
|
return { "authProfiles.authId": p.authId };
|
|
20
19
|
}),
|
|
21
20
|
});
|
|
@@ -60,7 +59,7 @@ async function processExistingUser( authUser: User, existingUser: UserDocument):
|
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
// B.1. check current provider exist in authProfiles
|
|
63
|
-
const providerExists = userProfiles.length > 0 && userProfiles.find((p) => {
|
|
62
|
+
const providerExists = userProfiles.length > 0 && userProfiles.find((p:any) => {
|
|
64
63
|
return (p.provider === authProfile.provider) && (p.authId === authProfile.authId);
|
|
65
64
|
});
|
|
66
65
|
|
|
@@ -4,19 +4,19 @@ MONGODB_URI=mongodb://localhost:27017/veryExpressDB
|
|
|
4
4
|
LOGIN_SUCCESS_REDIRECT_PATH=/logincallback
|
|
5
5
|
LOGIN_FAILED_REDIRECT_PATH=/logincallback
|
|
6
6
|
|
|
7
|
+
# OAUTH
|
|
7
8
|
OAUTH_GOOGLE_CLIENTID=
|
|
8
9
|
OAUTH_GOOGLE_CLIENTSECRET=
|
|
9
|
-
|
|
10
10
|
OAUTH_GITHUB_CLIENTID=
|
|
11
11
|
OAUTH_GITHUB_CLIENTSECRET=
|
|
12
|
-
|
|
12
|
+
# OAUTH_MICROSOFT_CLIENTID=
|
|
13
|
+
# OAUTH_MICROSOFT_CLIENTSECRET=
|
|
13
14
|
# OAUTH_APPLE_CLIENTID=
|
|
14
15
|
# OAUTH_APPLE_CLIENTSECRET=
|
|
15
16
|
|
|
17
|
+
# JWT token
|
|
16
18
|
ACCESS_TOKEN_EXPIRE_TIME='5m'
|
|
17
19
|
REFRESH_TOKEN_EXPIRE_TIME='15m'
|
|
18
|
-
|
|
19
20
|
SESSION_COOKIE_SECRET='my-session-cookie-secret'
|
|
20
|
-
|
|
21
21
|
JWT_ALGORITHM='HS256'
|
|
22
22
|
JWT_SECRET0='my-secret-key0'
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
99
99
|
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
100
100
|
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
101
|
-
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an
|
|
101
|
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an lo */
|
|
102
102
|
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
103
103
|
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
104
104
|
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
package/vex.config.json
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
{
|
|
2
|
-
"jsonSchemaDir": "./output/jsonSchema",
|
|
3
|
-
"rootDir": "./output",
|
|
4
|
-
"srcDir": "./output/src",
|
|
5
|
-
"openapiDir": "./output/src/openapi",
|
|
6
|
-
"sysDir": "output/src/system",
|
|
7
|
-
"app": {
|
|
8
|
-
"enableSwagger": true,
|
|
9
|
-
"useUserSchema": true,
|
|
10
|
-
"useObjectID": true,
|
|
11
|
-
"allowApiCreateUpdate_id": false,
|
|
12
|
-
"useStatefulRedisAuth": true
|
|
13
|
-
},
|
|
14
|
-
"sso": {
|
|
15
|
-
"useHttpOnlyCookieToken": true,
|
|
16
|
-
"oauthProviders": {
|
|
17
|
-
"google": true,
|
|
18
|
-
"github": true
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"useRBAC": {
|
|
22
|
-
"roles": [
|
|
23
|
-
"visitor",
|
|
24
|
-
"member",
|
|
25
|
-
"admin"
|
|
26
|
-
],
|
|
27
|
-
"default": "visitor",
|
|
28
|
-
"schemaIncluded": [
|
|
29
|
-
"User"
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
"generator": {
|
|
33
|
-
"commitBeforeGenerate": false,
|
|
34
|
-
"disableVersionLabel": false
|
|
35
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"jsonSchemaDir": "./output/jsonSchema",
|
|
3
|
+
"rootDir": "./output",
|
|
4
|
+
"srcDir": "./output/src",
|
|
5
|
+
"openapiDir": "./output/src/openapi",
|
|
6
|
+
"sysDir": "output/src/system",
|
|
7
|
+
"app": {
|
|
8
|
+
"enableSwagger": true,
|
|
9
|
+
"useUserSchema": true,
|
|
10
|
+
"useObjectID": true,
|
|
11
|
+
"allowApiCreateUpdate_id": false,
|
|
12
|
+
"useStatefulRedisAuth": true
|
|
13
|
+
},
|
|
14
|
+
"sso": {
|
|
15
|
+
"useHttpOnlyCookieToken": true,
|
|
16
|
+
"oauthProviders": {
|
|
17
|
+
"google": true,
|
|
18
|
+
"github": true
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"useRBAC": {
|
|
22
|
+
"roles": [
|
|
23
|
+
"visitor",
|
|
24
|
+
"member",
|
|
25
|
+
"admin"
|
|
26
|
+
],
|
|
27
|
+
"default": "visitor",
|
|
28
|
+
"schemaIncluded": [
|
|
29
|
+
"User"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"generator": {
|
|
33
|
+
"commitBeforeGenerate": false,
|
|
34
|
+
"disableVersionLabel": false
|
|
35
|
+
}
|
|
36
36
|
}
|
|
File without changes
|