fix: export guard dependencies so cross-module @UseGuards resolves
NestJS resolves a guard referenced via @UseGuards(SomeGuard) using the consuming module's injector, not the guard's own declaring module's injector. OidcAuthGuard and TripMembershipGuard are shared across several feature modules, so every constructor dependency they need (UsersRepository/UsersService, TripMembersRepository, etc.) must be re-exported by AuthModule/TripsLibModule/UsersLibModule, not just the guard classes themselves. Found via the Phase 02 end-to-end smoke test against a mocked IdP, which failed to boot the API before this fix.
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { Global, Module } from '@nestjs/common';
|
||||
import { UsersLibModule } from '../../users/src';
|
||||
import { OidcDiscoveryService } from './oidc-discovery.service';
|
||||
import { OidcAuthGuard } from './oidc-auth.guard';
|
||||
|
||||
@Global()
|
||||
@Module({
|
||||
imports: [UsersLibModule],
|
||||
providers: [OidcDiscoveryService, OidcAuthGuard],
|
||||
exports: [OidcDiscoveryService, OidcAuthGuard],
|
||||
exports: [OidcDiscoveryService, OidcAuthGuard, UsersLibModule],
|
||||
})
|
||||
export class AuthModule {}
|
||||
|
||||
Reference in New Issue
Block a user