@nest-boot/auth 4.0.0-beta.1 → 4.0.0-beta.11
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/dist/auth.guard.d.ts +1 -2
- package/dist/auth.guard.js +10 -8
- package/dist/auth.guard.js.map +1 -1
- package/dist/auth.middleware.js +13 -6
- package/dist/auth.middleware.js.map +1 -1
- package/dist/auth.service.js +2 -2
- package/dist/auth.service.js.map +1 -1
- package/dist/decorators/current-entity.decorator.js +4 -4
- package/dist/decorators/current-entity.decorator.js.map +1 -1
- package/dist/decorators/current-personal-access-token.decorator.js +4 -4
- package/dist/decorators/current-personal-access-token.decorator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -13
package/dist/auth.guard.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { EntityManager } from "@mikro-orm/core";
|
|
2
|
-
import { Context } from "@nest-boot/common";
|
|
3
2
|
import { CanActivate, ExecutionContext } from "@nestjs/common";
|
|
4
3
|
import { Reflector } from "@nestjs/core";
|
|
5
4
|
import { AuthModuleOptions } from "./interfaces";
|
|
@@ -9,5 +8,5 @@ export declare class AuthGuard implements CanActivate {
|
|
|
9
8
|
private readonly entityManager;
|
|
10
9
|
constructor(options: AuthModuleOptions, reflector: Reflector, entityManager: EntityManager);
|
|
11
10
|
canActivate(executionContext: ExecutionContext): Promise<boolean>;
|
|
12
|
-
getPermissions(
|
|
11
|
+
getPermissions(): Promise<string[]>;
|
|
13
12
|
}
|
package/dist/auth.guard.js
CHANGED
|
@@ -17,8 +17,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.AuthGuard = void 0;
|
|
19
19
|
const core_1 = require("@mikro-orm/core");
|
|
20
|
-
const
|
|
21
|
-
const
|
|
20
|
+
const request_context_1 = require("@nest-boot/request-context");
|
|
21
|
+
const common_1 = require("@nestjs/common");
|
|
22
22
|
const core_2 = require("@nestjs/core");
|
|
23
23
|
const lodash_1 = __importDefault(require("lodash"));
|
|
24
24
|
const auth_module_definition_1 = require("./auth.module-definition");
|
|
@@ -31,27 +31,29 @@ let AuthGuard = class AuthGuard {
|
|
|
31
31
|
}
|
|
32
32
|
async canActivate(executionContext) {
|
|
33
33
|
var _a;
|
|
34
|
-
|
|
34
|
+
if (!["http", "graphql"].includes(executionContext.getType())) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
35
37
|
const requireAuth = this.reflector.get(auth_module_definition_1.REQUIRE_AUTH_METADATA_KEY, executionContext.getHandler());
|
|
36
38
|
if (!((_a = requireAuth !== null && requireAuth !== void 0 ? requireAuth : this.options.defaultRequireAuth) !== null && _a !== void 0 ? _a : false)) {
|
|
37
39
|
return true;
|
|
38
40
|
}
|
|
39
|
-
const authPayload =
|
|
41
|
+
const authPayload = request_context_1.RequestContext.get("auth");
|
|
40
42
|
if (typeof authPayload === "undefined") {
|
|
41
43
|
return false;
|
|
42
44
|
}
|
|
43
45
|
const permissions = this.reflector.get(auth_module_definition_1.PERMISSIONS_METADATA_KEY, executionContext.getHandler());
|
|
44
46
|
if (typeof permissions === "undefined" ||
|
|
45
|
-
lodash_1.default.intersection(await this.getPermissions(
|
|
47
|
+
lodash_1.default.intersection(await this.getPermissions(), permissions).length > 0) {
|
|
46
48
|
authPayload.personalAccessToken.lastUsedAt = new Date();
|
|
47
49
|
await this.entityManager.flush();
|
|
48
50
|
return true;
|
|
49
51
|
}
|
|
50
52
|
return false;
|
|
51
53
|
}
|
|
52
|
-
async getPermissions(
|
|
54
|
+
async getPermissions() {
|
|
53
55
|
let permissions = [];
|
|
54
|
-
const payload =
|
|
56
|
+
const payload = request_context_1.RequestContext.get("auth");
|
|
55
57
|
if (typeof payload !== "undefined") {
|
|
56
58
|
if (typeof payload.entity.permissions !== "undefined") {
|
|
57
59
|
permissions = permissions.concat(payload.entity.permissions);
|
|
@@ -67,7 +69,7 @@ let AuthGuard = class AuthGuard {
|
|
|
67
69
|
}
|
|
68
70
|
};
|
|
69
71
|
AuthGuard = __decorate([
|
|
70
|
-
__param(0, (0,
|
|
72
|
+
__param(0, (0, common_1.Inject)(auth_module_definition_1.MODULE_OPTIONS_TOKEN)),
|
|
71
73
|
__metadata("design:paramtypes", [Object, core_2.Reflector,
|
|
72
74
|
core_1.EntityManager])
|
|
73
75
|
], AuthGuard);
|
package/dist/auth.guard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.guard.js","sourceRoot":"","sources":["../src/auth.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,0CAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"auth.guard.js","sourceRoot":"","sources":["../src/auth.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,0CAA2D;AAC3D,gEAA4D;AAC5D,2CAAuE;AACvE,uCAAyC;AACzC,oDAAuB;AAEvB,qEAIkC;AAG3B,IAAM,SAAS,GAAf,MAAM,SAAS;IACpB,YAEmB,OAA0B,EAC1B,SAAoB,EACpB,aAA4B;QAF5B,YAAO,GAAP,OAAO,CAAmB;QAC1B,cAAS,GAAT,SAAS,CAAW;QACpB,kBAAa,GAAb,aAAa,CAAe;QAE7C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAEM,KAAK,CAAC,WAAW,CACtB,gBAAkC;;QAElC,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAAE;YAC7D,OAAO,IAAI,CAAC;SACb;QAGD,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CACpC,kDAAyB,EACzB,gBAAgB,CAAC,UAAU,EAAE,CAC9B,CAAC;QAGF,IAAI,CAAC,CAAC,MAAA,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,IAAI,CAAC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QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF,CAAA;AA9EY,SAAS;IAEjB,WAAA,IAAA,eAAM,EAAC,6CAAoB,CAAC,CAAA;6CAED,gBAAS;QACL,oBAAa;GALpC,SAAS,CA8ErB;AA9EY,8BAAS"}
|
package/dist/auth.middleware.js
CHANGED
|
@@ -14,8 +14,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.AuthMiddleware = void 0;
|
|
16
16
|
const core_1 = require("@mikro-orm/core");
|
|
17
|
-
const
|
|
18
|
-
const
|
|
17
|
+
const request_context_1 = require("@nest-boot/request-context");
|
|
18
|
+
const common_1 = require("@nestjs/common");
|
|
19
19
|
const auth_module_definition_1 = require("./auth.module-definition");
|
|
20
20
|
const auth_service_1 = require("./auth.service");
|
|
21
21
|
let AuthMiddleware = class AuthMiddleware {
|
|
@@ -33,13 +33,17 @@ let AuthMiddleware = class AuthMiddleware {
|
|
|
33
33
|
.getRepository(personalAccessToken.entityName)
|
|
34
34
|
.findOne(personalAccessToken.entityId);
|
|
35
35
|
if (entity !== null) {
|
|
36
|
-
|
|
36
|
+
request_context_1.RequestContext.set("auth", {
|
|
37
|
+
entity,
|
|
38
|
+
personalAccessToken,
|
|
39
|
+
});
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
|
-
|
|
43
|
+
next();
|
|
41
44
|
}
|
|
42
45
|
extractAccessToken(req) {
|
|
46
|
+
var _a;
|
|
43
47
|
const authorizationHeader = req.get("authorization");
|
|
44
48
|
if (typeof authorizationHeader === "string") {
|
|
45
49
|
const matched = authorizationHeader.match(/(\S+)\s+(\S+)/);
|
|
@@ -47,12 +51,15 @@ let AuthMiddleware = class AuthMiddleware {
|
|
|
47
51
|
return matched[2];
|
|
48
52
|
}
|
|
49
53
|
}
|
|
54
|
+
if (typeof ((_a = req.cookies) === null || _a === void 0 ? void 0 : _a.token) === "string") {
|
|
55
|
+
return req.cookies.token;
|
|
56
|
+
}
|
|
50
57
|
return null;
|
|
51
58
|
}
|
|
52
59
|
};
|
|
53
60
|
AuthMiddleware = __decorate([
|
|
54
|
-
(0,
|
|
55
|
-
__param(0, (0,
|
|
61
|
+
(0, common_1.Injectable)({ scope: common_1.Scope.REQUEST }),
|
|
62
|
+
__param(0, (0, common_1.Inject)(auth_module_definition_1.MODULE_OPTIONS_TOKEN)),
|
|
56
63
|
__metadata("design:paramtypes", [Object, core_1.EntityManager,
|
|
57
64
|
auth_service_1.AuthService])
|
|
58
65
|
], AuthMiddleware);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.middleware.js","sourceRoot":"","sources":["../src/auth.middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0CAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"auth.middleware.js","sourceRoot":"","sources":["../src/auth.middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0CAAgD;AAChD,gEAA4D;AAC5D,2CAA2E;AAG3E,qEAAgE;AAChE,iDAA6C;AAItC,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAEmB,OAA0B,EAC1B,aAA4B,EAC5B,WAAwB;QAFxB,YAAO,GAAP,OAAO,CAAmB;QAC1B,kBAAa,GAAb,aAAa,CAAe;QAC5B,gBAAW,GAAX,WAAW,CAAa;IACxC,CAAC;IAEJ,KAAK,CAAC,GAAG,CAAC,GAAY,EAAE,GAAa,EAAE,IAAgB;QACrD,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAEjD,IAAI,WAAW,KAAK,IAAI,EAAE;YACxB,MAAM,mBAAmB,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;YAEzE,IAAI,mBAAmB,KAAK,IAAI,EAAE;gBAChC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa;qBACpC,aAAa,CAAC,mBAAmB,CAAC,UAAU,CAAC;qBAC7C,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;gBAGzC,IAAI,MAAM,KAAK,IAAI,EAAE;oBACnB,gCAAc,CAAC,GAAG,CAAc,MAAM,EAAE;wBACtC,MAAM;wBACN,mBAAmB;qBACpB,CAAC,CAAC;iBACJ;aACF;SACF;QAED,IAAI,EAAE,CAAC;IACT,CAAC;IAEO,kBAAkB,CAAC,GAAY;;QACrC,MAAM,mBAAmB,GAAG,GAAG,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QACrD,IAAI,OAAO,mBAAmB,KAAK,QAAQ,EAAE;YAC3C,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;YAE3D,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,QAAQ,EAAE;gBAC7D,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;aACnB;SACF;QAED,IAAI,OAAO,CAAA,MAAA,GAAG,CAAC,OAAO,0CAAE,KAAK,CAAA,KAAK,QAAQ,EAAE;YAC1C,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;SAC1B;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAhDY,cAAc;IAD1B,IAAA,mBAAU,EAAC,EAAE,KAAK,EAAE,cAAK,CAAC,OAAO,EAAE,CAAC;IAGhC,WAAA,IAAA,eAAM,EAAC,6CAAoB,CAAC,CAAA;6CAEG,oBAAa;QACf,0BAAW;GALhC,cAAc,CAgD1B;AAhDY,wCAAc"}
|
package/dist/auth.service.js
CHANGED
|
@@ -18,7 +18,7 @@ const common_1 = require("@nestjs/common");
|
|
|
18
18
|
const crypto_1 = require("crypto");
|
|
19
19
|
const auth_module_definition_1 = require("./auth.module-definition");
|
|
20
20
|
const ms = require("ms");
|
|
21
|
-
const
|
|
21
|
+
const request_context_1 = require("@nest-boot/request-context");
|
|
22
22
|
let AuthService = class AuthService {
|
|
23
23
|
constructor(options, entityManager) {
|
|
24
24
|
this.options = options;
|
|
@@ -42,7 +42,7 @@ let AuthService = class AuthService {
|
|
|
42
42
|
async getToken(token) {
|
|
43
43
|
var _a, _b;
|
|
44
44
|
if (typeof token === "undefined") {
|
|
45
|
-
return (_b = (_a =
|
|
45
|
+
return ((_b = (_a = request_context_1.RequestContext.get("auth")) === null || _a === void 0 ? void 0 : _a.personalAccessToken) !== null && _b !== void 0 ? _b : null);
|
|
46
46
|
}
|
|
47
47
|
return await this.personalAccessTokenEntity.findOne({ token });
|
|
48
48
|
}
|
package/dist/auth.service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../src/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0CAKyB;AACzB,2CAAoD;AACpD,mCAAqC;AAErC,qEAAgE;AAMhE,yBAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../src/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0CAKyB;AACzB,2CAAoD;AACpD,mCAAqC;AAErC,qEAAgE;AAMhE,yBAA0B;AAC1B,gEAA4D;AAGrD,IAAM,WAAW,GAAjB,MAAM,WAAW;IAGtB,YAEmB,OAA0B,EAC1B,aAA4B;QAD5B,YAAO,GAAP,OAAO,CAAmB;QAC1B,kBAAa,GAAb,aAAa,CAAe;QAE7C,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAC/D,IAAI,CAAC,OAAO,CAAC,yBAAyB,CACvC,CAAC;IACJ,CAAC;IAQD,KAAK,CAAC,WAAW,CACf,MAAiB,EACjB,IAAY,EACZ,SAA2B;QAE3B,MAAM,KAAK,GAAG,IAAA,oBAAW,EAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QA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AAE;YAChC,MAAM,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,KAAK,EAAE,CAAC;SAC1E;IACH,CAAC;CACF,CAAA;AA/EY,WAAW;IADvB,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,eAAM,EAAC,6CAAoB,CAAC,CAAA;6CAEG,oBAAa;GANpC,WAAW,CA+EvB;AA/EY,kCAAW"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CurrentUser = exports.CurrentEntity = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
exports.CurrentEntity = (0,
|
|
4
|
+
const request_context_1 = require("@nest-boot/request-context");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
exports.CurrentEntity = (0, common_1.createParamDecorator)(() => {
|
|
7
7
|
var _a;
|
|
8
|
-
return (_a =
|
|
8
|
+
return (_a = request_context_1.RequestContext.get("auth")) === null || _a === void 0 ? void 0 : _a.entity;
|
|
9
9
|
});
|
|
10
10
|
exports.CurrentUser = exports.CurrentEntity;
|
|
11
11
|
//# sourceMappingURL=current-entity.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"current-entity.decorator.js","sourceRoot":"","sources":["../../src/decorators/current-entity.decorator.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"current-entity.decorator.js","sourceRoot":"","sources":["../../src/decorators/current-entity.decorator.ts"],"names":[],"mappings":";;;AAAA,gEAA4D;AAC5D,2CAAsD;AAIzC,QAAA,aAAa,GAAG,IAAA,6BAAoB,EAAC,GAAG,EAAE;;IACrD,OAAO,MAAA,gCAAc,CAAC,GAAG,CAAc,MAAM,CAAC,0CAAE,MAAM,CAAC;AACzD,CAAC,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,qBAAa,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CurrentPersonalAccessToken = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
exports.CurrentPersonalAccessToken = (0,
|
|
4
|
+
const request_context_1 = require("@nest-boot/request-context");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
exports.CurrentPersonalAccessToken = (0, common_1.createParamDecorator)(() => {
|
|
7
7
|
var _a;
|
|
8
|
-
return (_a =
|
|
8
|
+
return (_a = request_context_1.RequestContext.get("auth")) === null || _a === void 0 ? void 0 : _a.personalAccessToken;
|
|
9
9
|
});
|
|
10
10
|
//# sourceMappingURL=current-personal-access-token.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"current-personal-access-token.decorator.js","sourceRoot":"","sources":["../../src/decorators/current-personal-access-token.decorator.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"current-personal-access-token.decorator.js","sourceRoot":"","sources":["../../src/decorators/current-personal-access-token.decorator.ts"],"names":[],"mappings":";;;AAAA,gEAA4D;AAC5D,2CAAsD;AAIzC,QAAA,0BAA0B,GAAG,IAAA,6BAAoB,EAAC,GAAG,EAAE;;IAClE,OAAO,MAAA,gCAAc,CAAC,GAAG,CAAc,MAAM,CAAC,0CAAE,mBAAmB,CAAC;AACtE,CAAC,CAAC,CAAC"}
|