Nest: @AuthException() unsecure a specific route.

Created on 16 May 2018  路  5Comments  路  Source: nestjs/nest

I'm submitting a...


[ ] Regression 
[ ] Bug report
[ X ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

I have all my routes secured.

app.useGlobalGuards(new (AuthGuard('jwt'))());

Expected behavior

It could be usefull have a decorator: @AuthException() wich unsecure a route.

What is the motivation / use case for changing the behavior?


If you have a completely private api and you want to unsecure authenticate route

Environment


[System Information]
OS Version     : Windows 7
NodeJS Version : v10.0.0
NPM Version    : 6.0.0
[Nest Information]
microservices version : *
websockets version    : *
mongoose version      : 4.0.0
passport version      : 1.0.10
swagger version       : 2.0.0
testing version       : *
common version        : *
core version          : *

Most helpful comment

This feature would make it possible. Let's track this issue, this is something that I definitely want to do in the near future.

All 5 comments

One solution you can try would be to use your AuthGuard at the controller level.
In the controller where you need to remove the auth restriction, use AuthGuard at the route level, so that your unrestricted route doesn't have the AuthGuard.

I have two controller, one with guard and other one without it but it is not exactly what I want to do. This is a heritable big project and I need to do this as simple as I am able to do.
My others apps are with GlobalGuards and I'm trying to keep the same architecture.
I will try a custom decorator but I don't know if it will be posible

This feature would make it possible. Let's track this issue, this is something that I definitely want to do in the near future.

Any advances on this feature?

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings