@nestjs-kitchen/authz 2.0.4 → 2.0.5
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/authz.provider.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Request } from 'express';
|
|
1
2
|
/**
|
|
2
3
|
* Abstract base class for implementing custom authorization logic.
|
|
3
4
|
*
|
|
@@ -25,7 +26,7 @@ export declare abstract class AuthzProviderClass<Payload, User> {
|
|
|
25
26
|
* @param {Payload} payload - The payload to authenticate.
|
|
26
27
|
* @returns {User | Promise<User>} The authenticated user, or a promise resolving to the user.
|
|
27
28
|
*/
|
|
28
|
-
abstract authenticate(payload: Payload): User | Promise<User>;
|
|
29
|
+
abstract authenticate(payload: Payload, req?: Request): User | Promise<User>;
|
|
29
30
|
/**
|
|
30
31
|
* (**Optional**: Implement this method only if authorization is required.)
|
|
31
32
|
*
|
|
@@ -51,7 +51,7 @@ const createJwtStrategy = ([JWT_STRATEGY, AUTHZ_PROVIDER, ALS_PROVIDER]) => {
|
|
|
51
51
|
let user = undefined;
|
|
52
52
|
try {
|
|
53
53
|
const payload = jsonwebtoken_1.default.verify(token, authOptions.jwt.secretOrPublicKey, authOptions.jwt.verify);
|
|
54
|
-
user = await this.authzProvider.authenticate(payload);
|
|
54
|
+
user = await this.authzProvider.authenticate(payload, req);
|
|
55
55
|
}
|
|
56
56
|
catch (error) {
|
|
57
57
|
return [
|
|
@@ -104,7 +104,7 @@ const createRefreshStrategy = ([JWT_REFRESH_STRATEGY, AUTHZ_PROVIDER, ALS_PROVID
|
|
|
104
104
|
try {
|
|
105
105
|
const payload = jsonwebtoken_1.default.verify(token, authOptions.refresh.secretOrPublicKey, authOptions.refresh.verify);
|
|
106
106
|
const decodePayload = (0, utils_1.decodeMsgpackrString)(payload.data);
|
|
107
|
-
user = await this.authzProvider.authenticate(decodePayload);
|
|
107
|
+
user = await this.authzProvider.authenticate(decodePayload, req);
|
|
108
108
|
}
|
|
109
109
|
catch (error) {
|
|
110
110
|
return [
|
|
@@ -42,7 +42,7 @@ const createSessionAuthzStrategy = ([SESSION_STRATEGY, AUTHZ_PROVIDER, ALS_PROVI
|
|
|
42
42
|
}
|
|
43
43
|
let user = undefined;
|
|
44
44
|
try {
|
|
45
|
-
user = await this.authzProvider.authenticate(payload);
|
|
45
|
+
user = await this.authzProvider.authenticate(payload, req);
|
|
46
46
|
}
|
|
47
47
|
catch (error) {
|
|
48
48
|
return [
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@nestjs-kitchen/authz",
|
|
3
3
|
"private": false,
|
|
4
4
|
"description": "Simplest authentication & authorization module in NextJS",
|
|
5
|
-
"version": "2.0.
|
|
5
|
+
"version": "2.0.5",
|
|
6
6
|
"homepage": "https://github.com/yikenman/nestjs-kitchen",
|
|
7
7
|
"repository": "https://github.com/yikenman/nestjs-kitchen",
|
|
8
8
|
"author": "yikenman",
|