nestjs-security-cli 1.5.0 → 1.5.1
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/README.md +12 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,8 +25,10 @@ import { SecurityModule, BlacklistedIp, BlacklistedIpSchema, SecurityMiddleware
|
|
|
25
25
|
enableAutoBlocking: true
|
|
26
26
|
}),
|
|
27
27
|
inject: [],
|
|
28
|
+
// Required if enableDatabase is true
|
|
29
|
+
// This should be your mongoose connection
|
|
28
30
|
imports: [ MongoDbModule ],
|
|
29
|
-
providers: [ ...IpBlockerProvider ]
|
|
31
|
+
providers: [ ...IpBlockerProvider ] // Required if enableDatabase is true
|
|
30
32
|
} )
|
|
31
33
|
]
|
|
32
34
|
} )
|
|
@@ -90,6 +92,11 @@ import { SecurityModule } from 'nestjs-security-cli'
|
|
|
90
92
|
]
|
|
91
93
|
} )
|
|
92
94
|
export class AppModule {
|
|
95
|
+
configure(consumer: MiddlewareConsumer): void {
|
|
96
|
+
consumer
|
|
97
|
+
.apply( SecurityMiddleware )
|
|
98
|
+
.forRoutes( { path: '*', method: RequestMethod.ALL } )
|
|
99
|
+
}
|
|
93
100
|
}
|
|
94
101
|
````
|
|
95
102
|
|
|
@@ -162,7 +169,9 @@ import { Module, APP_GUARD } from '@nestjs/common'
|
|
|
162
169
|
import { IpBlacklistGuard } from 'nestjs-security-cli'
|
|
163
170
|
|
|
164
171
|
@Module( {
|
|
165
|
-
|
|
172
|
+
imports: [
|
|
173
|
+
/* other imports */
|
|
174
|
+
],
|
|
166
175
|
providers: [
|
|
167
176
|
{
|
|
168
177
|
provide: APP_GUARD,
|
|
@@ -173,6 +182,7 @@ import { IpBlacklistGuard } from 'nestjs-security-cli'
|
|
|
173
182
|
export class AppModule {
|
|
174
183
|
}
|
|
175
184
|
```
|
|
185
|
+
|
|
176
186
|
And then in your controllers simply use the `@UseGuards(IpBlacklistGuard)` decorator.
|
|
177
187
|
|
|
178
188
|
## Features
|
package/package.json
CHANGED