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:
Bastian Wagner
2026-08-17 16:10:27 +02:00
parent 60e09d5050
commit 854df5bb2d
3 changed files with 17 additions and 4 deletions

View File

@@ -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 {}