import { DynamicModule } from '@nestjs/common'; import { ConfigsGuard } from '../../guards/types'; /** * Registers the Azure Active Directory authentication guard with configurable error reporting. * * Exposes the guard a través del token `AUTH_AZURE_GUARD`, la clase `AuthAzureGuard`, o de un decorador personalizado como `@Authorization()`. * * --- * ⚠️ Requires transport setup if `emitWrongValidationEvent` is enabled. * The guard uses the `CLIENT_TRANSPORT` token to emit validation failure events (e.g., via Kafka). * * --- * ✅ USAGE 1: Global guard using AUTH_AZURE_GUARD token * * Recommended for securing all routes by default. * * ```ts * import { Module } from '@nestjs/common'; * import { APP_GUARD } from '@nestjs/core'; * import { * AuthAzureConfigModule, * AUTH_AZURE_GUARD, * } from '@my-org/auth-lib'; * import { TransportConfigModule } from '@my-org/transport-lib'; * * @Module({ * imports: [ * TransportConfigModule.config({ * clientId: 'order-service', * brokers: ['localhost:9092'], * groupId: 'order-service-group', * isGlobal: true, * }), * AuthAzureConfigModule.config({ * source: 'order-service', * emitWrongValidationEvent: true, * }), * ], * providers: [ * { * provide: APP_GUARD, * useExisting: AUTH_AZURE_GUARD, * }, * ], * }) * export class AppModule {} * ``` * * * --- * ✅ USAGE 3: Declarative guard with custom `@Authorization()` decorator * * If your library provides a decorator like: * * ```ts * // auth.decorator.ts * import { UseGuards, applyDecorators } from '@nestjs/common'; * import { AuthAzureGuard } from './auth-azure.guard'; * * export function Authorization() { * return applyDecorators(UseGuards(AuthAzureGuard)); * } * ``` * * You can use it like this: * * ```ts * import { Controller, Get } from '@nestjs/common'; * import { Authorization } from '@my-org/auth-lib'; * * @Controller('users') * export class UsersController { * @Get() * @Authorization() * getSecureUsers() { * return ['user1', 'user2']; * } * } * ``` * */ export declare class AuthConfigModule { /** * Configures the authentication guard * * * @param config.source Required - Identifies the service in error logs * @param config.wrongValidationTopic Required - The topic that manage the rr * @param config.emitWrongValidationEvent Optional - Enables error event emission (default: true) * @returns DynamicModule configuration */ static config(config: ConfigsGuard): DynamicModule; } //# sourceMappingURL=auth.module.d.ts.map