You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is kind of hard to defined Guards (e.g., AuthGuard) at global level but exclude at specific route with standard @nestjs.
it would be nice if this package provide a way to define canActivate with route definition so that we can have some control over customizing enforcing guards declaratively.
HorusGoul, i906, gkucmierz, aliCamargo, alex88 and 3 more
The question for discussion:
if there are more then one effective Guards on a route, how we can compose and apply guards to that route? should we apply and condition or should we react based on previous guard's result!
Hmm, i'm thinking since Guards are injectable, and we can add it directly to providers: []
Nest Router actually have access to that providers array, we can just push it there with APP_GUARD token.
In my opinion it just a helper or a method sugar for applying guards to modules.
Agree, most of us adding guards via APP_GUARD and activating via decorators.
My concern was in general how nestjs handle multiple global guards as I am asking for clarification here nestjs/nest#873
Activity
shekohex commentedon Jul 13, 2018
Hi @xmlking , it seems a good idea, but is there any API Propasol so we can have a clear idea ?
xmlking commentedon Jul 15, 2018
Thinking something like this.
The question for discussion:
if there are more then one effective Guards on a route, how we can compose and apply guards to that route? should we apply
and
condition or should we react based on previous guard's result!shekohex commentedon Jul 15, 2018
Hmm, i'm thinking since
Guards
are injectable, and we can add it directly toproviders: []
Nest Router actually have access to that
providers
array, we can just push it there withAPP_GUARD
token.In my opinion it just a helper or a method sugar for applying guards to modules.
xmlking commentedon Jul 15, 2018
Agree, most of us adding guards via APP_GUARD and activating via decorators.
My concern was in general how nestjs handle multiple global guards as I am asking for clarification here nestjs/nest#873
kamilmysliwiec commentedon Mar 8, 2019
APP_GUARD
is a global guard. We should introduce a sort ofMODULE_GUARD
in this case.gkucmierz commentedon May 13, 2019
I think this can be done similar like its done in angular.
gkucmierz commentedon May 13, 2019
Agree
CatsMiaow commentedon Sep 11, 2019
If so (no
MODULE_GUARD
), is there currently no way to set guard on a per module basis in NestJS?cerireyhan commentedon May 18, 2020
Is there any updates on this issue?