@tomei/sso 0.15.6 → 0.15.8
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/__tests__/unit/components/login-user/login-user.spec.ts +16 -16
- package/dist/__tests__/unit/components/login-user/login-user.spec.js +15 -15
- package/dist/__tests__/unit/components/login-user/login-user.spec.js.map +1 -1
- package/dist/src/components/login-user/interfaces/user-info.interface.d.ts +1 -19
- package/dist/src/components/login-user/login-user.d.ts +9 -54
- package/dist/src/components/login-user/login-user.js +29 -177
- package/dist/src/components/login-user/login-user.js.map +1 -1
- package/dist/src/models/user.entity.d.ts +6 -16
- package/dist/src/models/user.entity.js +25 -85
- package/dist/src/models/user.entity.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/migrations/{20240314080604-create-user-user-group-table.js → 04-create-user-user-group-table.js} +1 -1
- package/migrations/{20240314080605-create-login-history-table.js → 05-create-login-history-table.js} +1 -1
- package/package.json +1 -2
- package/src/components/login-user/interfaces/user-info.interface.ts +9 -29
- package/src/components/login-user/login-user.ts +557 -749
- package/src/models/user.entity.ts +110 -160
- package/tsconfig.build.json +4 -4
- package/dist/src/enum/index.d.ts +0 -1
- package/dist/src/enum/index.js +0 -18
- package/dist/src/enum/index.js.map +0 -1
- package/dist/src/enum/yn.enum.d.ts +0 -4
- package/dist/src/enum/yn.enum.js +0 -9
- package/dist/src/enum/yn.enum.js.map +0 -1
- package/migrations/20240314080603-create-user-table.js +0 -108
- package/src/enum/index.ts +0 -1
- package/src/enum/yn.enum.ts +0 -4
@@ -1,160 +1,110 @@
|
|
1
|
-
import {
|
2
|
-
BelongsTo,
|
3
|
-
BelongsToMany,
|
4
|
-
Column,
|
5
|
-
CreatedAt,
|
6
|
-
DataType,
|
7
|
-
ForeignKey,
|
8
|
-
HasMany,
|
9
|
-
HasOne,
|
10
|
-
Model,
|
11
|
-
Table,
|
12
|
-
UpdatedAt,
|
13
|
-
} from 'sequelize-typescript';
|
14
|
-
import UserGroup from './user-group.entity';
|
15
|
-
import Staff from './staff.entity';
|
16
|
-
import BearerToken from './bearer-token.entity';
|
17
|
-
import OAuthToken from './oauth-token.entity';
|
18
|
-
import UserRole from './user-role.entity';
|
19
|
-
import System from './system.entity';
|
20
|
-
import SystemAccess from './system-accesss.entity';
|
21
|
-
import Role from './role.entity';
|
22
|
-
import SystemRole from './system-role.entity';
|
23
|
-
import UserSystemRole from './user-system-role.entity';
|
24
|
-
import SystemPrivilege from './system-privilege.entity';
|
25
|
-
import UserSystemPrivileges from './user-system-privileges.entity';
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
@Column({
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
@
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
@
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
NeedToChangePasswordYN: YN;
|
112
|
-
|
113
|
-
@ForeignKey(() => User)
|
114
|
-
@Column({
|
115
|
-
type: DataType.INTEGER,
|
116
|
-
})
|
117
|
-
CreatedById: number;
|
118
|
-
|
119
|
-
@CreatedAt
|
120
|
-
CreatedAt: Date;
|
121
|
-
|
122
|
-
@ForeignKey(() => User)
|
123
|
-
@Column({
|
124
|
-
type: DataType.INTEGER,
|
125
|
-
})
|
126
|
-
UpdatedById: number;
|
127
|
-
|
128
|
-
@UpdatedAt
|
129
|
-
UpdatedAt: Date;
|
130
|
-
|
131
|
-
@HasOne(() => Staff)
|
132
|
-
Staff: Staff;
|
133
|
-
|
134
|
-
@HasMany(() => BearerToken)
|
135
|
-
BearerTokens: BearerToken[];
|
136
|
-
|
137
|
-
@HasMany(() => OAuthToken)
|
138
|
-
OAuthTokens: OAuthToken[];
|
139
|
-
|
140
|
-
@HasMany(() => UserRole)
|
141
|
-
UserRoles: UserRole[];
|
142
|
-
|
143
|
-
@BelongsToMany(() => System, () => SystemAccess)
|
144
|
-
Systems: System[];
|
145
|
-
|
146
|
-
@BelongsToMany(() => Role, () => UserRole)
|
147
|
-
Roles: Role[];
|
148
|
-
|
149
|
-
@BelongsToMany(() => SystemRole, () => UserSystemRole)
|
150
|
-
SystemRoles: SystemRole[];
|
151
|
-
|
152
|
-
@BelongsToMany(() => SystemPrivilege, () => UserSystemPrivileges)
|
153
|
-
SystemPrivileges: SystemPrivilege[];
|
154
|
-
|
155
|
-
@BelongsTo(() => User, 'CreatedById')
|
156
|
-
CreatedBy: User;
|
157
|
-
|
158
|
-
@BelongsTo(() => User, 'UpdatedById')
|
159
|
-
UpdatedBy: User;
|
160
|
-
}
|
1
|
+
import {
|
2
|
+
BelongsTo,
|
3
|
+
BelongsToMany,
|
4
|
+
Column,
|
5
|
+
CreatedAt,
|
6
|
+
DataType,
|
7
|
+
ForeignKey,
|
8
|
+
HasMany,
|
9
|
+
HasOne,
|
10
|
+
Model,
|
11
|
+
Table,
|
12
|
+
UpdatedAt,
|
13
|
+
} from 'sequelize-typescript';
|
14
|
+
import UserGroup from './user-group.entity';
|
15
|
+
import Staff from './staff.entity';
|
16
|
+
import BearerToken from './bearer-token.entity';
|
17
|
+
import OAuthToken from './oauth-token.entity';
|
18
|
+
import UserRole from './user-role.entity';
|
19
|
+
import System from './system.entity';
|
20
|
+
import SystemAccess from './system-accesss.entity';
|
21
|
+
import Role from './role.entity';
|
22
|
+
import SystemRole from './system-role.entity';
|
23
|
+
import UserSystemRole from './user-system-role.entity';
|
24
|
+
import SystemPrivilege from './system-privilege.entity';
|
25
|
+
import UserSystemPrivileges from './user-system-privileges.entity';
|
26
|
+
|
27
|
+
@Table({
|
28
|
+
tableName: 'sso_users',
|
29
|
+
timestamps: true,
|
30
|
+
createdAt: 'created_at',
|
31
|
+
updatedAt: 'updated_at',
|
32
|
+
})
|
33
|
+
export default class User extends Model {
|
34
|
+
@Column({
|
35
|
+
primaryKey: true,
|
36
|
+
type: DataType.INTEGER,
|
37
|
+
})
|
38
|
+
id: number;
|
39
|
+
|
40
|
+
@Column({
|
41
|
+
type: DataType.STRING,
|
42
|
+
field: 'email',
|
43
|
+
})
|
44
|
+
Email: string;
|
45
|
+
|
46
|
+
@Column({
|
47
|
+
type: DataType.STRING,
|
48
|
+
field: 'password',
|
49
|
+
})
|
50
|
+
Password: string;
|
51
|
+
|
52
|
+
@Column({
|
53
|
+
type: DataType.STRING,
|
54
|
+
field: 'status',
|
55
|
+
})
|
56
|
+
Status: string;
|
57
|
+
|
58
|
+
@Column({
|
59
|
+
type: DataType.BOOLEAN,
|
60
|
+
field: 'default_password_changed',
|
61
|
+
})
|
62
|
+
DefaultPasswordChanged: boolean;
|
63
|
+
|
64
|
+
@Column({
|
65
|
+
type: DataType.DATE,
|
66
|
+
field: 'first_login_at',
|
67
|
+
})
|
68
|
+
FirstLoginAt: boolean;
|
69
|
+
|
70
|
+
@ForeignKey(() => UserGroup)
|
71
|
+
@Column({
|
72
|
+
allowNull: true,
|
73
|
+
type: DataType.STRING(10),
|
74
|
+
field: 'GroupCode',
|
75
|
+
})
|
76
|
+
GroupCode: boolean;
|
77
|
+
|
78
|
+
@CreatedAt
|
79
|
+
CreatedAt: Date;
|
80
|
+
|
81
|
+
@UpdatedAt
|
82
|
+
UpdatedAt: Date;
|
83
|
+
|
84
|
+
@HasOne(() => Staff)
|
85
|
+
Staff: Staff;
|
86
|
+
|
87
|
+
@HasMany(() => BearerToken)
|
88
|
+
BearerTokens: BearerToken[];
|
89
|
+
|
90
|
+
@HasMany(() => OAuthToken)
|
91
|
+
OAuthTokens: OAuthToken[];
|
92
|
+
|
93
|
+
@HasMany(() => UserRole)
|
94
|
+
UserRoles: UserRole[];
|
95
|
+
|
96
|
+
@BelongsToMany(() => System, () => SystemAccess)
|
97
|
+
Systems: System[];
|
98
|
+
|
99
|
+
@BelongsToMany(() => Role, () => UserRole)
|
100
|
+
Roles: Role[];
|
101
|
+
|
102
|
+
@BelongsToMany(() => SystemRole, () => UserSystemRole)
|
103
|
+
SystemRoles: SystemRole[];
|
104
|
+
|
105
|
+
@BelongsToMany(() => SystemPrivilege, () => UserSystemPrivileges)
|
106
|
+
SystemPrivileges: SystemPrivilege[];
|
107
|
+
|
108
|
+
@BelongsTo(() => UserGroup)
|
109
|
+
UserGroup: UserGroup;
|
110
|
+
}
|
package/tsconfig.build.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
"extends": "./tsconfig.json",
|
3
|
+
"include": ["**/*.ts"],
|
4
|
+
"exclude": ["node_modules", "__tests__", "dist", "**/*spec.ts"]
|
5
|
+
}
|
6
6
|
|
package/dist/src/enum/index.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './yn.enum';
|
package/dist/src/enum/index.js
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
-
};
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./yn.enum"), exports);
|
18
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/enum/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B"}
|
package/dist/src/enum/yn.enum.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"yn.enum.js","sourceRoot":"","sources":["../../../src/enum/yn.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,EAGX;AAHD,WAAY,EAAE;IACZ,eAAS,CAAA;IACT,cAAQ,CAAA;AACV,CAAC,EAHW,EAAE,GAAF,UAAE,KAAF,UAAE,QAGb"}
|
@@ -1,108 +0,0 @@
|
|
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
|
-
};
|
package/src/enum/index.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './yn.enum';
|
package/src/enum/yn.enum.ts
DELETED