@tomei/sso 0.16.2 → 0.16.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/.commitlintrc.json +22 -22
- package/.eslintrc +16 -16
- package/.eslintrc.js +35 -35
- package/.husky/commit-msg +15 -15
- package/.husky/pre-commit +7 -7
- package/.prettierrc +4 -4
- package/Jenkinsfile +57 -57
- package/README.md +23 -23
- package/__tests__/unit/components/login-user/login-user.spec.ts +742 -742
- package/__tests__/unit/components/password-hash/password-hash.service.spec.ts +31 -31
- package/__tests__/unit/redis-client/redis.service.spec.ts +23 -23
- package/__tests__/unit/session/session.service.spec.ts +47 -47
- package/__tests__/unit/system-privilege/system-privilage.spec.ts +91 -91
- package/create-sso-user.sql +39 -39
- package/dist/src/components/login-user/interfaces/user-info.interface.d.ts +2 -1
- package/dist/src/components/login-user/login-user.d.ts +2 -1
- package/dist/src/components/login-user/login-user.js.map +1 -1
- package/dist/src/components/staff/staff.js +1 -1
- package/dist/src/components/staff/staff.js.map +1 -1
- package/dist/src/enum/index.d.ts +1 -0
- package/dist/src/enum/index.js +1 -0
- package/dist/src/enum/index.js.map +1 -1
- package/dist/src/enum/user-status.enum.d.ts +7 -0
- package/dist/src/enum/user-status.enum.js +12 -0
- package/dist/src/enum/user-status.enum.js.map +1 -0
- package/dist/src/models/user.entity.d.ts +2 -1
- package/dist/src/models/user.entity.js +1 -0
- package/dist/src/models/user.entity.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/jest.config.js +13 -13
- package/migrations/20240314080603-create-user-table.js +108 -108
- package/migrations/20240314080604-create-user-user-group-table.js +55 -55
- package/migrations/20240314080605-create-login-history-table.js +49 -49
- package/package.json +80 -80
- package/sampledotenv +7 -7
- package/src/components/login-user/interfaces/user-info.interface.ts +2 -1
- package/src/components/login-user/login-user.ts +4 -3
- package/src/components/staff/staff.ts +1 -3
- package/src/enum/index.ts +1 -0
- package/src/enum/user-status.enum.ts +7 -0
- package/src/models/user.entity.ts +2 -2
- package/tsconfig.build.json +5 -5
- package/tsconfig.json +23 -23
- package/migrations/01-alter-system-privilege-table.js +0 -13
- package/migrations/02-alter-user-group-table.js +0 -78
- package/migrations/03-alter-user-system-privilege-table.js +0 -38
package/jest.config.js
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
2
|
-
module.exports = {
|
3
|
-
clearMocks: true,
|
4
|
-
preset: 'ts-jest',
|
5
|
-
testTimeout: 20000,
|
6
|
-
coverageDirectory: "coverage",
|
7
|
-
testEnvironment: 'node',
|
8
|
-
"modulePathIgnorePatterns": [
|
9
|
-
"<rootDir>/dist"
|
10
|
-
],
|
11
|
-
setupFilesAfterEnv: [
|
12
|
-
'<rootDir>/src/redis-client/__mocks__/jest-initial-setup.ts',
|
13
|
-
]
|
1
|
+
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
2
|
+
module.exports = {
|
3
|
+
clearMocks: true,
|
4
|
+
preset: 'ts-jest',
|
5
|
+
testTimeout: 20000,
|
6
|
+
coverageDirectory: "coverage",
|
7
|
+
testEnvironment: 'node',
|
8
|
+
"modulePathIgnorePatterns": [
|
9
|
+
"<rootDir>/dist"
|
10
|
+
],
|
11
|
+
setupFilesAfterEnv: [
|
12
|
+
'<rootDir>/src/redis-client/__mocks__/jest-initial-setup.ts',
|
13
|
+
]
|
14
14
|
};
|
@@ -1,108 +1,108 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
/** @type {import('sequelize-cli').Migration} */
|
4
|
-
module.exports = {
|
5
|
-
async up(queryInterface, Sequelize) {
|
6
|
-
await queryInterface.createTable('sso_User', {
|
7
|
-
UserId: {
|
8
|
-
primaryKey: true,
|
9
|
-
type: Sequelize.INTEGER,
|
10
|
-
allowNull: false,
|
11
|
-
autoIncrement: true,
|
12
|
-
},
|
13
|
-
Email: {
|
14
|
-
type: Sequelize.STRING,
|
15
|
-
allowNull: false,
|
16
|
-
unique: true,
|
17
|
-
},
|
18
|
-
Password: {
|
19
|
-
type: Sequelize.STRING,
|
20
|
-
allowNull: false,
|
21
|
-
},
|
22
|
-
Status: {
|
23
|
-
type: Sequelize.STRING,
|
24
|
-
allowNull: false,
|
25
|
-
},
|
26
|
-
DefaultPasswordChangedYN: {
|
27
|
-
type: Sequelize.CHAR(1),
|
28
|
-
allowNull: true,
|
29
|
-
},
|
30
|
-
FirstLoginAt: {
|
31
|
-
type: Sequelize.DATE,
|
32
|
-
allowNull: true,
|
33
|
-
},
|
34
|
-
LastLoginAt: {
|
35
|
-
type: Sequelize.DATE,
|
36
|
-
allowNull: true,
|
37
|
-
},
|
38
|
-
MFAEnabled: {
|
39
|
-
type: Sequelize.TINYINT,
|
40
|
-
allowNull: true,
|
41
|
-
},
|
42
|
-
MFAConfig: {
|
43
|
-
type: Sequelize.TEXT,
|
44
|
-
allowNull: true,
|
45
|
-
},
|
46
|
-
RecoveryEmail: {
|
47
|
-
type: Sequelize.STRING,
|
48
|
-
allowNull: true,
|
49
|
-
},
|
50
|
-
FailedLoginAttemptCount: {
|
51
|
-
type: Sequelize.INTEGER,
|
52
|
-
allowNull: false,
|
53
|
-
},
|
54
|
-
LastFailedLoginAt: {
|
55
|
-
type: Sequelize.DATE,
|
56
|
-
allowNull: true,
|
57
|
-
},
|
58
|
-
LastPasswordChangedAt: {
|
59
|
-
type: Sequelize.DATE,
|
60
|
-
allowNull: true,
|
61
|
-
},
|
62
|
-
NeedToChangePasswordYN: {
|
63
|
-
type: Sequelize.CHAR(1),
|
64
|
-
allowNull: true,
|
65
|
-
},
|
66
|
-
CreatedAt: {
|
67
|
-
allowNull: false,
|
68
|
-
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
|
69
|
-
type: Sequelize.DATE,
|
70
|
-
},
|
71
|
-
CreatedById: {
|
72
|
-
type: Sequelize.INTEGER,
|
73
|
-
allowNull: true,
|
74
|
-
references: {
|
75
|
-
model: 'sso_User',
|
76
|
-
key: 'UserId',
|
77
|
-
},
|
78
|
-
onDelete: 'CASCADE',
|
79
|
-
onUpdate: 'CASCADE',
|
80
|
-
},
|
81
|
-
UpdatedAt: {
|
82
|
-
allowNull: false,
|
83
|
-
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)'),
|
84
|
-
type: Sequelize.DATE,
|
85
|
-
},
|
86
|
-
UpdatedById: {
|
87
|
-
type: Sequelize.INTEGER,
|
88
|
-
allowNull: true,
|
89
|
-
references: {
|
90
|
-
model: 'sso_User',
|
91
|
-
key: 'UserId',
|
92
|
-
},
|
93
|
-
onDelete: 'CASCADE',
|
94
|
-
onUpdate: 'CASCADE',
|
95
|
-
},
|
96
|
-
|
97
|
-
});
|
98
|
-
},
|
99
|
-
|
100
|
-
async down(queryInterface, Sequelize) {
|
101
|
-
/**
|
102
|
-
* Add reverting commands here.
|
103
|
-
*
|
104
|
-
* Example:
|
105
|
-
* await queryInterface.dropTable('users');
|
106
|
-
*/
|
107
|
-
}
|
108
|
-
};
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
/** @type {import('sequelize-cli').Migration} */
|
4
|
+
module.exports = {
|
5
|
+
async up(queryInterface, Sequelize) {
|
6
|
+
await queryInterface.createTable('sso_User', {
|
7
|
+
UserId: {
|
8
|
+
primaryKey: true,
|
9
|
+
type: Sequelize.INTEGER,
|
10
|
+
allowNull: false,
|
11
|
+
autoIncrement: true,
|
12
|
+
},
|
13
|
+
Email: {
|
14
|
+
type: Sequelize.STRING,
|
15
|
+
allowNull: false,
|
16
|
+
unique: true,
|
17
|
+
},
|
18
|
+
Password: {
|
19
|
+
type: Sequelize.STRING,
|
20
|
+
allowNull: false,
|
21
|
+
},
|
22
|
+
Status: {
|
23
|
+
type: Sequelize.STRING,
|
24
|
+
allowNull: false,
|
25
|
+
},
|
26
|
+
DefaultPasswordChangedYN: {
|
27
|
+
type: Sequelize.CHAR(1),
|
28
|
+
allowNull: true,
|
29
|
+
},
|
30
|
+
FirstLoginAt: {
|
31
|
+
type: Sequelize.DATE,
|
32
|
+
allowNull: true,
|
33
|
+
},
|
34
|
+
LastLoginAt: {
|
35
|
+
type: Sequelize.DATE,
|
36
|
+
allowNull: true,
|
37
|
+
},
|
38
|
+
MFAEnabled: {
|
39
|
+
type: Sequelize.TINYINT,
|
40
|
+
allowNull: true,
|
41
|
+
},
|
42
|
+
MFAConfig: {
|
43
|
+
type: Sequelize.TEXT,
|
44
|
+
allowNull: true,
|
45
|
+
},
|
46
|
+
RecoveryEmail: {
|
47
|
+
type: Sequelize.STRING,
|
48
|
+
allowNull: true,
|
49
|
+
},
|
50
|
+
FailedLoginAttemptCount: {
|
51
|
+
type: Sequelize.INTEGER,
|
52
|
+
allowNull: false,
|
53
|
+
},
|
54
|
+
LastFailedLoginAt: {
|
55
|
+
type: Sequelize.DATE,
|
56
|
+
allowNull: true,
|
57
|
+
},
|
58
|
+
LastPasswordChangedAt: {
|
59
|
+
type: Sequelize.DATE,
|
60
|
+
allowNull: true,
|
61
|
+
},
|
62
|
+
NeedToChangePasswordYN: {
|
63
|
+
type: Sequelize.CHAR(1),
|
64
|
+
allowNull: true,
|
65
|
+
},
|
66
|
+
CreatedAt: {
|
67
|
+
allowNull: false,
|
68
|
+
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
|
69
|
+
type: Sequelize.DATE,
|
70
|
+
},
|
71
|
+
CreatedById: {
|
72
|
+
type: Sequelize.INTEGER,
|
73
|
+
allowNull: true,
|
74
|
+
references: {
|
75
|
+
model: 'sso_User',
|
76
|
+
key: 'UserId',
|
77
|
+
},
|
78
|
+
onDelete: 'CASCADE',
|
79
|
+
onUpdate: 'CASCADE',
|
80
|
+
},
|
81
|
+
UpdatedAt: {
|
82
|
+
allowNull: false,
|
83
|
+
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)'),
|
84
|
+
type: Sequelize.DATE,
|
85
|
+
},
|
86
|
+
UpdatedById: {
|
87
|
+
type: Sequelize.INTEGER,
|
88
|
+
allowNull: true,
|
89
|
+
references: {
|
90
|
+
model: 'sso_User',
|
91
|
+
key: 'UserId',
|
92
|
+
},
|
93
|
+
onDelete: 'CASCADE',
|
94
|
+
onUpdate: 'CASCADE',
|
95
|
+
},
|
96
|
+
|
97
|
+
});
|
98
|
+
},
|
99
|
+
|
100
|
+
async down(queryInterface, Sequelize) {
|
101
|
+
/**
|
102
|
+
* Add reverting commands here.
|
103
|
+
*
|
104
|
+
* Example:
|
105
|
+
* await queryInterface.dropTable('users');
|
106
|
+
*/
|
107
|
+
}
|
108
|
+
};
|
@@ -1,55 +1,55 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
module.exports = {
|
4
|
-
up: async (queryInterface, Sequelize) => {
|
5
|
-
queryInterface.createTable('sso_UserUserGroup', {
|
6
|
-
UserId: {
|
7
|
-
primaryKey: true,
|
8
|
-
type: Sequelize.INTEGER,
|
9
|
-
allowNull: false,
|
10
|
-
references: {
|
11
|
-
model: 'sso_User',
|
12
|
-
key: 'id',
|
13
|
-
},
|
14
|
-
onDelete: 'CASCADE',
|
15
|
-
onUpdate: 'CASCADE',
|
16
|
-
},
|
17
|
-
GroupCode: {
|
18
|
-
primaryKey: true,
|
19
|
-
type: Sequelize.STRING(191),
|
20
|
-
allowNull: false,
|
21
|
-
references: {
|
22
|
-
model: 'sso_usergroup',
|
23
|
-
key: 'GroupCode',
|
24
|
-
},
|
25
|
-
onDelete: 'CASCADE',
|
26
|
-
onUpdate: 'CASCADE',
|
27
|
-
},
|
28
|
-
SystemId: {
|
29
|
-
type: Sequelize.INTEGER,
|
30
|
-
allowNull: true,
|
31
|
-
references: {
|
32
|
-
model: 'sso_systems',
|
33
|
-
key: 'id',
|
34
|
-
},
|
35
|
-
onDelete: 'CASCADE',
|
36
|
-
onUpdate: 'CASCADE',
|
37
|
-
},
|
38
|
-
CreatedAt: {
|
39
|
-
allowNull: false,
|
40
|
-
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
|
41
|
-
type: Sequelize.DATE,
|
42
|
-
},
|
43
|
-
UpdatedAt: {
|
44
|
-
allowNull: false,
|
45
|
-
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
|
46
|
-
type: Sequelize.DATE,
|
47
|
-
},
|
48
|
-
});
|
49
|
-
|
50
|
-
},
|
51
|
-
|
52
|
-
down: async (queryInterface) => {
|
53
|
-
await queryInterface.dropTable('sso_UserUserGroup');
|
54
|
-
},
|
55
|
-
};
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
module.exports = {
|
4
|
+
up: async (queryInterface, Sequelize) => {
|
5
|
+
queryInterface.createTable('sso_UserUserGroup', {
|
6
|
+
UserId: {
|
7
|
+
primaryKey: true,
|
8
|
+
type: Sequelize.INTEGER,
|
9
|
+
allowNull: false,
|
10
|
+
references: {
|
11
|
+
model: 'sso_User',
|
12
|
+
key: 'id',
|
13
|
+
},
|
14
|
+
onDelete: 'CASCADE',
|
15
|
+
onUpdate: 'CASCADE',
|
16
|
+
},
|
17
|
+
GroupCode: {
|
18
|
+
primaryKey: true,
|
19
|
+
type: Sequelize.STRING(191),
|
20
|
+
allowNull: false,
|
21
|
+
references: {
|
22
|
+
model: 'sso_usergroup',
|
23
|
+
key: 'GroupCode',
|
24
|
+
},
|
25
|
+
onDelete: 'CASCADE',
|
26
|
+
onUpdate: 'CASCADE',
|
27
|
+
},
|
28
|
+
SystemId: {
|
29
|
+
type: Sequelize.INTEGER,
|
30
|
+
allowNull: true,
|
31
|
+
references: {
|
32
|
+
model: 'sso_systems',
|
33
|
+
key: 'id',
|
34
|
+
},
|
35
|
+
onDelete: 'CASCADE',
|
36
|
+
onUpdate: 'CASCADE',
|
37
|
+
},
|
38
|
+
CreatedAt: {
|
39
|
+
allowNull: false,
|
40
|
+
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
|
41
|
+
type: Sequelize.DATE,
|
42
|
+
},
|
43
|
+
UpdatedAt: {
|
44
|
+
allowNull: false,
|
45
|
+
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
|
46
|
+
type: Sequelize.DATE,
|
47
|
+
},
|
48
|
+
});
|
49
|
+
|
50
|
+
},
|
51
|
+
|
52
|
+
down: async (queryInterface) => {
|
53
|
+
await queryInterface.dropTable('sso_UserUserGroup');
|
54
|
+
},
|
55
|
+
};
|
@@ -1,49 +1,49 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
|
4
|
-
module.exports = {
|
5
|
-
up: async (queryInterface, Sequelize) => {
|
6
|
-
queryInterface.createTable('sso_LoginHistories', {
|
7
|
-
Id: {
|
8
|
-
primaryKey: true,
|
9
|
-
autoIncrement: true,
|
10
|
-
type: Sequelize.INTEGER,
|
11
|
-
allowNull: false,
|
12
|
-
},
|
13
|
-
UserId: {
|
14
|
-
type: Sequelize.INTEGER,
|
15
|
-
allowNull: false,
|
16
|
-
references: {
|
17
|
-
model: 'sso_User',
|
18
|
-
key: 'id',
|
19
|
-
},
|
20
|
-
onDelete: 'CASCADE',
|
21
|
-
onUpdate: 'CASCADE',
|
22
|
-
},
|
23
|
-
SystemId: {
|
24
|
-
type: Sequelize.INTEGER,
|
25
|
-
allowNull: false,
|
26
|
-
references: {
|
27
|
-
model: 'sso_systems',
|
28
|
-
key: 'id',
|
29
|
-
},
|
30
|
-
onDelete: 'CASCADE',
|
31
|
-
onUpdate: 'CASCADE',
|
32
|
-
},
|
33
|
-
OriginIP: {
|
34
|
-
type: Sequelize.STRING(191),
|
35
|
-
allowNull: false,
|
36
|
-
},
|
37
|
-
CreatedAt: {
|
38
|
-
type: Sequelize.DATE(3),
|
39
|
-
allowNull: false,
|
40
|
-
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
|
41
|
-
},
|
42
|
-
});
|
43
|
-
|
44
|
-
},
|
45
|
-
|
46
|
-
down: async (queryInterface) => {
|
47
|
-
await queryInterface.dropTable('sso_LoginHistories');
|
48
|
-
},
|
49
|
-
};
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
|
4
|
+
module.exports = {
|
5
|
+
up: async (queryInterface, Sequelize) => {
|
6
|
+
queryInterface.createTable('sso_LoginHistories', {
|
7
|
+
Id: {
|
8
|
+
primaryKey: true,
|
9
|
+
autoIncrement: true,
|
10
|
+
type: Sequelize.INTEGER,
|
11
|
+
allowNull: false,
|
12
|
+
},
|
13
|
+
UserId: {
|
14
|
+
type: Sequelize.INTEGER,
|
15
|
+
allowNull: false,
|
16
|
+
references: {
|
17
|
+
model: 'sso_User',
|
18
|
+
key: 'id',
|
19
|
+
},
|
20
|
+
onDelete: 'CASCADE',
|
21
|
+
onUpdate: 'CASCADE',
|
22
|
+
},
|
23
|
+
SystemId: {
|
24
|
+
type: Sequelize.INTEGER,
|
25
|
+
allowNull: false,
|
26
|
+
references: {
|
27
|
+
model: 'sso_systems',
|
28
|
+
key: 'id',
|
29
|
+
},
|
30
|
+
onDelete: 'CASCADE',
|
31
|
+
onUpdate: 'CASCADE',
|
32
|
+
},
|
33
|
+
OriginIP: {
|
34
|
+
type: Sequelize.STRING(191),
|
35
|
+
allowNull: false,
|
36
|
+
},
|
37
|
+
CreatedAt: {
|
38
|
+
type: Sequelize.DATE(3),
|
39
|
+
allowNull: false,
|
40
|
+
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
|
41
|
+
},
|
42
|
+
});
|
43
|
+
|
44
|
+
},
|
45
|
+
|
46
|
+
down: async (queryInterface) => {
|
47
|
+
await queryInterface.dropTable('sso_LoginHistories');
|
48
|
+
},
|
49
|
+
};
|
package/package.json
CHANGED
@@ -1,80 +1,80 @@
|
|
1
|
-
{
|
2
|
-
"name": "@tomei/sso",
|
3
|
-
"version": "0.16.
|
4
|
-
"description": "Tomei SSO Package",
|
5
|
-
"main": "dist/index.js",
|
6
|
-
"scripts": {
|
7
|
-
"start:dev": "tsc -w",
|
8
|
-
"build": "tsc",
|
9
|
-
"prepare": "husky install",
|
10
|
-
"format": "prettier --write \"src/**/*.ts\"",
|
11
|
-
"lint": "npx eslint . --fix",
|
12
|
-
"test": "jest --forceExit --detectOpenHandles"
|
13
|
-
},
|
14
|
-
"repository": {
|
15
|
-
"type": "git",
|
16
|
-
"url": "git+ssh://git@gitlab.com/tomei-package/sso.git"
|
17
|
-
},
|
18
|
-
"keywords": [
|
19
|
-
"tomei",
|
20
|
-
"sso"
|
21
|
-
],
|
22
|
-
"author": "Tomei",
|
23
|
-
"license": "ISC",
|
24
|
-
"bugs": {
|
25
|
-
"url": "https://gitlab.com/tomei-package/sso/issues"
|
26
|
-
},
|
27
|
-
"homepage": "https://gitlab.com/tomei-package/sso#readme",
|
28
|
-
"devDependencies": {
|
29
|
-
"@commitlint/cli": "^17.6.3",
|
30
|
-
"@commitlint/config-conventional": "^17.6.3",
|
31
|
-
"@tsconfig/node18": "^2.0.1",
|
32
|
-
"@types/bcrypt": "^5.0.0",
|
33
|
-
"@types/jest": "^29.5.2",
|
34
|
-
"@types/node": "^18.17.5",
|
35
|
-
"@types/redis": "^4.0.11",
|
36
|
-
"@types/validator": "^13.11.1",
|
37
|
-
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
38
|
-
"dotenv": "^16.1.4",
|
39
|
-
"eslint": "^8.40.0",
|
40
|
-
"eslint-config-prettier": "^8.5.0",
|
41
|
-
"eslint-plugin-prettier": "^4.2.1",
|
42
|
-
"husky": "^8.0.3",
|
43
|
-
"jest": "^29.5.0",
|
44
|
-
"jest-mock-extended": "^3.0.4",
|
45
|
-
"lint-staged": "^13.2.2",
|
46
|
-
"prettier": "^2.7.1",
|
47
|
-
"prisma": "^4.14.0",
|
48
|
-
"redis-mock": "^0.56.3",
|
49
|
-
"sequelize-cli": "^6.6.2",
|
50
|
-
"ts-jest": "^29.1.0",
|
51
|
-
"ts-node": "^10.9.1",
|
52
|
-
"tsc-watch": "^5.0.3",
|
53
|
-
"tsconfig-paths": "^4.0.0",
|
54
|
-
"tslint": "^6.1.3",
|
55
|
-
"typescript": "^4.7.4"
|
56
|
-
},
|
57
|
-
"publishConfig": {
|
58
|
-
"access": "public"
|
59
|
-
},
|
60
|
-
"peerDependencies": {
|
61
|
-
"@tomei/config": "^0.3.9",
|
62
|
-
"@tomei/general": "^0.10.6",
|
63
|
-
"@tomei/mailer": "^0.5.11",
|
64
|
-
"@types/jest": "^29.5.2",
|
65
|
-
"argon2": "^0.30.3",
|
66
|
-
"cls-hooked": "^4.2.2",
|
67
|
-
"cuid": "^3.0.0",
|
68
|
-
"nodemailer": "^6.9.3",
|
69
|
-
"redis": "^4.6.7",
|
70
|
-
"reflect-metadata": "^0.1.13",
|
71
|
-
"sequelize": "^6.32.1",
|
72
|
-
"sequelize-typescript": "^2.1.5"
|
73
|
-
},
|
74
|
-
"lint-staged": {
|
75
|
-
"*/**/*.{js,ts,tsx}": [
|
76
|
-
"prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
77
|
-
"eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
|
78
|
-
]
|
79
|
-
}
|
80
|
-
}
|
1
|
+
{
|
2
|
+
"name": "@tomei/sso",
|
3
|
+
"version": "0.16.3",
|
4
|
+
"description": "Tomei SSO Package",
|
5
|
+
"main": "dist/index.js",
|
6
|
+
"scripts": {
|
7
|
+
"start:dev": "tsc -w",
|
8
|
+
"build": "tsc",
|
9
|
+
"prepare": "husky install",
|
10
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
11
|
+
"lint": "npx eslint . --fix",
|
12
|
+
"test": "jest --forceExit --detectOpenHandles"
|
13
|
+
},
|
14
|
+
"repository": {
|
15
|
+
"type": "git",
|
16
|
+
"url": "git+ssh://git@gitlab.com/tomei-package/sso.git"
|
17
|
+
},
|
18
|
+
"keywords": [
|
19
|
+
"tomei",
|
20
|
+
"sso"
|
21
|
+
],
|
22
|
+
"author": "Tomei",
|
23
|
+
"license": "ISC",
|
24
|
+
"bugs": {
|
25
|
+
"url": "https://gitlab.com/tomei-package/sso/issues"
|
26
|
+
},
|
27
|
+
"homepage": "https://gitlab.com/tomei-package/sso#readme",
|
28
|
+
"devDependencies": {
|
29
|
+
"@commitlint/cli": "^17.6.3",
|
30
|
+
"@commitlint/config-conventional": "^17.6.3",
|
31
|
+
"@tsconfig/node18": "^2.0.1",
|
32
|
+
"@types/bcrypt": "^5.0.0",
|
33
|
+
"@types/jest": "^29.5.2",
|
34
|
+
"@types/node": "^18.17.5",
|
35
|
+
"@types/redis": "^4.0.11",
|
36
|
+
"@types/validator": "^13.11.1",
|
37
|
+
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
38
|
+
"dotenv": "^16.1.4",
|
39
|
+
"eslint": "^8.40.0",
|
40
|
+
"eslint-config-prettier": "^8.5.0",
|
41
|
+
"eslint-plugin-prettier": "^4.2.1",
|
42
|
+
"husky": "^8.0.3",
|
43
|
+
"jest": "^29.5.0",
|
44
|
+
"jest-mock-extended": "^3.0.4",
|
45
|
+
"lint-staged": "^13.2.2",
|
46
|
+
"prettier": "^2.7.1",
|
47
|
+
"prisma": "^4.14.0",
|
48
|
+
"redis-mock": "^0.56.3",
|
49
|
+
"sequelize-cli": "^6.6.2",
|
50
|
+
"ts-jest": "^29.1.0",
|
51
|
+
"ts-node": "^10.9.1",
|
52
|
+
"tsc-watch": "^5.0.3",
|
53
|
+
"tsconfig-paths": "^4.0.0",
|
54
|
+
"tslint": "^6.1.3",
|
55
|
+
"typescript": "^4.7.4"
|
56
|
+
},
|
57
|
+
"publishConfig": {
|
58
|
+
"access": "public"
|
59
|
+
},
|
60
|
+
"peerDependencies": {
|
61
|
+
"@tomei/config": "^0.3.9",
|
62
|
+
"@tomei/general": "^0.10.6",
|
63
|
+
"@tomei/mailer": "^0.5.11",
|
64
|
+
"@types/jest": "^29.5.2",
|
65
|
+
"argon2": "^0.30.3",
|
66
|
+
"cls-hooked": "^4.2.2",
|
67
|
+
"cuid": "^3.0.0",
|
68
|
+
"nodemailer": "^6.9.3",
|
69
|
+
"redis": "^4.6.7",
|
70
|
+
"reflect-metadata": "^0.1.13",
|
71
|
+
"sequelize": "^6.32.1",
|
72
|
+
"sequelize-typescript": "^2.1.5"
|
73
|
+
},
|
74
|
+
"lint-staged": {
|
75
|
+
"*/**/*.{js,ts,tsx}": [
|
76
|
+
"prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
77
|
+
"eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
|
78
|
+
]
|
79
|
+
}
|
80
|
+
}
|
package/sampledotenv
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
DATABASE_URL=
|
2
|
-
SHADOW_DATABASE_URL=
|
3
|
-
REDIS_URL=
|
4
|
-
REDIS_PASSWORD=
|
5
|
-
SMTP_HOST=
|
6
|
-
SMTP_PORT=
|
7
|
-
EMAIL_SENDER=
|
1
|
+
DATABASE_URL=
|
2
|
+
SHADOW_DATABASE_URL=
|
3
|
+
REDIS_URL=
|
4
|
+
REDIS_PASSWORD=
|
5
|
+
SMTP_HOST=
|
6
|
+
SMTP_PORT=
|
7
|
+
EMAIL_SENDER=
|
8
8
|
EMAIL_PASSWORD=
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { UserStatus } from '../../../enum/user-status.enum';
|
1
2
|
import { YN } from '../../../enum/yn.enum';
|
2
3
|
|
3
4
|
export interface IUserInfo {
|
@@ -11,7 +12,7 @@ export interface IUserInfo {
|
|
11
12
|
}
|
12
13
|
|
13
14
|
export interface IUserAttr extends IUserInfo {
|
14
|
-
Status:
|
15
|
+
Status: UserStatus;
|
15
16
|
DefaultPasswordChangedYN: YN;
|
16
17
|
FirstLoginAt: Date;
|
17
18
|
LastLoginAt: Date;
|
@@ -17,12 +17,13 @@ import GroupSystemPrivilege from '../../models/group-system-privilege.entity';
|
|
17
17
|
import GroupRolePrivilege from '../../models/group-role-privilege.entity';
|
18
18
|
import UserGroup from '../../models/user-group.entity';
|
19
19
|
import { YN } from '../../enum/yn.enum';
|
20
|
+
import { UserStatus } from '../../enum';
|
20
21
|
|
21
22
|
export class LoginUser extends LoginUserBase {
|
22
23
|
ObjectId: string;
|
23
24
|
Email: string;
|
24
25
|
private _Password: string;
|
25
|
-
private _Status:
|
26
|
+
private _Status: UserStatus;
|
26
27
|
private _DefaultPasswordChangedYN: YN;
|
27
28
|
private _FirstLoginAt: Date;
|
28
29
|
private _LastLoginAt: Date;
|
@@ -69,11 +70,11 @@ export class LoginUser extends LoginUserBase {
|
|
69
70
|
this._Password = value;
|
70
71
|
}
|
71
72
|
|
72
|
-
get Status():
|
73
|
+
get Status(): UserStatus {
|
73
74
|
return this._Status;
|
74
75
|
}
|
75
76
|
|
76
|
-
private set Status(value:
|
77
|
+
private set Status(value: UserStatus) {
|
77
78
|
this._Status = value;
|
78
79
|
}
|
79
80
|
|