@flusys/nestjs-auth 7.0.2 → 8.0.0-beta.1
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/README.md +68 -1
- package/config/auth.constants.d.ts +2 -0
- package/config/event-actions.d.ts +2 -0
- package/config/index.d.ts +3 -3
- package/config/message-keys.d.ts +23 -0
- package/controllers/authentication.controller.d.ts +5 -5
- package/controllers/branch.controller.d.ts +2 -2
- package/controllers/company-selection.controller.d.ts +4 -4
- package/controllers/company.controller.d.ts +2 -2
- package/controllers/email-verification.controller.d.ts +6 -6
- package/controllers/index.d.ts +9 -7
- package/controllers/social-auth-config.controller.d.ts +22 -0
- package/controllers/social-auth.controller.d.ts +11 -0
- package/controllers/user-permission.controller.d.ts +5 -4
- package/controllers/user.controller.d.ts +7 -7
- package/docs/auth-swagger.config.d.ts +2 -2
- package/docs/index.d.ts +1 -1
- package/dtos/index.d.ts +6 -5
- package/dtos/social-auth.dto.d.ts +42 -0
- package/entities/company-branch.entity.d.ts +1 -1
- package/entities/company.entity.d.ts +1 -1
- package/entities/index.d.ts +15 -13
- package/entities/pending-registration.entity.d.ts +1 -1
- package/entities/social-auth-config.entity.d.ts +9 -0
- package/entities/user-company-permission.entity.d.ts +4 -4
- package/enums/index.d.ts +2 -1
- package/enums/social-provider-type.enum.d.ts +6 -0
- package/fesm/118.js +1230 -0
- package/fesm/120.js +2197 -0
- package/fesm/24.js +4389 -0
- package/fesm/370.js +1163 -0
- package/fesm/446.js +877 -0
- package/fesm/chunks/117.js +69 -0
- package/fesm/config/index.js +244 -3
- package/fesm/controllers/index.js +27 -7
- package/fesm/docs/index.js +479 -1
- package/fesm/dtos/index.js +123 -5
- package/fesm/entities/index.js +68 -19
- package/fesm/enums/index.js +53 -1
- package/fesm/helpers/index.js +115 -2
- package/fesm/index.js +1437 -12
- package/fesm/interceptors/index.js +508 -2
- package/fesm/interfaces/index.js +75 -7
- package/fesm/modules/index.js +546 -1
- package/fesm/runtime.js +134 -0
- package/fesm/services/index.js +67 -9
- package/helpers/auth-response.mapper.d.ts +3 -3
- package/helpers/index.d.ts +2 -2
- package/helpers/token.helper.d.ts +2 -2
- package/index.d.ts +13 -12
- package/interceptors/clear-token.interceptor.d.ts +2 -2
- package/interceptors/index.d.ts +2 -2
- package/interceptors/set-token.interceptor.d.ts +2 -2
- package/interfaces/auth-module-options.interface.d.ts +3 -3
- package/interfaces/authentication.interface.d.ts +3 -3
- package/interfaces/company-branch.interface.d.ts +2 -2
- package/interfaces/company.interface.d.ts +1 -1
- package/interfaces/index.d.ts +8 -7
- package/interfaces/social-auth.interface.d.ts +43 -0
- package/interfaces/user-enricher.interface.d.ts +3 -3
- package/modules/auth.module.d.ts +4 -4
- package/modules/index.d.ts +1 -1
- package/package.json +32 -39
- package/providers/facebook.social-provider.d.ts +10 -0
- package/providers/google.social-provider.d.ts +10 -0
- package/providers/index.d.ts +1 -0
- package/providers/linkedin.social-provider.d.ts +10 -0
- package/providers/microsoft.social-provider.d.ts +10 -0
- package/providers/oauth-http.util.d.ts +10 -0
- package/providers/social-provider.registry.d.ts +3 -0
- package/services/auth-config.service.d.ts +4 -3
- package/services/auth-datasource.provider.d.ts +4 -3
- package/services/auth-email.service.d.ts +3 -3
- package/services/authentication.service.d.ts +15 -11
- package/services/branch.service.d.ts +7 -7
- package/services/company.service.d.ts +6 -6
- package/services/index.d.ts +11 -9
- package/services/social-auth-config.service.d.ts +21 -0
- package/services/social-auth.service.d.ts +24 -0
- package/services/user-permission.service.d.ts +8 -4
- package/services/user.service.d.ts +7 -7
- package/strategies/jwt.strategy.d.ts +4 -4
- package/validators/password.validator.d.ts +1 -1
- package/cjs/config/auth.constants.js +0 -41
- package/cjs/config/event-actions.js +0 -45
- package/cjs/config/index.js +0 -20
- package/cjs/config/message-keys.js +0 -108
- package/cjs/controllers/authentication.controller.js +0 -427
- package/cjs/controllers/authentication.controller.spec.js +0 -219
- package/cjs/controllers/branch.controller.js +0 -102
- package/cjs/controllers/branch.controller.spec.js +0 -134
- package/cjs/controllers/company-selection.controller.js +0 -198
- package/cjs/controllers/company-selection.controller.spec.js +0 -84
- package/cjs/controllers/company.controller.js +0 -102
- package/cjs/controllers/company.controller.spec.js +0 -131
- package/cjs/controllers/email-verification.controller.js +0 -224
- package/cjs/controllers/email-verification.controller.spec.js +0 -142
- package/cjs/controllers/index.js +0 -24
- package/cjs/controllers/user-permission.controller.js +0 -223
- package/cjs/controllers/user-permission.controller.spec.js +0 -138
- package/cjs/controllers/user.controller.js +0 -438
- package/cjs/controllers/user.controller.spec.js +0 -204
- package/cjs/docs/auth-swagger.config.js +0 -453
- package/cjs/docs/auth-swagger.config.spec.js +0 -130
- package/cjs/docs/index.js +0 -18
- package/cjs/dtos/authentication.dto.js +0 -755
- package/cjs/dtos/company-branch.dto.js +0 -294
- package/cjs/dtos/company.dto.js +0 -298
- package/cjs/dtos/index.js +0 -22
- package/cjs/dtos/user-permission.dto.js +0 -358
- package/cjs/dtos/user.dto.js +0 -413
- package/cjs/entities/app-user.entity.js +0 -25
- package/cjs/entities/company-branch.entity.js +0 -163
- package/cjs/entities/company.entity.js +0 -146
- package/cjs/entities/index.js +0 -65
- package/cjs/entities/index.spec.js +0 -73
- package/cjs/entities/pending-registration.entity.js +0 -135
- package/cjs/entities/user-company-permission.entity.js +0 -153
- package/cjs/entities/user-token.entity.js +0 -120
- package/cjs/enums/index.js +0 -18
- package/cjs/enums/user-org-permission-type.enum.js +0 -15
- package/cjs/helpers/auth-response.mapper.js +0 -46
- package/cjs/helpers/auth-response.mapper.spec.js +0 -139
- package/cjs/helpers/index.js +0 -19
- package/cjs/helpers/token.helper.js +0 -58
- package/cjs/helpers/token.helper.spec.js +0 -86
- package/cjs/index.js +0 -29
- package/cjs/interceptors/clear-token.interceptor.js +0 -73
- package/cjs/interceptors/clear-token.interceptor.spec.js +0 -107
- package/cjs/interceptors/index.js +0 -19
- package/cjs/interceptors/set-token.interceptor.js +0 -107
- package/cjs/interceptors/set-token.interceptor.spec.js +0 -165
- package/cjs/interfaces/auth-email-provider.interface.js +0 -45
- package/cjs/interfaces/auth-module-options.interface.js +0 -4
- package/cjs/interfaces/authentication.interface.js +0 -4
- package/cjs/interfaces/company-branch.interface.js +0 -4
- package/cjs/interfaces/company.interface.js +0 -4
- package/cjs/interfaces/index.js +0 -24
- package/cjs/interfaces/user-enricher.interface.js +0 -4
- package/cjs/interfaces/user.interface.js +0 -4
- package/cjs/modules/auth.module.js +0 -202
- package/cjs/modules/auth.module.spec.js +0 -243
- package/cjs/modules/index.js +0 -18
- package/cjs/services/auth-config.service.js +0 -110
- package/cjs/services/auth-config.service.spec.js +0 -97
- package/cjs/services/auth-datasource.provider.js +0 -134
- package/cjs/services/auth-datasource.provider.spec.js +0 -161
- package/cjs/services/auth-email.service.js +0 -539
- package/cjs/services/auth-email.service.spec.js +0 -456
- package/cjs/services/authentication.service.js +0 -1173
- package/cjs/services/authentication.service.spec.js +0 -962
- package/cjs/services/branch.service.js +0 -153
- package/cjs/services/branch.service.spec.js +0 -169
- package/cjs/services/company-selection-session.service.js +0 -121
- package/cjs/services/company-selection-session.service.spec.js +0 -90
- package/cjs/services/company.service.js +0 -140
- package/cjs/services/company.service.spec.js +0 -127
- package/cjs/services/index.js +0 -26
- package/cjs/services/user-permission.service.js +0 -236
- package/cjs/services/user-permission.service.spec.js +0 -254
- package/cjs/services/user.service.js +0 -671
- package/cjs/services/user.service.spec.js +0 -718
- package/cjs/strategies/jwt.strategy.js +0 -140
- package/cjs/strategies/jwt.strategy.spec.js +0 -166
- package/cjs/validators/password.validator.js +0 -45
- package/cjs/validators/password.validator.spec.js +0 -161
- package/fesm/config/auth.constants.js +0 -11
- package/fesm/config/event-actions.js +0 -24
- package/fesm/config/message-keys.js +0 -78
- package/fesm/controllers/authentication.controller.js +0 -417
- package/fesm/controllers/authentication.controller.spec.js +0 -215
- package/fesm/controllers/branch.controller.js +0 -92
- package/fesm/controllers/branch.controller.spec.js +0 -130
- package/fesm/controllers/company-selection.controller.js +0 -188
- package/fesm/controllers/company-selection.controller.spec.js +0 -80
- package/fesm/controllers/company.controller.js +0 -92
- package/fesm/controllers/company.controller.spec.js +0 -127
- package/fesm/controllers/email-verification.controller.js +0 -214
- package/fesm/controllers/email-verification.controller.spec.js +0 -138
- package/fesm/controllers/user-permission.controller.js +0 -213
- package/fesm/controllers/user-permission.controller.spec.js +0 -134
- package/fesm/controllers/user.controller.js +0 -428
- package/fesm/controllers/user.controller.spec.js +0 -200
- package/fesm/docs/auth-swagger.config.js +0 -446
- package/fesm/docs/auth-swagger.config.spec.js +0 -126
- package/fesm/dtos/authentication.dto.js +0 -683
- package/fesm/dtos/company-branch.dto.js +0 -279
- package/fesm/dtos/company.dto.js +0 -283
- package/fesm/dtos/user-permission.dto.js +0 -339
- package/fesm/dtos/user.dto.js +0 -391
- package/fesm/entities/app-user.entity.js +0 -15
- package/fesm/entities/company-branch.entity.js +0 -153
- package/fesm/entities/company.entity.js +0 -136
- package/fesm/entities/index.spec.js +0 -69
- package/fesm/entities/pending-registration.entity.js +0 -125
- package/fesm/entities/user-company-permission.entity.js +0 -136
- package/fesm/entities/user-token.entity.js +0 -104
- package/fesm/enums/user-org-permission-type.enum.js +0 -5
- package/fesm/helpers/auth-response.mapper.js +0 -25
- package/fesm/helpers/auth-response.mapper.spec.js +0 -135
- package/fesm/helpers/token.helper.js +0 -40
- package/fesm/helpers/token.helper.spec.js +0 -82
- package/fesm/interceptors/clear-token.interceptor.js +0 -63
- package/fesm/interceptors/clear-token.interceptor.spec.js +0 -103
- package/fesm/interceptors/set-token.interceptor.js +0 -98
- package/fesm/interceptors/set-token.interceptor.spec.js +0 -161
- package/fesm/interfaces/auth-email-provider.interface.js +0 -38
- package/fesm/interfaces/auth-module-options.interface.js +0 -3
- package/fesm/interfaces/authentication.interface.js +0 -1
- package/fesm/interfaces/company-branch.interface.js +0 -1
- package/fesm/interfaces/company.interface.js +0 -1
- package/fesm/interfaces/user-enricher.interface.js +0 -4
- package/fesm/interfaces/user.interface.js +0 -1
- package/fesm/modules/auth.module.js +0 -192
- package/fesm/modules/auth.module.spec.js +0 -239
- package/fesm/services/auth-config.service.js +0 -100
- package/fesm/services/auth-config.service.spec.js +0 -93
- package/fesm/services/auth-datasource.provider.js +0 -83
- package/fesm/services/auth-datasource.provider.spec.js +0 -157
- package/fesm/services/auth-email.service.js +0 -488
- package/fesm/services/auth-email.service.spec.js +0 -411
- package/fesm/services/authentication.service.js +0 -1122
- package/fesm/services/authentication.service.spec.js +0 -917
- package/fesm/services/branch.service.js +0 -143
- package/fesm/services/branch.service.spec.js +0 -165
- package/fesm/services/company-selection-session.service.js +0 -111
- package/fesm/services/company-selection-session.service.spec.js +0 -86
- package/fesm/services/company.service.js +0 -130
- package/fesm/services/company.service.spec.js +0 -123
- package/fesm/services/user-permission.service.js +0 -226
- package/fesm/services/user-permission.service.spec.js +0 -250
- package/fesm/services/user.service.js +0 -620
- package/fesm/services/user.service.spec.js +0 -673
- package/fesm/strategies/jwt.strategy.js +0 -130
- package/fesm/strategies/jwt.strategy.spec.js +0 -162
- package/fesm/validators/password.validator.js +0 -48
- package/fesm/validators/password.validator.spec.js +0 -157
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "JwtStrategy", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return JwtStrategy;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _constants = require("@flusys/nestjs-shared/constants");
|
|
12
|
-
const _common = require("@nestjs/common");
|
|
13
|
-
const _core = require("@nestjs/core");
|
|
14
|
-
const _passport = require("@nestjs/passport");
|
|
15
|
-
const _passportjwt = require("passport-jwt");
|
|
16
|
-
const _config = require("../config");
|
|
17
|
-
const _appuserentity = require("../entities/app-user.entity");
|
|
18
|
-
const _authconfigservice = require("../services/auth-config.service");
|
|
19
|
-
const _authdatasourceprovider = require("../services/auth-datasource.provider");
|
|
20
|
-
const _authenticationservice = require("../services/authentication.service");
|
|
21
|
-
function _define_property(obj, key, value) {
|
|
22
|
-
if (key in obj) {
|
|
23
|
-
Object.defineProperty(obj, key, {
|
|
24
|
-
value: value,
|
|
25
|
-
enumerable: true,
|
|
26
|
-
configurable: true,
|
|
27
|
-
writable: true
|
|
28
|
-
});
|
|
29
|
-
} else {
|
|
30
|
-
obj[key] = value;
|
|
31
|
-
}
|
|
32
|
-
return obj;
|
|
33
|
-
}
|
|
34
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
35
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
37
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
38
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
39
|
-
}
|
|
40
|
-
function _ts_metadata(k, v) {
|
|
41
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
42
|
-
}
|
|
43
|
-
function hasCompanyContext(payload) {
|
|
44
|
-
return 'companyId' in payload && payload.companyId != null;
|
|
45
|
-
}
|
|
46
|
-
let JwtStrategy = class JwtStrategy extends (0, _passport.PassportStrategy)(_passportjwt.Strategy, 'jwt') {
|
|
47
|
-
async validate(_req, payload) {
|
|
48
|
-
const userRepo = await this.resolveUserRepository();
|
|
49
|
-
await this.checkTokenRevocation(payload);
|
|
50
|
-
const user = await userRepo.findOne({
|
|
51
|
-
where: {
|
|
52
|
-
id: payload.id,
|
|
53
|
-
isActive: true
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
if (!user) {
|
|
57
|
-
throw new _common.UnauthorizedException({
|
|
58
|
-
message: 'User not found or inactive',
|
|
59
|
-
messageKey: _config.USER_MESSAGES.NOT_FOUND
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
return this.buildUserInfo(payload);
|
|
63
|
-
}
|
|
64
|
-
async resolveUserRepository() {
|
|
65
|
-
try {
|
|
66
|
-
const provider = await this.moduleRef.resolve(_authdatasourceprovider.AuthDataSourceProvider, undefined, {
|
|
67
|
-
strict: false
|
|
68
|
-
});
|
|
69
|
-
if (provider) {
|
|
70
|
-
return provider.getRepository(_appuserentity.AppUser);
|
|
71
|
-
}
|
|
72
|
-
} catch {
|
|
73
|
-
throw new _common.UnauthorizedException({
|
|
74
|
-
message: 'Unable to access user data',
|
|
75
|
-
messageKey: _constants.SYSTEM_MESSAGES.SERVICE_NOT_AVAILABLE,
|
|
76
|
-
messageVariables: {
|
|
77
|
-
provider: 'DataSourceProvider',
|
|
78
|
-
available: ''
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
throw new _common.UnauthorizedException({
|
|
83
|
-
message: 'User repository not available',
|
|
84
|
-
messageKey: _constants.SYSTEM_MESSAGES.REPOSITORY_NOT_AVAILABLE,
|
|
85
|
-
messageVariables: {
|
|
86
|
-
entity: 'User'
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
async checkTokenRevocation(payload) {
|
|
91
|
-
if (!payload.iat) return;
|
|
92
|
-
try {
|
|
93
|
-
const authService = await this.moduleRef.resolve(_authenticationservice.AuthenticationService, undefined, {
|
|
94
|
-
strict: false
|
|
95
|
-
});
|
|
96
|
-
if (authService && await authService.isTokenRevoked(payload.id, payload.iat)) {
|
|
97
|
-
throw new _common.UnauthorizedException({
|
|
98
|
-
message: 'Token has been revoked',
|
|
99
|
-
messageKey: _config.AUTH_MESSAGES.TOKEN_REVOKED
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
} catch (err) {
|
|
103
|
-
if (err instanceof _common.UnauthorizedException) throw err;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
buildUserInfo(payload) {
|
|
107
|
-
const base = {
|
|
108
|
-
id: payload.id,
|
|
109
|
-
email: payload.email
|
|
110
|
-
};
|
|
111
|
-
if (!hasCompanyContext(payload)) {
|
|
112
|
-
return base;
|
|
113
|
-
}
|
|
114
|
-
return {
|
|
115
|
-
...base,
|
|
116
|
-
companyId: payload.companyId,
|
|
117
|
-
...payload.branchId && {
|
|
118
|
-
branchId: payload.branchId
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
constructor(authConfig, moduleRef){
|
|
123
|
-
super({
|
|
124
|
-
jwtFromRequest: _passportjwt.ExtractJwt.fromAuthHeaderAsBearerToken(),
|
|
125
|
-
ignoreExpiration: false,
|
|
126
|
-
secretOrKeyProvider: (_req, _token, done)=>{
|
|
127
|
-
done(null, this.authConfig.getJwtSecret());
|
|
128
|
-
},
|
|
129
|
-
passReqToCallback: true
|
|
130
|
-
}), _define_property(this, "authConfig", void 0), _define_property(this, "moduleRef", void 0), this.authConfig = authConfig, this.moduleRef = moduleRef;
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
JwtStrategy = _ts_decorate([
|
|
134
|
-
(0, _common.Injectable)(),
|
|
135
|
-
_ts_metadata("design:type", Function),
|
|
136
|
-
_ts_metadata("design:paramtypes", [
|
|
137
|
-
typeof _authconfigservice.AuthConfigService === "undefined" ? Object : _authconfigservice.AuthConfigService,
|
|
138
|
-
typeof _core.ModuleRef === "undefined" ? Object : _core.ModuleRef
|
|
139
|
-
])
|
|
140
|
-
], JwtStrategy);
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
const _common = require("@nestjs/common");
|
|
6
|
-
const _repositorymock = require("@test-utils/mocks/repository.mock");
|
|
7
|
-
const _jwtstrategy = require("./jwt.strategy");
|
|
8
|
-
const _authdatasourceprovider = require("../services/auth-datasource.provider");
|
|
9
|
-
const _authenticationservice = require("../services/authentication.service");
|
|
10
|
-
describe('JwtStrategy', ()=>{
|
|
11
|
-
let strategy;
|
|
12
|
-
let userRepo;
|
|
13
|
-
let mockAuthConfig;
|
|
14
|
-
let mockModuleRef;
|
|
15
|
-
let mockDataSourceProvider;
|
|
16
|
-
let mockAuthService;
|
|
17
|
-
beforeEach(()=>{
|
|
18
|
-
userRepo = (0, _repositorymock.createMockRepository)();
|
|
19
|
-
mockAuthConfig = {
|
|
20
|
-
getJwtSecret: jest.fn().mockReturnValue('jwt-secret')
|
|
21
|
-
};
|
|
22
|
-
mockDataSourceProvider = {
|
|
23
|
-
getRepository: jest.fn().mockResolvedValue(userRepo)
|
|
24
|
-
};
|
|
25
|
-
mockAuthService = {
|
|
26
|
-
isTokenRevoked: jest.fn().mockResolvedValue(false)
|
|
27
|
-
};
|
|
28
|
-
mockModuleRef = {
|
|
29
|
-
resolve: jest.fn().mockImplementation(async (token)=>{
|
|
30
|
-
if (token === _authdatasourceprovider.AuthDataSourceProvider) return mockDataSourceProvider;
|
|
31
|
-
if (token === _authenticationservice.AuthenticationService) return mockAuthService;
|
|
32
|
-
return null;
|
|
33
|
-
})
|
|
34
|
-
};
|
|
35
|
-
strategy = new _jwtstrategy.JwtStrategy(mockAuthConfig, mockModuleRef);
|
|
36
|
-
});
|
|
37
|
-
describe('validate', ()=>{
|
|
38
|
-
const req = {};
|
|
39
|
-
it('returns basic user info for a payload without company context', async ()=>{
|
|
40
|
-
userRepo.findOne.mockResolvedValue({
|
|
41
|
-
id: 'user-1',
|
|
42
|
-
isActive: true
|
|
43
|
-
});
|
|
44
|
-
const result = await strategy.validate(req, {
|
|
45
|
-
id: 'user-1',
|
|
46
|
-
email: 'user@example.com',
|
|
47
|
-
type: 'access'
|
|
48
|
-
});
|
|
49
|
-
expect(result).toEqual({
|
|
50
|
-
id: 'user-1',
|
|
51
|
-
email: 'user@example.com'
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
it('includes companyId and branchId when present in the payload', async ()=>{
|
|
55
|
-
userRepo.findOne.mockResolvedValue({
|
|
56
|
-
id: 'user-1',
|
|
57
|
-
isActive: true
|
|
58
|
-
});
|
|
59
|
-
const result = await strategy.validate(req, {
|
|
60
|
-
id: 'user-1',
|
|
61
|
-
email: 'user@example.com',
|
|
62
|
-
type: 'access',
|
|
63
|
-
companyId: 'company-1',
|
|
64
|
-
branchId: 'branch-1'
|
|
65
|
-
});
|
|
66
|
-
expect(result).toEqual({
|
|
67
|
-
id: 'user-1',
|
|
68
|
-
email: 'user@example.com',
|
|
69
|
-
companyId: 'company-1',
|
|
70
|
-
branchId: 'branch-1'
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
it('omits branchId when only companyId is present', async ()=>{
|
|
74
|
-
userRepo.findOne.mockResolvedValue({
|
|
75
|
-
id: 'user-1',
|
|
76
|
-
isActive: true
|
|
77
|
-
});
|
|
78
|
-
const result = await strategy.validate(req, {
|
|
79
|
-
id: 'user-1',
|
|
80
|
-
email: 'user@example.com',
|
|
81
|
-
type: 'access',
|
|
82
|
-
companyId: 'company-1'
|
|
83
|
-
});
|
|
84
|
-
expect(result).toEqual({
|
|
85
|
-
id: 'user-1',
|
|
86
|
-
email: 'user@example.com',
|
|
87
|
-
companyId: 'company-1'
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
it('throws UnauthorizedException when the user is not found or inactive', async ()=>{
|
|
91
|
-
userRepo.findOne.mockResolvedValue(null);
|
|
92
|
-
await expect(strategy.validate(req, {
|
|
93
|
-
id: 'missing-user',
|
|
94
|
-
email: 'x@example.com',
|
|
95
|
-
type: 'access'
|
|
96
|
-
})).rejects.toThrow(_common.UnauthorizedException);
|
|
97
|
-
});
|
|
98
|
-
it('throws UnauthorizedException when the token has been revoked', async ()=>{
|
|
99
|
-
userRepo.findOne.mockResolvedValue({
|
|
100
|
-
id: 'user-1',
|
|
101
|
-
isActive: true
|
|
102
|
-
});
|
|
103
|
-
mockAuthService.isTokenRevoked.mockResolvedValue(true);
|
|
104
|
-
await expect(strategy.validate(req, {
|
|
105
|
-
id: 'user-1',
|
|
106
|
-
email: 'user@example.com',
|
|
107
|
-
type: 'access',
|
|
108
|
-
iat: 1000
|
|
109
|
-
})).rejects.toThrow(_common.UnauthorizedException);
|
|
110
|
-
});
|
|
111
|
-
it('skips revocation check when the payload has no iat', async ()=>{
|
|
112
|
-
userRepo.findOne.mockResolvedValue({
|
|
113
|
-
id: 'user-1',
|
|
114
|
-
isActive: true
|
|
115
|
-
});
|
|
116
|
-
await strategy.validate(req, {
|
|
117
|
-
id: 'user-1',
|
|
118
|
-
email: 'user@example.com',
|
|
119
|
-
type: 'access'
|
|
120
|
-
});
|
|
121
|
-
expect(mockAuthService.isTokenRevoked).not.toHaveBeenCalled();
|
|
122
|
-
});
|
|
123
|
-
it('throws UnauthorizedException when the data source provider cannot be resolved', async ()=>{
|
|
124
|
-
mockModuleRef.resolve.mockImplementation(async (token)=>{
|
|
125
|
-
if (token === _authdatasourceprovider.AuthDataSourceProvider) return null;
|
|
126
|
-
return mockAuthService;
|
|
127
|
-
});
|
|
128
|
-
await expect(strategy.validate(req, {
|
|
129
|
-
id: 'user-1',
|
|
130
|
-
email: 'user@example.com',
|
|
131
|
-
type: 'access'
|
|
132
|
-
})).rejects.toThrow(_common.UnauthorizedException);
|
|
133
|
-
});
|
|
134
|
-
it('propagates an UnauthorizedException raised while resolving the data source provider', async ()=>{
|
|
135
|
-
mockModuleRef.resolve.mockImplementation(async (token)=>{
|
|
136
|
-
if (token === _authdatasourceprovider.AuthDataSourceProvider) throw new Error('resolution failed');
|
|
137
|
-
return mockAuthService;
|
|
138
|
-
});
|
|
139
|
-
await expect(strategy.validate(req, {
|
|
140
|
-
id: 'user-1',
|
|
141
|
-
email: 'user@example.com',
|
|
142
|
-
type: 'access'
|
|
143
|
-
})).rejects.toThrow(_common.UnauthorizedException);
|
|
144
|
-
});
|
|
145
|
-
it('does not fail validation when the authentication service cannot be resolved for revocation checks', async ()=>{
|
|
146
|
-
userRepo.findOne.mockResolvedValue({
|
|
147
|
-
id: 'user-1',
|
|
148
|
-
isActive: true
|
|
149
|
-
});
|
|
150
|
-
mockModuleRef.resolve.mockImplementation(async (token)=>{
|
|
151
|
-
if (token === _authdatasourceprovider.AuthDataSourceProvider) return mockDataSourceProvider;
|
|
152
|
-
return null;
|
|
153
|
-
});
|
|
154
|
-
const result = await strategy.validate(req, {
|
|
155
|
-
id: 'user-1',
|
|
156
|
-
email: 'user@example.com',
|
|
157
|
-
type: 'access',
|
|
158
|
-
iat: 1000
|
|
159
|
-
});
|
|
160
|
-
expect(result).toEqual({
|
|
161
|
-
id: 'user-1',
|
|
162
|
-
email: 'user@example.com'
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "IsStrongPassword", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return IsStrongPassword;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _classvalidator = require("class-validator");
|
|
12
|
-
function IsStrongPassword(options = {}, validationOptions) {
|
|
13
|
-
const { minLength = 8, maxLength = 128, requireUppercase = true, requireLowercase = true, requireNumber = true, requireSpecialChar = true } = options;
|
|
14
|
-
return function(object, propertyName) {
|
|
15
|
-
(0, _classvalidator.registerDecorator)({
|
|
16
|
-
name: 'isStrongPassword',
|
|
17
|
-
target: object.constructor,
|
|
18
|
-
propertyName: propertyName,
|
|
19
|
-
options: validationOptions,
|
|
20
|
-
validator: {
|
|
21
|
-
validate (value) {
|
|
22
|
-
if (typeof value !== 'string') return false;
|
|
23
|
-
const checks = [
|
|
24
|
-
value.length >= minLength,
|
|
25
|
-
value.length <= maxLength,
|
|
26
|
-
!requireUppercase || /[A-Z]/.test(value),
|
|
27
|
-
!requireLowercase || /[a-z]/.test(value),
|
|
28
|
-
!requireNumber || /[0-9]/.test(value),
|
|
29
|
-
!requireSpecialChar || /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~`]/.test(value)
|
|
30
|
-
];
|
|
31
|
-
return checks.every(Boolean);
|
|
32
|
-
},
|
|
33
|
-
defaultMessage (args) {
|
|
34
|
-
const requirements = [];
|
|
35
|
-
if (minLength > 0) requirements.push(`at least ${minLength} characters`);
|
|
36
|
-
if (requireUppercase) requirements.push('one uppercase letter');
|
|
37
|
-
if (requireLowercase) requirements.push('one lowercase letter');
|
|
38
|
-
if (requireNumber) requirements.push('one number');
|
|
39
|
-
if (requireSpecialChar) requirements.push('one special character (!@#$%^&*...)');
|
|
40
|
-
return `Password must contain ${requirements.join(', ')}`;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
const _classvalidator = require("class-validator");
|
|
6
|
-
const _passwordvalidator = require("./password.validator");
|
|
7
|
-
function _define_property(obj, key, value) {
|
|
8
|
-
if (key in obj) {
|
|
9
|
-
Object.defineProperty(obj, key, {
|
|
10
|
-
value: value,
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
writable: true
|
|
14
|
-
});
|
|
15
|
-
} else {
|
|
16
|
-
obj[key] = value;
|
|
17
|
-
}
|
|
18
|
-
return obj;
|
|
19
|
-
}
|
|
20
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
21
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
22
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
24
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
25
|
-
}
|
|
26
|
-
function _ts_metadata(k, v) {
|
|
27
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
28
|
-
}
|
|
29
|
-
let DefaultPasswordDto = class DefaultPasswordDto {
|
|
30
|
-
constructor(){
|
|
31
|
-
_define_property(this, "password", void 0);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
_ts_decorate([
|
|
35
|
-
(0, _passwordvalidator.IsStrongPassword)(),
|
|
36
|
-
_ts_metadata("design:type", String)
|
|
37
|
-
], DefaultPasswordDto.prototype, "password", void 0);
|
|
38
|
-
let CustomPasswordDto = class CustomPasswordDto {
|
|
39
|
-
constructor(){
|
|
40
|
-
_define_property(this, "password", void 0);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
_ts_decorate([
|
|
44
|
-
(0, _passwordvalidator.IsStrongPassword)({
|
|
45
|
-
minLength: 12,
|
|
46
|
-
requireSpecialChar: false
|
|
47
|
-
}),
|
|
48
|
-
_ts_metadata("design:type", String)
|
|
49
|
-
], CustomPasswordDto.prototype, "password", void 0);
|
|
50
|
-
let NoComplexityPasswordDto = class NoComplexityPasswordDto {
|
|
51
|
-
constructor(){
|
|
52
|
-
_define_property(this, "password", void 0);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
_ts_decorate([
|
|
56
|
-
(0, _passwordvalidator.IsStrongPassword)({
|
|
57
|
-
requireUppercase: false,
|
|
58
|
-
requireLowercase: false,
|
|
59
|
-
requireNumber: false,
|
|
60
|
-
requireSpecialChar: false,
|
|
61
|
-
minLength: 4
|
|
62
|
-
}),
|
|
63
|
-
_ts_metadata("design:type", String)
|
|
64
|
-
], NoComplexityPasswordDto.prototype, "password", void 0);
|
|
65
|
-
async function validatePassword(dto) {
|
|
66
|
-
const errors = await (0, _classvalidator.validate)(dto);
|
|
67
|
-
return errors.length === 0;
|
|
68
|
-
}
|
|
69
|
-
describe('IsStrongPassword', ()=>{
|
|
70
|
-
describe('default options', ()=>{
|
|
71
|
-
it('accepts a password meeting all default complexity rules', async ()=>{
|
|
72
|
-
const dto = new DefaultPasswordDto();
|
|
73
|
-
dto.password = 'StrongP@ss1';
|
|
74
|
-
expect(await validatePassword(dto)).toBe(true);
|
|
75
|
-
});
|
|
76
|
-
it('rejects a password shorter than the minimum length', async ()=>{
|
|
77
|
-
const dto = new DefaultPasswordDto();
|
|
78
|
-
dto.password = 'Sh0rt!';
|
|
79
|
-
expect(await validatePassword(dto)).toBe(false);
|
|
80
|
-
});
|
|
81
|
-
it('accepts a password at exactly the minimum length boundary', async ()=>{
|
|
82
|
-
const dto = new DefaultPasswordDto();
|
|
83
|
-
dto.password = 'Ab1!Ab1!'; // 8 chars
|
|
84
|
-
expect(await validatePassword(dto)).toBe(true);
|
|
85
|
-
});
|
|
86
|
-
it('rejects a password longer than the maximum length', async ()=>{
|
|
87
|
-
const dto = new DefaultPasswordDto();
|
|
88
|
-
dto.password = 'A1!' + 'a'.repeat(127); // 130 chars total
|
|
89
|
-
expect(await validatePassword(dto)).toBe(false);
|
|
90
|
-
});
|
|
91
|
-
it('accepts a password at exactly the maximum length boundary', async ()=>{
|
|
92
|
-
const dto = new DefaultPasswordDto();
|
|
93
|
-
dto.password = 'A1!' + 'a'.repeat(125); // 128 chars total
|
|
94
|
-
expect(await validatePassword(dto)).toBe(true);
|
|
95
|
-
});
|
|
96
|
-
it('rejects a password missing an uppercase letter', async ()=>{
|
|
97
|
-
const dto = new DefaultPasswordDto();
|
|
98
|
-
dto.password = 'lowercase1!';
|
|
99
|
-
expect(await validatePassword(dto)).toBe(false);
|
|
100
|
-
});
|
|
101
|
-
it('rejects a password missing a lowercase letter', async ()=>{
|
|
102
|
-
const dto = new DefaultPasswordDto();
|
|
103
|
-
dto.password = 'UPPERCASE1!';
|
|
104
|
-
expect(await validatePassword(dto)).toBe(false);
|
|
105
|
-
});
|
|
106
|
-
it('rejects a password missing a number', async ()=>{
|
|
107
|
-
const dto = new DefaultPasswordDto();
|
|
108
|
-
dto.password = 'NoNumbers!';
|
|
109
|
-
expect(await validatePassword(dto)).toBe(false);
|
|
110
|
-
});
|
|
111
|
-
it('rejects a password missing a special character', async ()=>{
|
|
112
|
-
const dto = new DefaultPasswordDto();
|
|
113
|
-
dto.password = 'NoSpecial1';
|
|
114
|
-
expect(await validatePassword(dto)).toBe(false);
|
|
115
|
-
});
|
|
116
|
-
it('rejects a non-string value', async ()=>{
|
|
117
|
-
const dto = new DefaultPasswordDto();
|
|
118
|
-
dto.password = 12345678;
|
|
119
|
-
expect(await validatePassword(dto)).toBe(false);
|
|
120
|
-
});
|
|
121
|
-
it('rejects an empty string', async ()=>{
|
|
122
|
-
const dto = new DefaultPasswordDto();
|
|
123
|
-
dto.password = '';
|
|
124
|
-
expect(await validatePassword(dto)).toBe(false);
|
|
125
|
-
});
|
|
126
|
-
it('produces a descriptive default error message', async ()=>{
|
|
127
|
-
const dto = new DefaultPasswordDto();
|
|
128
|
-
dto.password = 'bad';
|
|
129
|
-
const errors = await (0, _classvalidator.validate)(dto);
|
|
130
|
-
expect(errors).toHaveLength(1);
|
|
131
|
-
const message = Object.values(errors[0].constraints ?? {})[0];
|
|
132
|
-
expect(message).toContain('at least 8 characters');
|
|
133
|
-
expect(message).toContain('one uppercase letter');
|
|
134
|
-
expect(message).toContain('one lowercase letter');
|
|
135
|
-
expect(message).toContain('one number');
|
|
136
|
-
expect(message).toContain('one special character');
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
describe('custom options', ()=>{
|
|
140
|
-
it('enforces a custom minimum length', async ()=>{
|
|
141
|
-
const dto = new CustomPasswordDto();
|
|
142
|
-
dto.password = 'Short1Aa';
|
|
143
|
-
expect(await validatePassword(dto)).toBe(false);
|
|
144
|
-
});
|
|
145
|
-
it('accepts a password without special chars when requireSpecialChar is false', async ()=>{
|
|
146
|
-
const dto = new CustomPasswordDto();
|
|
147
|
-
dto.password = 'LongEnoughPassword1';
|
|
148
|
-
expect(await validatePassword(dto)).toBe(true);
|
|
149
|
-
});
|
|
150
|
-
it('allows fully relaxed complexity requirements', async ()=>{
|
|
151
|
-
const dto = new NoComplexityPasswordDto();
|
|
152
|
-
dto.password = 'abcd';
|
|
153
|
-
expect(await validatePassword(dto)).toBe(true);
|
|
154
|
-
});
|
|
155
|
-
it('still enforces minLength when complexity checks are disabled', async ()=>{
|
|
156
|
-
const dto = new NoComplexityPasswordDto();
|
|
157
|
-
dto.password = 'abc';
|
|
158
|
-
expect(await validatePassword(dto)).toBe(false);
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// Injection Tokens
|
|
2
|
-
export const AUTH_MODULE_OPTIONS = 'AUTH_MODULE_OPTIONS';
|
|
3
|
-
export const USER_ENRICHER = 'USER_ENRICHER';
|
|
4
|
-
// Security
|
|
5
|
-
export const BCRYPT_SALT_ROUNDS = 12;
|
|
6
|
-
// Cookie
|
|
7
|
-
export const DEFAULT_COOKIE_NAME = 'fsn_refresh_token';
|
|
8
|
-
export const MAX_COOKIE_BYTES = 3500;
|
|
9
|
-
// Cache Key Prefixes
|
|
10
|
-
export const SESSION_CACHE_PREFIX = 'auth:session';
|
|
11
|
-
export const TOKEN_REVOKED_PREFIX = 'auth:revoked';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Domain event actions published by the auth module, alongside the CRUD
|
|
3
|
-
* lifecycle actions every ApiService emits.
|
|
4
|
-
*/ export const AUTH_EVENT_ACTIONS = {
|
|
5
|
-
LOGGED_IN: 'logged-in',
|
|
6
|
-
LOGGED_OUT: 'logged-out',
|
|
7
|
-
TOKEN_REFRESHED: 'token-refreshed',
|
|
8
|
-
COMPANY_SWITCHED: 'company-switched',
|
|
9
|
-
REGISTERED: 'registered',
|
|
10
|
-
PASSWORD_CHANGED: 'password-changed',
|
|
11
|
-
PASSWORD_RESET_REQUESTED: 'password-reset-requested',
|
|
12
|
-
PASSWORD_RESET: 'password-reset',
|
|
13
|
-
EMAIL_VERIFIED: 'email-verified',
|
|
14
|
-
PERMISSION_GRANTED: 'permission-granted',
|
|
15
|
-
PERMISSION_REVOKED: 'permission-revoked'
|
|
16
|
-
};
|
|
17
|
-
/** Every entity the auth module publishes under, ApiService backed or not */ export const AUTH_EVENT_ENTITIES = {
|
|
18
|
-
USER: 'appuser',
|
|
19
|
-
COMPANY: 'company',
|
|
20
|
-
COMPANY_BRANCH: 'company_branch',
|
|
21
|
-
SESSION: 'session',
|
|
22
|
-
USER_PERMISSION: 'user_company_permission'
|
|
23
|
-
};
|
|
24
|
-
export const AUTH_EVENT_MODULE = 'auth';
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// ==================== AUTH MODULE MESSAGE KEYS ====================
|
|
2
|
-
export const AUTH_MESSAGES = {
|
|
3
|
-
LOGIN_SUCCESS: 'auth.login.success',
|
|
4
|
-
LOGIN_REQUIRES_SELECTION: 'auth.login.requires.selection',
|
|
5
|
-
LOGIN_INVALID_CREDENTIALS: 'auth.login.invalid.credentials',
|
|
6
|
-
LOGIN_EMAIL_NOT_VERIFIED: 'auth.login.email.not.verified',
|
|
7
|
-
LOGIN_ACCOUNT_DEACTIVATED: 'auth.login.account.deactivated',
|
|
8
|
-
LOGOUT_SUCCESS: 'auth.logout.success',
|
|
9
|
-
REGISTER_SUCCESS: 'auth.register.success',
|
|
10
|
-
REGISTER_FAILED: 'auth.register.failed',
|
|
11
|
-
REFRESH_SUCCESS: 'auth.refresh.success',
|
|
12
|
-
ME_SUCCESS: 'auth.me.success',
|
|
13
|
-
SELECT_SUCCESS: 'auth.select.success',
|
|
14
|
-
SWITCH_COMPANY_SUCCESS: 'auth.switch.company.success',
|
|
15
|
-
REGISTER_EMAIL_EXISTS: 'auth.register.email.exists',
|
|
16
|
-
REGISTER_COMPANY_ALREADY_ASSIGNED: 'auth.register.company.already.assigned',
|
|
17
|
-
PASSWORD_CHANGE_SUCCESS: 'auth.password.change.success',
|
|
18
|
-
PASSWORD_CHANGE_INVALID_CURRENT: 'auth.password.change.invalid.current',
|
|
19
|
-
PASSWORD_CHANGE_CURRENT_REQUIRED: 'auth.password.change.current.required',
|
|
20
|
-
PASSWORD_RESET_EMAIL_SENT: 'auth.password.reset.email.sent',
|
|
21
|
-
PASSWORD_RESET_SUCCESS: 'auth.password.reset.success',
|
|
22
|
-
TOKEN_REQUIRED: 'auth.token.required',
|
|
23
|
-
TOKEN_INVALID: 'auth.token.invalid',
|
|
24
|
-
TOKEN_EXPIRED: 'auth.token.expired',
|
|
25
|
-
TOKEN_REVOKED: 'auth.token.revoked',
|
|
26
|
-
TOKEN_TOO_LARGE: 'auth.token.too.large',
|
|
27
|
-
COMPANY_LIST_SUCCESS: 'auth.company.list.success',
|
|
28
|
-
COMPANY_NO_ACCESS: 'auth.company.no.access',
|
|
29
|
-
COMPANY_NOT_FOUND: 'auth.company.not.found',
|
|
30
|
-
COMPANY_REQUIRED: 'auth.company.required',
|
|
31
|
-
COMPANY_FEATURE_NOT_ENABLED: 'auth.company.feature.not.enabled',
|
|
32
|
-
BRANCH_LIST_SUCCESS: 'auth.branch.list.success',
|
|
33
|
-
BRANCH_NO_ACCESS: 'auth.branch.no.access',
|
|
34
|
-
BRANCH_NOT_FOUND: 'auth.branch.not.found',
|
|
35
|
-
EMAIL_NOT_CONFIGURED: 'auth.email.not.configured',
|
|
36
|
-
EMAIL_SEND_FAILED: 'auth.email.send.failed',
|
|
37
|
-
SESSION_INVALID: 'auth.session.invalid',
|
|
38
|
-
SESSION_NOT_AVAILABLE: 'auth.session.not.available',
|
|
39
|
-
PROFILE_ACCESS_DENIED: 'auth.profile.access.denied',
|
|
40
|
-
PROFILE_SECTIONS_NOT_SUPPORTED: 'auth.profile.sections.not.supported',
|
|
41
|
-
LOGOUT_SERVICE_UNAVAILABLE: 'auth.logout.service.unavailable',
|
|
42
|
-
PASSWORD_RESET_TOKEN_EXPIRED: 'auth.password.reset.token.expired',
|
|
43
|
-
PASSWORD_RESET_TOKEN_USED: 'auth.password.reset.token.used'
|
|
44
|
-
};
|
|
45
|
-
export const EMAIL_VERIFICATION_MESSAGES = {
|
|
46
|
-
VERIFICATION_SENT: 'email.verification.sent',
|
|
47
|
-
VERIFICATION_SUCCESS: 'email.verification.success',
|
|
48
|
-
VERIFICATION_TOKEN_INVALID: 'email.verification.token.invalid',
|
|
49
|
-
VERIFICATION_TOKEN_EXPIRED: 'email.verification.token.expired',
|
|
50
|
-
VERIFICATION_NOT_ENABLED: 'email.verification.not.enabled',
|
|
51
|
-
RESEND_SUCCESS: 'email.verification.resend.success'
|
|
52
|
-
};
|
|
53
|
-
export const USER_MESSAGES = {
|
|
54
|
-
NOT_FOUND: 'user.not.found',
|
|
55
|
-
PROFILE_UPDATE_SUCCESS: 'user.profile.update.success',
|
|
56
|
-
PROFILE_EXTRAS_SUCCESS: 'user.profile.extras.success',
|
|
57
|
-
PROFILE_SECTIONS_SUCCESS: 'user.profile.sections.success',
|
|
58
|
-
PROFILE_SECTION_DATA_SUCCESS: 'user.profile.section.data.success',
|
|
59
|
-
PROFILE_SECTION_UPDATE_SUCCESS: 'user.profile.section.update.success',
|
|
60
|
-
PROFILE_COMPLETION_SUCCESS: 'user.profile.completion.success',
|
|
61
|
-
EMAIL_VERIFY_SUCCESS: 'user.email.verify.success',
|
|
62
|
-
PHONE_VERIFY_SUCCESS: 'user.phone.verify.success',
|
|
63
|
-
STATUS_UPDATE_SUCCESS: 'user.status.update.success',
|
|
64
|
-
LOOKUP_SUCCESS: 'user.lookup.success'
|
|
65
|
-
};
|
|
66
|
-
export const COMPANY_MESSAGES = {
|
|
67
|
-
READONLY_DELETE_FORBIDDEN: 'company.readonly.delete.forbidden'
|
|
68
|
-
};
|
|
69
|
-
export const BRANCH_MESSAGES = {
|
|
70
|
-
READONLY_DELETE_FORBIDDEN: 'branch.readonly.delete.forbidden'
|
|
71
|
-
};
|
|
72
|
-
export const USER_PERMISSION_MESSAGES = {
|
|
73
|
-
COMPANY_LIST_SUCCESS: 'user.permission.company.list.success',
|
|
74
|
-
BRANCH_LIST_SUCCESS: 'user.permission.branch.list.success',
|
|
75
|
-
BATCH_SUCCESS: 'user.permission.batch.success',
|
|
76
|
-
ALREADY_ASSIGNED: 'user.permission.already.assigned',
|
|
77
|
-
PERMISSION_NOT_FOUND: 'user.permission.not.found'
|
|
78
|
-
};
|