@pristine-ts/security 2.0.4 → 2.0.6
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/lib/cjs/errors/authenticator-decorator.error.js +9 -13
- package/dist/lib/cjs/errors/authenticator-decorator.error.js.map +1 -1
- package/dist/lib/cjs/errors/authenticator-instantiation.error.js +5 -9
- package/dist/lib/cjs/errors/authenticator-instantiation.error.js.map +1 -1
- package/dist/lib/cjs/errors/guard-decorator.error.js +9 -13
- package/dist/lib/cjs/errors/guard-decorator.error.js.map +1 -1
- package/dist/lib/cjs/errors/guard-instantiation.error.js +5 -9
- package/dist/lib/cjs/errors/guard-instantiation.error.js.map +1 -1
- package/dist/lib/cjs/managers/authentication.manager.js +34 -4
- package/dist/lib/cjs/managers/authentication.manager.js.map +1 -1
- package/dist/lib/cjs/managers/authorizer.manager.js +24 -7
- package/dist/lib/cjs/managers/authorizer.manager.js.map +1 -1
- package/dist/lib/cjs/managers/permission.manager.js +31 -9
- package/dist/lib/cjs/managers/permission.manager.js.map +1 -1
- package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/lib/esm/errors/authenticator-decorator.error.js +10 -14
- package/dist/lib/esm/errors/authenticator-decorator.error.js.map +1 -1
- package/dist/lib/esm/errors/authenticator-instantiation.error.js +6 -10
- package/dist/lib/esm/errors/authenticator-instantiation.error.js.map +1 -1
- package/dist/lib/esm/errors/guard-decorator.error.js +10 -14
- package/dist/lib/esm/errors/guard-decorator.error.js.map +1 -1
- package/dist/lib/esm/errors/guard-instantiation.error.js +6 -10
- package/dist/lib/esm/errors/guard-instantiation.error.js.map +1 -1
- package/dist/lib/esm/managers/authentication.manager.js +34 -4
- package/dist/lib/esm/managers/authentication.manager.js.map +1 -1
- package/dist/lib/esm/managers/authorizer.manager.js +24 -7
- package/dist/lib/esm/managers/authorizer.manager.js.map +1 -1
- package/dist/lib/esm/managers/permission.manager.js +32 -10
- package/dist/lib/esm/managers/permission.manager.js.map +1 -1
- package/dist/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/types/errors/authenticator-decorator.error.d.ts +2 -2
- package/dist/types/errors/authenticator-instantiation.error.d.ts +2 -2
- package/dist/types/errors/guard-decorator.error.d.ts +2 -2
- package/dist/types/errors/guard-instantiation.error.d.ts +2 -2
- package/dist/types/managers/authentication.manager.d.ts +7 -2
- package/dist/types/managers/authorizer.manager.d.ts +7 -3
- package/dist/types/managers/permission.manager.d.ts +8 -3
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DependencyContainer } from "tsyringe";
|
|
2
2
|
import { LogHandlerInterface } from "@pristine-ts/logging";
|
|
3
|
-
import { IdentityInterface, Request } from "@pristine-ts/common";
|
|
3
|
+
import { IdentityInterface, Request, TracingManagerInterface } from "@pristine-ts/common";
|
|
4
4
|
import { AuthorizerManagerInterface } from "../interfaces/authorizer-manager.interface";
|
|
5
5
|
import { GuardFactory } from "../factories/guard.factory";
|
|
6
6
|
/**
|
|
@@ -9,15 +9,19 @@ import { GuardFactory } from "../factories/guard.factory";
|
|
|
9
9
|
*/
|
|
10
10
|
export declare class AuthorizerManager implements AuthorizerManagerInterface {
|
|
11
11
|
private readonly logHandler;
|
|
12
|
+
private readonly tracingManager;
|
|
12
13
|
private readonly guardFactory;
|
|
13
14
|
/**
|
|
14
15
|
* The authorizer manager provides authorization by authorizing the action.
|
|
15
16
|
* @param logHandler The log handler to output logs.
|
|
17
|
+
* @param tracingManager The tracing manager used to attach markers per guard decision.
|
|
16
18
|
* @param guardFactory The factory to create the guard.
|
|
17
19
|
*/
|
|
18
|
-
constructor(logHandler: LogHandlerInterface, guardFactory: GuardFactory);
|
|
20
|
+
constructor(logHandler: LogHandlerInterface, tracingManager: TracingManagerInterface, guardFactory: GuardFactory);
|
|
19
21
|
/**
|
|
20
|
-
* Returns whether or not the request is authorized to access the route.
|
|
22
|
+
* Returns whether or not the request is authorized to access the route. Drops one marker
|
|
23
|
+
* per guard (`authz.guard-decision` with the guard's class name and `allow`/`deny`/`error`)
|
|
24
|
+
* so the trace shows which guard was the deciding one.
|
|
21
25
|
* @param request The request to authorize.
|
|
22
26
|
* @param routeContext The route context.
|
|
23
27
|
* @param container The dependency container to resolve the guard from.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VoterInterface } from "../interfaces/voter.interface";
|
|
2
2
|
import { VotingStrategyEnum } from "../enums/voting-strategy.enum";
|
|
3
|
-
import { IdentityInterface } from "@pristine-ts/common";
|
|
3
|
+
import { IdentityInterface, TracingManagerInterface } from "@pristine-ts/common";
|
|
4
4
|
import { LogHandlerInterface } from "@pristine-ts/logging";
|
|
5
5
|
/**
|
|
6
6
|
* The permission manager verifies if the correct permission are there to access and take an action on a resource.
|
|
@@ -8,15 +8,20 @@ import { LogHandlerInterface } from "@pristine-ts/logging";
|
|
|
8
8
|
export declare class PermissionManager {
|
|
9
9
|
private readonly voters;
|
|
10
10
|
private readonly logHandler;
|
|
11
|
+
private readonly tracingManager;
|
|
11
12
|
/**
|
|
12
13
|
* The permission manager verifies if the correct permission are there to access and take an action on a resource.
|
|
13
14
|
* @param voters The voters that determine if access is granted.
|
|
14
15
|
* All services with the tag ServiceDefinitionTagEnum.Voter will be injected here
|
|
15
16
|
* @param logHandler The log handler to output logs.
|
|
17
|
+
* @param tracingManager The tracing manager used to attach markers for the voting decisions.
|
|
16
18
|
*/
|
|
17
|
-
constructor(voters: VoterInterface[], logHandler: LogHandlerInterface);
|
|
19
|
+
constructor(voters: VoterInterface[], logHandler: LogHandlerInterface, tracingManager: TracingManagerInterface);
|
|
18
20
|
/**
|
|
19
|
-
* Returns whether or not the permission manager grants access to the resource.
|
|
21
|
+
* Returns whether or not the permission manager grants access to the resource. Drops one
|
|
22
|
+
* marker per voter (`permission.voter-vote` with `{voter, vote}`) so the trace shows which
|
|
23
|
+
* voter swung the decision. `@traced()` puts the whole call in its own span so the
|
|
24
|
+
* voting work is visible in the trace tree alongside auth/authz.
|
|
20
25
|
* @param identity The identity trying to have access to a resource.
|
|
21
26
|
* @param action The action trying to be executed on the resource.
|
|
22
27
|
* @param resource The resource being accessed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pristine-ts/security",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "dist/lib/esm/security.module.js",
|
|
6
6
|
"main": "dist/lib/cjs/security.module.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@pristine-ts/common": "^2.0.
|
|
24
|
-
"@pristine-ts/logging": "^2.0.
|
|
23
|
+
"@pristine-ts/common": "^2.0.6",
|
|
24
|
+
"@pristine-ts/logging": "^2.0.6"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/jsonwebtoken": "^8.5.1"
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"src/*.{js,ts}"
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "539029d624372f9bb1e22e09da7152eabb95c105",
|
|
64
64
|
"repository": {
|
|
65
65
|
"type": "git",
|
|
66
66
|
"url": "https://github.com/magieno/pristine-ts.git",
|