2025-08-21 15:24:40 +09:00
|
|
|
import { Module } from "@nestjs/common";
|
|
|
|
|
import { JwtModule } from "@nestjs/jwt";
|
|
|
|
|
import { PassportModule } from "@nestjs/passport";
|
|
|
|
|
import { ConfigService } from "@nestjs/config";
|
2025-08-28 16:57:57 +09:00
|
|
|
import { APP_GUARD } from "@nestjs/core";
|
2025-08-21 15:24:40 +09:00
|
|
|
import { AuthService } from "./auth.service";
|
2025-09-18 12:34:26 +09:00
|
|
|
import { AuthZodController } from "./auth-zod.controller";
|
2025-08-21 15:24:40 +09:00
|
|
|
import { AuthAdminController } from "./auth-admin.controller";
|
2025-09-18 14:52:26 +09:00
|
|
|
import { UsersModule } from "@bff/modules/users/users.module";
|
2025-09-17 18:43:43 +09:00
|
|
|
import { MappingsModule } from "@bff/modules/id-mappings/mappings.module";
|
|
|
|
|
import { IntegrationsModule } from "@bff/integrations/integrations.module";
|
2025-08-21 15:24:40 +09:00
|
|
|
import { JwtStrategy } from "./strategies/jwt.strategy";
|
|
|
|
|
import { LocalStrategy } from "./strategies/local.strategy";
|
2025-08-28 16:57:57 +09:00
|
|
|
import { GlobalAuthGuard } from "./guards/global-auth.guard";
|
2025-08-21 15:24:40 +09:00
|
|
|
import { TokenBlacklistService } from "./services/token-blacklist.service";
|
2025-09-17 18:43:43 +09:00
|
|
|
import { EmailModule } from "@bff/infra/email/email.module";
|
2025-09-18 12:34:26 +09:00
|
|
|
import { ValidationModule } from "@bff/core/validation";
|
2025-08-20 18:02:50 +09:00
|
|
|
|
|
|
|
|
@Module({
|
|
|
|
|
imports: [
|
|
|
|
|
PassportModule,
|
|
|
|
|
JwtModule.registerAsync({
|
|
|
|
|
useFactory: (configService: ConfigService) => ({
|
2025-08-21 15:24:40 +09:00
|
|
|
secret: configService.get("JWT_SECRET"),
|
|
|
|
|
signOptions: { expiresIn: configService.get("JWT_EXPIRES_IN", "7d") },
|
2025-08-20 18:02:50 +09:00
|
|
|
}),
|
|
|
|
|
inject: [ConfigService],
|
|
|
|
|
}),
|
|
|
|
|
UsersModule,
|
|
|
|
|
MappingsModule,
|
2025-09-17 18:43:43 +09:00
|
|
|
IntegrationsModule,
|
2025-08-23 17:24:37 +09:00
|
|
|
EmailModule,
|
2025-09-18 12:34:26 +09:00
|
|
|
ValidationModule,
|
2025-08-20 18:02:50 +09:00
|
|
|
],
|
2025-09-18 12:34:26 +09:00
|
|
|
controllers: [AuthZodController, AuthAdminController],
|
2025-08-28 16:57:57 +09:00
|
|
|
providers: [
|
|
|
|
|
AuthService,
|
|
|
|
|
JwtStrategy,
|
|
|
|
|
LocalStrategy,
|
|
|
|
|
TokenBlacklistService,
|
|
|
|
|
{
|
|
|
|
|
provide: APP_GUARD,
|
|
|
|
|
useClass: GlobalAuthGuard,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
exports: [AuthService, TokenBlacklistService],
|
2025-08-20 18:02:50 +09:00
|
|
|
})
|
|
|
|
|
export class AuthModule {}
|