@nathapp/nestjs-auth 1.0.0-rc.26 → 1.0.0-rc.27
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.
|
@@ -6,7 +6,6 @@ const nestjs_common_1 = require("@nathapp/nestjs-common");
|
|
|
6
6
|
const common_1 = require("@nestjs/common");
|
|
7
7
|
const passport_jwt_1 = require("passport-jwt");
|
|
8
8
|
const auth_provider_1 = require("../auth-provider");
|
|
9
|
-
const requestIp = require("request-ip");
|
|
10
9
|
class JwtStrategyProvider {
|
|
11
10
|
constructor(jwtOptions) {
|
|
12
11
|
const extraOptions = {
|
|
@@ -62,7 +61,7 @@ class DefaultJwtStrategyProvider extends JwtStrategyProvider {
|
|
|
62
61
|
this.logger.warn(`req is undefined, please set passReqToCallback to true, bindIp check is ignored`);
|
|
63
62
|
}
|
|
64
63
|
else {
|
|
65
|
-
const reqIp =
|
|
64
|
+
const reqIp = (0, nestjs_common_1.getClientIp)(req);
|
|
66
65
|
if (!principal.loginIP || principal.loginIP != reqIp) {
|
|
67
66
|
this.logger.debug(`principal: ${principal.id} is from different IP.`);
|
|
68
67
|
throw new nestjs_common_1.AppException(nestjs_common_1.CommonExceptionCode.FORBIDDEN_IP_NOT_MATCH);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nathapp/nestjs-auth",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.27",
|
|
4
4
|
"description": "nestjs-auth",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rimraf dist && tsc -p tsconfig.json",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"@types/jest": "^29.5.2",
|
|
21
21
|
"@types/node": "^17.0.45",
|
|
22
22
|
"@types/passport-jwt": "^3.0.8",
|
|
23
|
-
"@types/request-ip": "^0.0.39",
|
|
24
23
|
"@types/supertest": "^2.0.12",
|
|
25
24
|
"@typescript-eslint/eslint-plugin": "^4",
|
|
26
25
|
"@typescript-eslint/parser": "^4",
|
|
@@ -40,7 +39,7 @@
|
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
41
|
"@nathapp/auth": "^1.0.2",
|
|
43
|
-
"@nathapp/nestjs-common": "^1.0.1-rc.
|
|
42
|
+
"@nathapp/nestjs-common": "^1.0.1-rc.24",
|
|
44
43
|
"passport-jwt": "^4.0.1"
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|