@tomei/sso 0.66.1-test.3 → 0.66.1-test.4
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.spec.ts +271 -2
- package/__tests__/unit/components/login-user/password-expiry.spec.ts +87 -0
- package/dist/__tests__/unit/components/login-user/login.spec.js +199 -2
- package/dist/__tests__/unit/components/login-user/login.spec.js.map +1 -1
- package/dist/__tests__/unit/components/login-user/password-expiry.spec.d.ts +1 -0
- package/dist/__tests__/unit/components/login-user/password-expiry.spec.js +86 -0
- package/dist/__tests__/unit/components/login-user/password-expiry.spec.js.map +1 -0
- package/dist/src/components/login-user/interfaces/user-info.interface.d.ts +1 -0
- package/dist/src/components/login-user/user.d.ts +1 -0
- package/dist/src/components/login-user/user.js +7 -1
- package/dist/src/components/login-user/user.js.map +1 -1
- package/dist/src/components/system/system.d.ts +1 -0
- package/dist/src/components/system/system.js +1 -0
- package/dist/src/components/system/system.js.map +1 -1
- package/dist/src/components/system-privilege/system-privilege.d.ts +1 -0
- package/dist/src/components/system-privilege/system-privilege.js +2 -0
- package/dist/src/components/system-privilege/system-privilege.js.map +1 -1
- package/dist/src/interfaces/system-privilege.interface.d.ts +1 -0
- package/dist/src/interfaces/system.interface.d.ts +1 -0
- package/dist/src/models/group.entity.d.ts +1 -0
- package/dist/src/models/group.entity.js +8 -1
- package/dist/src/models/group.entity.js.map +1 -1
- package/dist/src/models/system-privilege.entity.d.ts +1 -0
- package/dist/src/models/system-privilege.entity.js +7 -0
- package/dist/src/models/system-privilege.entity.js.map +1 -1
- package/dist/src/models/system.entity.d.ts +1 -0
- package/dist/src/models/system.entity.js +7 -0
- package/dist/src/models/system.entity.js.map +1 -1
- package/dist/src/models/user.entity.d.ts +1 -0
- package/dist/src/models/user.entity.js +7 -0
- package/dist/src/models/user.entity.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/login-user/interfaces/user-info.interface.ts +1 -0
- package/src/components/login-user/user.ts +14 -2
- package/src/components/system/system.ts +2 -0
- package/src/components/system-privilege/system-privilege.ts +3 -0
- package/src/interfaces/system-privilege.interface.ts +1 -0
- package/src/interfaces/system.interface.ts +1 -0
- package/src/models/group.entity.ts +7 -1
- package/src/models/system-privilege.entity.ts +6 -0
- package/src/models/system.entity.ts +6 -0
- package/src/models/user.entity.ts +6 -0
package/package.json
CHANGED
|
@@ -40,6 +40,7 @@ import { UserPasswordHistory } from '../user-password-history/user-password-hist
|
|
|
40
40
|
|
|
41
41
|
export class User extends UserBase {
|
|
42
42
|
ObjectId: string;
|
|
43
|
+
V1Id: number;
|
|
43
44
|
Email: string;
|
|
44
45
|
private _UserName: string;
|
|
45
46
|
private _Password: string;
|
|
@@ -291,6 +292,7 @@ export class User extends UserBase {
|
|
|
291
292
|
// set all the class properties
|
|
292
293
|
if (userInfo) {
|
|
293
294
|
this.UserId = userInfo.UserId;
|
|
295
|
+
this.V1Id = userInfo.V1Id;
|
|
294
296
|
this.UserName = userInfo.UserName;
|
|
295
297
|
this.FullName = userInfo.FullName;
|
|
296
298
|
this.IDNo = userInfo.IDNo;
|
|
@@ -3071,6 +3073,11 @@ export class User extends UserBase {
|
|
|
3071
3073
|
return { expired: false, expiringSoon: false, expiresInDays: null };
|
|
3072
3074
|
}
|
|
3073
3075
|
|
|
3076
|
+
// Accounts authenticated without a local password cannot rotate one here.
|
|
3077
|
+
if (!this.Password) {
|
|
3078
|
+
return { expired: false, expiringSoon: false, expiresInDays: null };
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3074
3081
|
// Forces first-login change for temp-password/admin-created accounts (AC#4), regardless of password age.
|
|
3075
3082
|
if (this.NeedToChangePasswordYN === YN.Yes) {
|
|
3076
3083
|
return { expired: true, expiringSoon: false, expiresInDays: null };
|
|
@@ -3092,14 +3099,19 @@ export class User extends UserBase {
|
|
|
3092
3099
|
}
|
|
3093
3100
|
|
|
3094
3101
|
const createdAt = latestHistory.CreatedAt;
|
|
3102
|
+
const expiryMonth = createdAt.getUTCMonth() + expiryMonths;
|
|
3103
|
+
const lastDayOfExpiryMonth = new Date(
|
|
3104
|
+
Date.UTC(createdAt.getUTCFullYear(), expiryMonth + 1, 0),
|
|
3105
|
+
).getUTCDate();
|
|
3095
3106
|
const expiryDate = new Date(
|
|
3096
3107
|
Date.UTC(
|
|
3097
3108
|
createdAt.getUTCFullYear(),
|
|
3098
|
-
|
|
3099
|
-
createdAt.getUTCDate(),
|
|
3109
|
+
expiryMonth,
|
|
3110
|
+
Math.min(createdAt.getUTCDate(), lastDayOfExpiryMonth),
|
|
3100
3111
|
createdAt.getUTCHours(),
|
|
3101
3112
|
createdAt.getUTCMinutes(),
|
|
3102
3113
|
createdAt.getUTCSeconds(),
|
|
3114
|
+
createdAt.getUTCMilliseconds(),
|
|
3103
3115
|
),
|
|
3104
3116
|
);
|
|
3105
3117
|
|
|
@@ -10,6 +10,7 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
10
10
|
|
|
11
11
|
export class System extends ObjectBase {
|
|
12
12
|
ObjectId: string;
|
|
13
|
+
V1Id: number;
|
|
13
14
|
ObjectName: string;
|
|
14
15
|
TableName = 'sso_System';
|
|
15
16
|
ObjectType = 'System';
|
|
@@ -49,6 +50,7 @@ export class System extends ObjectBase {
|
|
|
49
50
|
private constructor(systemAttr?: ISystemAttr) {
|
|
50
51
|
super();
|
|
51
52
|
if (systemAttr) {
|
|
53
|
+
this.V1Id = systemAttr.V1Id;
|
|
52
54
|
this.SystemCode = systemAttr.SystemCode;
|
|
53
55
|
this.Name = systemAttr.Name;
|
|
54
56
|
this.Description = systemAttr?.Description;
|
|
@@ -13,6 +13,7 @@ export class SystemPrivilege extends ObjectBase {
|
|
|
13
13
|
ObjectType = 'SystemPrivilege';
|
|
14
14
|
TableName = 'sso_SystemPrivilege';
|
|
15
15
|
ObjectId: string;
|
|
16
|
+
V1Id: string;
|
|
16
17
|
PrivilegeCode: string;
|
|
17
18
|
SystemCode: string;
|
|
18
19
|
ObjectName: string;
|
|
@@ -53,6 +54,7 @@ export class SystemPrivilege extends ObjectBase {
|
|
|
53
54
|
private constructor(systemPrivilegeAttr?: ISystemPrivilegeAttr) {
|
|
54
55
|
super();
|
|
55
56
|
if (systemPrivilegeAttr) {
|
|
57
|
+
this.V1Id = systemPrivilegeAttr.V1Id;
|
|
56
58
|
this.SystemPrivilegeId = systemPrivilegeAttr.SystemPrivilegeId;
|
|
57
59
|
this.PrivilegeCode = systemPrivilegeAttr.PrivilegeCode;
|
|
58
60
|
this.SystemCode = systemPrivilegeAttr.SystemCode;
|
|
@@ -66,6 +68,7 @@ export class SystemPrivilege extends ObjectBase {
|
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
setAttributes(systemPrivilegeAttr: ISystemPrivilegeAttr) {
|
|
71
|
+
this.V1Id = systemPrivilegeAttr.V1Id;
|
|
69
72
|
this.PrivilegeCode = systemPrivilegeAttr.PrivilegeCode;
|
|
70
73
|
this.SystemPrivilegeId = systemPrivilegeAttr.SystemPrivilegeId;
|
|
71
74
|
this.SystemCode = systemPrivilegeAttr.SystemCode;
|
|
@@ -24,6 +24,12 @@ import GroupReportingUserModel from './group-reporting-user.entity';
|
|
|
24
24
|
updatedAt: 'UpdatedAt',
|
|
25
25
|
})
|
|
26
26
|
export default class GroupModel extends Model {
|
|
27
|
+
@Column({
|
|
28
|
+
allowNull: true,
|
|
29
|
+
type: DataType.INTEGER,
|
|
30
|
+
})
|
|
31
|
+
V1Id: number;
|
|
32
|
+
|
|
27
33
|
@Column({
|
|
28
34
|
primaryKey: true,
|
|
29
35
|
allowNull: false,
|
|
@@ -74,7 +80,7 @@ export default class GroupModel extends Model {
|
|
|
74
80
|
|
|
75
81
|
@Column({
|
|
76
82
|
allowNull: false,
|
|
77
|
-
type: DataType.STRING(
|
|
83
|
+
type: DataType.STRING(100),
|
|
78
84
|
})
|
|
79
85
|
Path: string;
|
|
80
86
|
|