nest icon indicating copy to clipboard operation
nest copied to clipboard

AuthGuard avaliable where it shouldn't.

Open menme95 opened this issue 8 years ago • 3 comments

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

menme95 avatar May 18 '18 08:05 menme95

Hi @menme95, Keep in mind that AuthGuard is using passport under the hood and the passport is actually global scoped.

kamilmysliwiec avatar May 20 '18 10:05 kamilmysliwiec

You could use different strategies per app. Track this feature in this issue #705

kamilmysliwiec avatar May 23 '18 14:05 kamilmysliwiec

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 23:09 lock[bot]