@smartsoft001/auth-shell-app-services 2.126.0 → 2.128.0
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/index.js +15 -20
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
9
|
return result;
|
|
11
10
|
};
|
|
12
11
|
var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
@@ -63,10 +62,6 @@ import { Injectable } from "@nestjs/common";
|
|
|
63
62
|
import { InjectRepository } from "@nestjs/typeorm";
|
|
64
63
|
import { Guid as Guid2 } from "guid-typescript";
|
|
65
64
|
|
|
66
|
-
// packages/shared/models/src/lib/symbols.ts
|
|
67
|
-
var SYMBOL_MODEL = Symbol.for("smartsoft:model");
|
|
68
|
-
var SYMBOL_FIELD = Symbol.for("smartsoft:field");
|
|
69
|
-
|
|
70
65
|
// packages/shared/models/src/lib/decorators/model/model.decorator.ts
|
|
71
66
|
import "reflect-metadata";
|
|
72
67
|
|
|
@@ -121,6 +116,11 @@ var TokenFactory = class {
|
|
|
121
116
|
this.fbService = fbService;
|
|
122
117
|
this.googleService = googleService;
|
|
123
118
|
}
|
|
119
|
+
config;
|
|
120
|
+
repository;
|
|
121
|
+
jwtService;
|
|
122
|
+
fbService;
|
|
123
|
+
googleService;
|
|
124
124
|
_invalidUsernameOrPasswordMessage = "Invalid username or password";
|
|
125
125
|
static getQuery(config, customProvider = false) {
|
|
126
126
|
switch (config.grant_type) {
|
|
@@ -140,8 +140,7 @@ var TokenFactory = class {
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
static checkDisabled(user) {
|
|
143
|
-
if (user.disabled)
|
|
144
|
-
throw new DomainValidationError("user disabled");
|
|
143
|
+
if (user.disabled) throw new DomainValidationError("user disabled");
|
|
145
144
|
}
|
|
146
145
|
async create(options) {
|
|
147
146
|
if (options.request.grant_type === "fb") {
|
|
@@ -215,25 +214,19 @@ var TokenFactory = class {
|
|
|
215
214
|
throw new DomainValidationError(this._invalidUsernameOrPasswordMessage);
|
|
216
215
|
}
|
|
217
216
|
valid(req) {
|
|
218
|
-
if (!req)
|
|
219
|
-
|
|
220
|
-
if (!req.grant_type)
|
|
221
|
-
throw new DomainValidationError("grant_type is empty");
|
|
217
|
+
if (!req) throw new DomainValidationError("config is empty");
|
|
218
|
+
if (!req.grant_type) throw new DomainValidationError("grant_type is empty");
|
|
222
219
|
if (req.grant_type === "password") {
|
|
223
|
-
if (!req.username)
|
|
224
|
-
|
|
225
|
-
if (!req.
|
|
226
|
-
throw new DomainValidationError("password is empty");
|
|
227
|
-
if (!req.client_id)
|
|
228
|
-
throw new DomainValidationError("client_id is empty");
|
|
220
|
+
if (!req.username) throw new DomainValidationError("username is empty");
|
|
221
|
+
if (!req.password) throw new DomainValidationError("password is empty");
|
|
222
|
+
if (!req.client_id) throw new DomainValidationError("client_id is empty");
|
|
229
223
|
if (!this.config.clients.some((c) => c === req.client_id))
|
|
230
224
|
throw new DomainValidationError("client_id is incorrect");
|
|
231
225
|
} else if (req.grant_type === "refresh_token") {
|
|
232
226
|
if (!req.refresh_token)
|
|
233
227
|
throw new DomainValidationError("refresh_token is empty");
|
|
234
228
|
} else if (req.grant_type === "fb") {
|
|
235
|
-
if (!req.fb_token)
|
|
236
|
-
throw new DomainValidationError("fb_token is empty");
|
|
229
|
+
if (!req.fb_token) throw new DomainValidationError("fb_token is empty");
|
|
237
230
|
if (!req.fb_user_id)
|
|
238
231
|
throw new DomainValidationError("fb_user_id is empty");
|
|
239
232
|
} else if (req.grant_type === "google") {
|
|
@@ -275,6 +268,8 @@ var AuthService = class {
|
|
|
275
268
|
this.factory = factory;
|
|
276
269
|
this.moduleRef = moduleRef;
|
|
277
270
|
}
|
|
271
|
+
factory;
|
|
272
|
+
moduleRef;
|
|
278
273
|
create(req, httpReq) {
|
|
279
274
|
return this.factory.create({
|
|
280
275
|
httpReq,
|