ojoanalogo / nestjs-redoc

📘 ReDoc frontend for you NestJS swagger API documentation
MIT License
146 stars 55 forks source link

How to secure docs route? #19

Closed herenickname closed 3 years ago

herenickname commented 3 years ago

I want to restrict access to /docs route from not logged in users. Maybe someone has an example for this? :)

ojoanalogo commented 3 years ago

Hello @ekifox I've added this feature for the upcoming 2.0 update, users will be prompt to enter a predefined set of credentials on redoc module setup.

ojoanalogo commented 3 years ago

Hello,

Please update to the latest version (2.0.3), I've added an option to prompt users with an authentication box, see readme for more details

herenickname commented 3 years ago

@mxarc, additional question, is it possible somehow to include my request interceptor in your module? to transfer authorization control entirely to myself.

ojoanalogo commented 3 years ago

@mxarc, additional question, is it possible somehow to include my request interceptor in your module? to transfer authorization control entirely to myself.

@ekifox It might be possible, version 2.0 uses express-basic-auth package and it allows to handle custom auth (see https://www.npmjs.com/package/express-basic-auth). I would need to include an optional property which passes your method to express-basic-auth.

herenickname commented 3 years ago

@mxarc /docs/swagger.json is not secured via basic auth. Only main redoc's /docs is secured :D