@nathapp/nestjs-auth 1.0.0-rc.7 → 1.0.0-rc.8
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/module/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { JwtModule, JwtModuleOptions, JwtModuleOptionsFactory, JwtModuleOptionsWithoutProvider } from "./jwt-module";
|
|
2
|
-
export { JwtModule, JwtModuleOptions, JwtModuleOptionsFactory, JwtModuleOptionsWithoutProvider, };
|
|
1
|
+
import { DefaultJwtModuleOptionsFactory, JwtModule, JwtModuleOptions, JwtModuleOptionsFactory, JwtModuleOptionsWithoutProvider } from "./jwt-module";
|
|
2
|
+
export { JwtModule, JwtModuleOptions, JwtModuleOptionsFactory, JwtModuleOptionsWithoutProvider, DefaultJwtModuleOptionsFactory, };
|
package/dist/module/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JwtModule = void 0;
|
|
3
|
+
exports.DefaultJwtModuleOptionsFactory = exports.JwtModule = void 0;
|
|
4
4
|
const jwt_module_1 = require("./jwt-module");
|
|
5
|
+
Object.defineProperty(exports, "DefaultJwtModuleOptionsFactory", { enumerable: true, get: function () { return jwt_module_1.DefaultJwtModuleOptionsFactory; } });
|
|
5
6
|
Object.defineProperty(exports, "JwtModule", { enumerable: true, get: function () { return jwt_module_1.JwtModule; } });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DynamicModule, ModuleMetadata, Type } from '@nestjs/common';
|
|
2
2
|
import { AuthProvider } from '../auth-provider';
|
|
3
3
|
import { JwtOptions, JwtStrategyProvider } from '../strategy';
|
|
4
|
-
import {
|
|
4
|
+
import { ConfigService } from '@nestjs/config';
|
|
5
5
|
export declare class JwtModule {
|
|
6
6
|
static forRoot(options: JwtModuleOptions): DynamicModule;
|
|
7
7
|
static forRootAsync(options: JwtModuleAsyncOptions): DynamicModule;
|
|
@@ -30,7 +30,9 @@ export interface JwtModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
|
|
30
30
|
inject?: any[];
|
|
31
31
|
}
|
|
32
32
|
export declare class DefaultJwtModuleOptionsFactory implements JwtModuleOptionsFactory {
|
|
33
|
-
private readonly
|
|
34
|
-
|
|
33
|
+
private readonly configService;
|
|
34
|
+
private readonly extraOptions;
|
|
35
|
+
constructor(configService: ConfigService);
|
|
36
|
+
private parseOption;
|
|
35
37
|
createOptions(): JwtModuleOptionsWithoutProvider | Promise<JwtModuleOptionsWithoutProvider>;
|
|
36
38
|
}
|
|
@@ -11,10 +11,12 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var JwtModule_1;
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.DefaultJwtModuleOptionsFactory = exports.JwtModule = void 0;
|
|
14
|
-
const common_1 = require("@
|
|
14
|
+
const common_1 = require("@nathapp/common");
|
|
15
|
+
const common_2 = require("@nestjs/common");
|
|
15
16
|
const auth_provider_1 = require("../auth-provider");
|
|
16
17
|
const module_constant_1 = require("../constant/module-constant");
|
|
17
18
|
const strategy_1 = require("../strategy");
|
|
19
|
+
const config_1 = require("@nestjs/config");
|
|
18
20
|
const defaultOptions = {
|
|
19
21
|
logging: true,
|
|
20
22
|
authProvider: auth_provider_1.SimpleAuthProvider,
|
|
@@ -104,19 +106,31 @@ let JwtModule = JwtModule_1 = class JwtModule {
|
|
|
104
106
|
}
|
|
105
107
|
};
|
|
106
108
|
JwtModule = JwtModule_1 = __decorate([
|
|
107
|
-
(0,
|
|
109
|
+
(0, common_2.Module)({})
|
|
108
110
|
], JwtModule);
|
|
109
111
|
exports.JwtModule = JwtModule;
|
|
110
112
|
let DefaultJwtModuleOptionsFactory = class DefaultJwtModuleOptionsFactory {
|
|
111
|
-
constructor(
|
|
112
|
-
this.
|
|
113
|
-
this.extraOptions =
|
|
113
|
+
constructor(configService) {
|
|
114
|
+
this.configService = configService;
|
|
115
|
+
this.extraOptions = {
|
|
114
116
|
bindIp: false,
|
|
115
117
|
checkBlacklisted: false,
|
|
116
118
|
allowDuplicateLogin: true,
|
|
117
119
|
ignoreExpiration: false,
|
|
118
120
|
passReqToCallback: true,
|
|
119
|
-
}
|
|
121
|
+
};
|
|
122
|
+
this.extraOptions.bindIp = this.parseOption('JWT_ACCESS_BINDIP', false);
|
|
123
|
+
this.extraOptions.checkBlacklisted = this.parseOption('JWT_ACCESS_CHECK_BLACKLISTED', false);
|
|
124
|
+
this.extraOptions.allowDuplicateLogin = this.parseOption('JWT_ACCESS_ALLOW_DUPLICATE_LOGIN', true);
|
|
125
|
+
this.extraOptions.ignoreExpiration = this.parseOption('JWT_ACCESS_IGNORE_EXPIRATION', false);
|
|
126
|
+
this.extraOptions.passReqToCallback = this.parseOption('JWT_ACCESS_PASS_REQ_TO_CALLBACK', true);
|
|
127
|
+
}
|
|
128
|
+
parseOption(key, defaultValue) {
|
|
129
|
+
const str = this.configService.get(key);
|
|
130
|
+
if ((0, common_1.isUndefinedOrNullOrEmpty)(str)) {
|
|
131
|
+
return defaultValue;
|
|
132
|
+
}
|
|
133
|
+
return str.toLowerCase() == 'true' || str == '1';
|
|
120
134
|
}
|
|
121
135
|
createOptions() {
|
|
122
136
|
return {
|
|
@@ -135,7 +149,7 @@ let DefaultJwtModuleOptionsFactory = class DefaultJwtModuleOptionsFactory {
|
|
|
135
149
|
}
|
|
136
150
|
};
|
|
137
151
|
DefaultJwtModuleOptionsFactory = __decorate([
|
|
138
|
-
(0,
|
|
139
|
-
__metadata("design:paramtypes", [
|
|
152
|
+
(0, common_2.Injectable)(),
|
|
153
|
+
__metadata("design:paramtypes", [config_1.ConfigService])
|
|
140
154
|
], DefaultJwtModuleOptionsFactory);
|
|
141
155
|
exports.DefaultJwtModuleOptionsFactory = DefaultJwtModuleOptionsFactory;
|
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.8",
|
|
4
4
|
"description": "nestjs-auth",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rimraf dist && tsc -p tsconfig.json",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@nestjs/common": "*",
|
|
41
|
+
"@nestjs/config": "*",
|
|
41
42
|
"@nestjs/core": "*",
|
|
42
43
|
"@nestjs/passport": "*",
|
|
43
44
|
"class-transformer": "*",
|