nest icon indicating copy to clipboard operation
nest copied to clipboard

@AuthException() unsecure a specific route.

Open menme95 opened this issue 8 years ago • 5 comments

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          : *

menme95 avatar May 16 '18 15:05 menme95

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.

AntoineMaitre avatar May 18 '18 12:05 AntoineMaitre

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

menme95 avatar May 18 '18 13:05 menme95

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

kamilmysliwiec avatar May 19 '18 08:05 kamilmysliwiec

Any advances on this feature?

mazyvan avatar Jan 23 '19 02:01 mazyvan

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.

lock[bot] avatar Sep 24 '19 05:09 lock[bot]