AuthGuard avaliable where it shouldn't.
I'm submitting a...
[ ] Regression
[X] Bug report
[ ] 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 two different app: company and gui,with two diferents modules but with the same main. On the other hand, I had AuthModule. I am using gui.useGlobalGuards(new (AuthGuard('jwt'))()); company.useGlobalGuards(new (AuthGuard('jwt'))()); I need import AuthModule to use the AuthGuard, but If I import this module in one module, I can use it in both.
Expected behavior
It should be available only in the module where I import it.
Minimal reproduction of the problem with instructions
gui.useGlobalGuards(new (AuthGuard('jwt'))());
company.useGlobalGuards(new (AuthGuard('jwt'))());
@Module({
imports: [MyModule],
controllers: [],
providers: []
})
export class CompanyModule { }
@Module({
imports: [DashboardsModule, AuthModule],
controllers: [],
providers: []
})
export class GUIModule { }
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 : *
Hi @menme95,
Keep in mind that AuthGuard is using passport under the hood and the passport is actually global scoped.
You could use different strategies per app. Track this feature in this issue #705
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.