{"_id":"@concepta/nestjs-auth-router","_rev":"7-7db7378c980638489698c55d660ad69b","name":"@concepta/nestjs-auth-router","dist-tags":{"alpha":"7.0.0-alpha.7","latest":"7.0.0-alpha.10"},"versions":{"7.0.0-alpha.5":{"name":"@concepta/nestjs-auth-router","version":"7.0.0-alpha.5","license":"BSD-3-Clause","_id":"@concepta/nestjs-auth-router@7.0.0-alpha.5","maintainers":[{"name":"leoafarias","email":"leokcta@gmail.com"},{"name":"mrmaz","email":"marshall.sorenson@gmail.com"}],"dist":{"shasum":"520d7b2bb448826b32aac0182235ed7e30d664a5","tarball":"https://registry.npmjs.org/@concepta/nestjs-auth-router/-/nestjs-auth-router-7.0.0-alpha.5.tgz","fileCount":41,"integrity":"sha512-RH7whTgsfb+tm8XHOOna6pP98Fzjp+DCEGnfl3fi0laR4fK9lXuBUSr3MMPP8huSXS2M/3OeVtifVD45qVJM8g==","signatures":[{"sig":"MEQCICV8XOPpFTKNeSnVpZUZBVO5t+Inw+EYwVDREAXP228bAiBV5BYZDuOspnPt1aYgQP5OHSBzsJtpw120hYzc9ZPLgA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41130},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"cc05089acf36018b115b762334084fb0aeddec38","_npmUser":{"name":"mrmaz","email":"marshall.sorenson@gmail.com"},"_npmVersion":"lerna/3.22.1/node@v18.20.3+x64 (darwin)","description":"Rockets NestJS Auth Guard Router","directories":{},"_nodeVersion":"18.20.3","dependencies":{"@nestjs/core":"^10.4.1","@nestjs/common":"^10.4.1","@nestjs/config":"^3.2.3","@nestjs/swagger":"^7.4.0","@concepta/nestjs-common":"^7.0.0-alpha.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"supertest":"^6.3.4","@types/express":"^4.17.21","@nestjs/testing":"^10.4.1","@concepta/nestjs-auth-google":"^7.0.0-alpha.5","@concepta/nestjs-authentication":"^7.0.0-alpha.5"},"peerDependencies":{"rxjs":"^7.8.1","typeorm":"^0.3.0","class-validator":"*","class-transformer":"*"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-auth-router_7.0.0-alpha.5_1752696053014_0.46980555022902437","host":"s3://npm-registry-packages-npm-production"}},"7.0.0-alpha.6":{"name":"@concepta/nestjs-auth-router","version":"7.0.0-alpha.6","license":"BSD-3-Clause","_id":"@concepta/nestjs-auth-router@7.0.0-alpha.6","maintainers":[{"name":"leoafarias","email":"leokcta@gmail.com"},{"name":"mrmaz","email":"marshall.sorenson@gmail.com"}],"dist":{"shasum":"98d01efffe325be342a5fd43eb5f33b8f9e4d3c4","tarball":"https://registry.npmjs.org/@concepta/nestjs-auth-router/-/nestjs-auth-router-7.0.0-alpha.6.tgz","fileCount":41,"integrity":"sha512-oZJKUkB5B0cujPlYodrvFTfo3gnCvQ3j955SLCyrm3AKHF09mmFbOXbJwoMFKdiepkfQSvsR+Uwc0qmixonOuQ==","signatures":[{"sig":"MEUCIQDFzSt+fY/lm4++ZcwRFbnOdSjD1gAm0oFH51MN099qBAIgBuxc3poblbMKcpm1ZzyGkbfDTkSH8zrPv2YWj1knl3A=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41130},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"13af2b3fdfd13351e1ac158d8962bb523f9919bc","_npmUser":{"name":"mrmaz","email":"marshall.sorenson@gmail.com"},"_npmVersion":"lerna/3.22.1/node@v18.20.3+x64 (darwin)","description":"Rockets NestJS Auth Guard Router","directories":{},"_nodeVersion":"18.20.3","dependencies":{"@nestjs/core":"^10.4.1","@nestjs/common":"^10.4.1","@nestjs/config":"^3.2.3","@nestjs/swagger":"^7.4.0","@concepta/nestjs-common":"^7.0.0-alpha.6"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"supertest":"^6.3.4","@types/express":"^4.17.21","@nestjs/testing":"^10.4.1","@concepta/nestjs-auth-google":"^7.0.0-alpha.6","@concepta/nestjs-authentication":"^7.0.0-alpha.6"},"peerDependencies":{"rxjs":"^7.8.1","typeorm":"^0.3.0","class-validator":"*","class-transformer":"*"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-auth-router_7.0.0-alpha.6_1753983760674_0.4382018096247191","host":"s3://npm-registry-packages-npm-production"}},"7.0.0-alpha.7":{"name":"@concepta/nestjs-auth-router","version":"7.0.0-alpha.7","license":"BSD-3-Clause","_id":"@concepta/nestjs-auth-router@7.0.0-alpha.7","maintainers":[{"name":"leoafarias","email":"leokcta@gmail.com"},{"name":"mrmaz","email":"marshall.sorenson@gmail.com"}],"dist":{"shasum":"77b8bf85c505194d52ffa5f0826ef046e69d8790","tarball":"https://registry.npmjs.org/@concepta/nestjs-auth-router/-/nestjs-auth-router-7.0.0-alpha.7.tgz","fileCount":41,"integrity":"sha512-HQxYm2EYMPyqci0hFXG7Jj6WvU49SxFiKoU1gJrfUn+1J5vWzDVNVIDpvfUBbrW2b/bxNFgkQ1+SFwEF9Arx3Q==","signatures":[{"sig":"MEQCIArh4drDVYpYwMrAfihv3pEJQW8YfZwH2wqq7ni7WY8HAiAYxw8gyOwVx6FNcJduPJaSul9XDbLP7iTywVMn8u/hVw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41130},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"e4f344aabfefe2d160cbdff38326fa38eacc29a9","_npmUser":{"name":"mrmaz","email":"marshall.sorenson@gmail.com"},"_npmVersion":"lerna/3.22.1/node@v18.20.3+x64 (darwin)","description":"Rockets NestJS Auth Guard Router","directories":{},"_nodeVersion":"18.20.3","dependencies":{"@nestjs/core":"^10.4.1","@nestjs/common":"^10.4.1","@nestjs/config":"^3.2.3","@nestjs/swagger":"^7.4.0","@concepta/nestjs-common":"^7.0.0-alpha.7"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"supertest":"^6.3.4","@types/express":"^4.17.21","@nestjs/testing":"^10.4.1","@concepta/nestjs-auth-google":"^7.0.0-alpha.7","@concepta/nestjs-authentication":"^7.0.0-alpha.7"},"peerDependencies":{"rxjs":"^7.8.1","typeorm":"^0.3.0","class-validator":"*","class-transformer":"*"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-auth-router_7.0.0-alpha.7_1755021990444_0.9802432147563156","host":"s3://npm-registry-packages-npm-production"}},"7.0.0-alpha.8":{"name":"@concepta/nestjs-auth-router","version":"7.0.0-alpha.8","license":"BSD-3-Clause","_id":"@concepta/nestjs-auth-router@7.0.0-alpha.8","maintainers":[{"name":"leoafarias","email":"leoafarias@gmail.com"},{"name":"mrmaz","email":"marshall.sorenson@gmail.com"}],"dist":{"shasum":"1946cd2a29ce04a7aa25fdfb8ee93982911a7660","tarball":"https://registry.npmjs.org/@concepta/nestjs-auth-router/-/nestjs-auth-router-7.0.0-alpha.8.tgz","fileCount":41,"integrity":"sha512-EPzENs1GAFjKm49Vaf/Oa09p1mzB8OG/nw4/B7f1ZLLIRbQVkxSLsuV8dHKOHc38j8qWjpZRtZXdCVzE75jVsQ==","signatures":[{"sig":"MEQCICMxG4hWjFjmr2rqM+dBmLBoPYGuFfYF3ZM98K4e8yPIAiAcqvaIl7ViouGaL4CNAPk0uDdmo8rJQoKW2n/tcurOZQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41130},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"8949f2665cf129e8541d3dd9104fe1fbf5927285","_npmUser":{"name":"mrmaz","email":"marshall.sorenson@gmail.com"},"_npmVersion":"lerna/3.22.1/node@v18.20.3+x64 (darwin)","description":"Rockets NestJS Auth Guard Router","directories":{},"_nodeVersion":"18.20.3","dependencies":{"@nestjs/core":"^10.4.1","@nestjs/common":"^10.4.1","@nestjs/config":"^3.2.3","@nestjs/swagger":"^7.4.0","@concepta/nestjs-common":"^7.0.0-alpha.8"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"supertest":"^6.3.4","@types/express":"^4.17.21","@nestjs/testing":"^10.4.1","@concepta/nestjs-auth-google":"^7.0.0-alpha.8","@concepta/nestjs-authentication":"^7.0.0-alpha.8"},"peerDependencies":{"rxjs":"^7.8.1","typeorm":"^0.3.0","class-validator":"*","class-transformer":"*"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-auth-router_7.0.0-alpha.8_1759265206784_0.6969643401176866","host":"s3://npm-registry-packages-npm-production"}},"7.0.0-alpha.9":{"name":"@concepta/nestjs-auth-router","version":"7.0.0-alpha.9","license":"BSD-3-Clause","_id":"@concepta/nestjs-auth-router@7.0.0-alpha.9","maintainers":[{"name":"leoafarias","email":"leoafarias@gmail.com"},{"name":"mrmaz","email":"marshall.sorenson@gmail.com"}],"dist":{"shasum":"1d9efe2e98cf2e968cbabb7d8e840ac0d175ed9a","tarball":"https://registry.npmjs.org/@concepta/nestjs-auth-router/-/nestjs-auth-router-7.0.0-alpha.9.tgz","fileCount":41,"integrity":"sha512-7c0+Qcu9LRLpTeVVUGIbqDxQOhr6WgWe31hPNNSMOxCL2ECib81bIkIhkwOd1LAxOL2PovLSS8eBn/+5KqLEqQ==","signatures":[{"sig":"MEUCIQCitRb7H4ifb7yJex2aRsg9h08J35PwQqqDrfgljC5d2gIgajrqL+9nTYYGNRMNcCJqpNhrYhTykq4bJ3kFrjtNyks=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41130},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"03e55e92bb032503dfbf2bf92b05bc78481900fa","_npmUser":{"name":"mrmaz","email":"marshall.sorenson@gmail.com"},"_npmVersion":"lerna/3.22.1/node@v18.20.3+x64 (darwin)","description":"Rockets NestJS Auth Guard Router","directories":{},"_nodeVersion":"18.20.3","dependencies":{"@nestjs/core":"^10.4.1","@nestjs/common":"^10.4.1","@nestjs/config":"^3.2.3","@nestjs/swagger":"^7.4.0","@concepta/nestjs-common":"^7.0.0-alpha.9"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"supertest":"^6.3.4","@types/express":"^4.17.21","@nestjs/testing":"^10.4.1","@concepta/nestjs-auth-google":"^7.0.0-alpha.9","@concepta/nestjs-authentication":"^7.0.0-alpha.9"},"peerDependencies":{"rxjs":"^7.8.1","typeorm":"^0.3.0","class-validator":"*","class-transformer":"*"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-auth-router_7.0.0-alpha.9_1762812438436_0.04035629847762223","host":"s3://npm-registry-packages-npm-production"}},"7.0.0-alpha.10":{"name":"@concepta/nestjs-auth-router","version":"7.0.0-alpha.10","license":"BSD-3-Clause","_id":"@concepta/nestjs-auth-router@7.0.0-alpha.10","maintainers":[{"name":"leoafarias","email":"leoafarias@gmail.com"},{"name":"mrmaz","email":"marshall.sorenson@gmail.com"}],"dist":{"shasum":"0a4bcd3b41d9bf967425a4769e4017d970fc0655","tarball":"https://registry.npmjs.org/@concepta/nestjs-auth-router/-/nestjs-auth-router-7.0.0-alpha.10.tgz","fileCount":41,"integrity":"sha512-scSvVaBKW9lYYPeRRGYiafshKdpFvlamKlfueT9cPLFBlTvHRAL/Q6IOAbeo9vzV0aJmGc0mZrbaX67byFeoxA==","signatures":[{"sig":"MEQCIBOr7ljkUY4b4bgWfrP4NPWgIpLyIxtDLJJR9IdeGflhAiB07Hx2Ndbo8V5VqsukswOgPRO1al8w/Bo6MsNbhIMnMg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41152},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"680f5c6e0f5be96b3a5bd17b7f11cdb93ad8905d","_npmUser":{"name":"mrmaz","email":"marshall.sorenson@gmail.com"},"_npmVersion":"lerna/3.22.1/node@v20.19.5+x64 (darwin)","description":"Rockets NestJS Auth Guard Router","directories":{},"_nodeVersion":"20.19.5","dependencies":{"@nestjs/core":"^11.1.9","@nestjs/common":"^11.1.9","@nestjs/config":"^4.0.2","@nestjs/swagger":"^11.2.2","@concepta/nestjs-common":"^7.0.0-alpha.10"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"supertest":"^6.3.4","@types/express":"^4.17.21","@nestjs/testing":"^11.1.9","@concepta/nestjs-auth-google":"^7.0.0-alpha.10","@concepta/nestjs-authentication":"^7.0.0-alpha.10"},"peerDependencies":{"rxjs":"^7.8.1","typeorm":"^0.3.0","class-validator":"*","class-transformer":"*"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-auth-router_7.0.0-alpha.10_1763690162077_0.41373039710738424","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-07-16T20:00:52.862Z","modified":"2026-08-06T16:35:37.473Z","7.0.0-alpha.5":"2025-07-16T20:00:53.181Z","7.0.0-alpha.6":"2025-07-31T17:42:40.916Z","7.0.0-alpha.7":"2025-08-12T18:06:30.620Z","7.0.0-alpha.8":"2025-09-30T20:46:46.953Z","7.0.0-alpha.9":"2025-11-10T22:07:18.642Z","7.0.0-alpha.10":"2025-11-21T01:56:02.248Z"},"license":"BSD-3-Clause","description":"Rockets NestJS Auth Guard Router","maintainers":[{"email":"leoafarias@gmail.com","name":"leoafarias"},{"email":"marshall.sorenson@gmail.com","name":"mrmaz"},{"email":"thiago.nramalho@gmail.com","name":"tnramalho"}],"readme":"# Rockets NestJS Auth Guard Router\n\nRoute authentication requests to provider-specific guards based on query\nparameters.\n\n## Project\n\n[![NPM Latest](https://img.shields.io/npm/v/@concepta/nestjs-auth-router)](https://www.npmjs.com/package/@concepta/nestjs-auth-router)\n[![NPM Downloads](https://img.shields.io/npm/dw/@conceptadev/nestjs-auth-router)](https://www.npmjs.com/package/@concepta/nestjs-auth-router)\n[![GH Last Commit](https://img.shields.io/github/last-commit/conceptadev/rockets?logo=github)](https://google.com/conceptadev/rockets)\n[![GH Contrib](https://img.shields.io/github/contributors/conceptadev/rockets?logo=github)](https://google.com/conceptadev/rockets/graphs/contributors)\n[![NestJS Dep](https://img.shields.io/github/package-json/dependency-version/conceptadev/rockets/@nestjs/common?label=NestJS&logo=nestjs&filename=packages%2Fnestjs-core%2Fpackage.json)](https://www.npmjs.com/package/@nestjs/common)\n\n## Table of Contents\n\n1. [Tutorials](#tutorials)\n   - [Introduction](#introduction)\n   - [Getting Started with Auth Guard Router](#getting-started-with-auth-guard-router)\n     - [Step 1: Install the Package](#step-1-install-the-package)\n     - [Step 2: Configure Multiple Auth Guard Router Guards](#step-2-configure-multiple-auth-guard-router-guards)\n     - [Step 3: Use the Auth Router Guard](#step-3-use-the-auth-router-guard)\n2. [How-To Guides](#how-to-guides)\n   - [Configuring Provider-Specific Guards](#configuring-provider-specific-guards)\n   - [Creating Custom Controllers](#creating-custom-controllers)\n   - [Error Handling](#error-handling)\n3. [Reference](#reference)\n4. [Explanation](#explanation)\n   - [Overview of the Guard Router](#overview-of-the-guard-router)\n   - [Provider-Based Routing](#provider-based-routing)\n   - [Error Handling System](#error-handling-system)\n\n## Tutorials\n\n### Introduction\n\nThe `@concepta/nestjs-auth-router` module provides a guard router that\ndelegates authentication to provider-specific guards based on the `provider`\nquery parameter. This allows you to support multiple authentication providers\n(Google, Facebook, GitHub, etc.) through a single unified interface.\n\n**Important:** This module is a guard router only. It does not provide\nauthentication strategies or authentication logic itself. You need to implement\nor use provider-specific guards (like `@concepta/nestjs-auth-google`) that\nhandle the actual authentication.\n\n### Getting Started with Auth Guard Router\n\n#### Step 1: Install the Package\n\nTo get started, install the `@concepta/nestjs-auth-router` package:\n\n```bash\nyarn add @concepta/nestjs-auth-router\n```\n\n#### Step 2: Configure Multiple Auth Guard Router Guards\n\nConfigure the Auth Guard Router module with your provider-specific guards. You\nneed to import the actual authentication provider modules that provide the\nguards:\n\n```ts\nimport { Module } from '@nestjs/common';\nimport { AuthRouterModule } from '@concepta/nestjs-auth-router';\nimport { AuthGoogleModule, AuthGoogleGuard } from '@concepta/nestjs-auth-google';\nimport { AuthFacebookModule, AuthFacebookGuard } from '@concepta/nestjs-auth-facebook';\nimport { AuthGitHubModule, AuthGitHubGuard } from '@concepta/nestjs-auth-github';\n\n@Module({\n  imports: [\n    // Import the actual authentication provider modules\n    AuthGoogleModule.forRoot({\n      // Google-specific configuration\n    }),\n    AuthFacebookModule.forRoot({\n      // Facebook-specific configuration\n    }),\n    AuthGitHubModule.forRoot({\n      // GitHub-specific configuration\n    }),\n    // Configure the Auth Router with the guards from those modules\n    AuthRouterModule.forRoot({\n      guards: [\n        { name: 'google', guard: AuthGoogleGuard },\n        { name: 'facebook', guard: AuthFacebookGuard },\n        { name: 'github', guard: AuthGitHubGuard },\n      ],\n    }),\n  ],\n})\nexport class AppModule {}\n```\n\n#### Step 3: Use the Auth Router Guard\n\nUse the `AuthRouterGuard` in your controllers:\n\n```ts\nimport { Controller, Get, UseGuards, Query } from '@nestjs/common';\nimport { AuthRouterGuard } from '@concepta/nestjs-auth-router';\n\n@Controller('auth')\n@UseGuards(AuthRouterGuard)\nexport class AuthController {\n  @Get('login')\n  login(@Query('provider') provider: string): void {\n    // The AuthRouterGuard will route to the appropriate provider guard\n    // based on the provider query parameter\n    return;\n  }\n\n  @Get('callback')\n  callback(): string {\n    // Handle the authentication callback\n    return 'Authentication successful';\n  }\n}\n```\n\n## How-To Guides\n\n### Configuring Provider-Specific Guards\n\nYou typically use existing authentication provider modules rather than creating\nguards from scratch. For example, use `@concepta/nestjs-auth-google` for\nGoogle authentication:\n\n```ts\nimport { Module } from '@nestjs/common';\nimport { AuthRouterModule } from '@concepta/nestjs-auth-router';\nimport { AuthGoogleModule, AuthGoogleGuard } from '@concepta/nestjs-auth-google';\n\n@Module({\n  imports: [\n    // Import the Google authentication module with its configuration\n    AuthGoogleModule.forRoot({\n      // Google authentication configuration (client ID, secret, etc.)\n    }),\n    // Configure the Auth Router to use the Google guard\n    AuthRouterModule.forRoot({\n      guards: [\n        { name: 'google', guard: AuthGoogleGuard },\n      ],\n    }),\n  ],\n})\nexport class AppModule {}\n```\n\nIf you need to create a custom authentication guard, it must implement the\n`CanActivate` interface:\n\n```ts\nimport { CanActivate, Injectable, ExecutionContext } from '@nestjs/common';\n\n@Injectable()\nexport class CustomAuthGuard implements CanActivate {\n  canActivate(context: ExecutionContext): boolean | Promise<boolean> | Observable<boolean> {\n    // Implement your authentication logic here\n    return true;\n  }\n}\n```\n\nThen register it in the module:\n\n```ts\nAuthRouterModule.forRoot({\n  guards: [\n    { name: 'custom', guard: CustomAuthGuard },\n  ],\n})\n```\n\n### Creating Custom Controllers\n\nYou can create custom controllers that use the Auth Guard Router guard:\n\n```ts\nimport { Controller, Get, UseGuards } from '@nestjs/common';\nimport { AuthRouterGuard } from '@concepta/nestjs-auth-router';\n\n@Controller('auth')\n@UseGuards(AuthRouterGuard)\nexport class AuthController {\n  @Get('login')\n  login(): void {\n    // Guard handles routing based on ?provider= query parameter\n    return;\n  }\n\n  @Get('callback')\n  callback(): { message: string } {\n    return { message: 'Authentication callback handled' };\n  }\n}\n```\n\n### Error Handling\n\nThe Auth Guard Router guard provides specific exceptions for different error\nscenarios:\n\n```ts\nimport {\n  AuthRouterProviderMissingException,\n  AuthRouterProviderNotSupportedException,\n  AuthRouterConfigNotAvailableException,\n  AuthRouterGuardInvalidException,\n  AuthRouterAuthenticationFailedException,\n} from '@concepta/nestjs-auth-router';\n\n// These exceptions are thrown automatically by the guard:\n// - AuthRouterProviderMissingException: No provider query parameter\n// - AuthRouterProviderNotSupportedException: Provider not configured\n// - AuthRouterConfigNotAvailableException: Guards not properly configured\n// - AuthRouterGuardInvalidException: Guard instance is invalid\n// - AuthRouterAuthenticationFailedException: Authentication failed\n```\n\n## Reference\n\n### Exported Types and Classes\n\n- **`AuthRouterModule`**: Main module class with `forRoot()` and\n  `forRootAsync()` methods\n- **`AuthRouterGuard`**: Main guard that routes requests to\n  provider-specific guards\n- **`AuthRouterGuardsRecord`**: Type for mapping provider names to guard\n  instances\n- **`AuthRouterException`**: Base exception class for Auth Router\n  related errors\n\n### Configuration Options\n\n```ts\ninterface AuthRouterOptions {\n  guards: AuthRouterGuardConfigInterface[];\n  settings?: AuthRouterSettingsInterface;\n}\n\ninterface AuthRouterGuardConfigInterface {\n  name: string;           // Provider name (e.g., 'google', 'facebook')\n  guard: Type<CanActivate>; // Guard class that implements CanActivate\n}\n\ninterface AuthRouterOptionsExtrasInterface {\n  global?: boolean;       // Whether the module should be global\n}\n```\n\n### Usage Patterns\n\n**URL Patterns:**\n\n- `/auth/login?provider=google` → Routes to Google guard\n- `/auth/login?provider=facebook` → Routes to Facebook guard\n- `/auth/login?provider=github` → Routes to GitHub guard\n\n**Callback Handling:**\n\nThe guard also handles callback scenarios where the `code` parameter is present:\n\n- `/auth/callback?provider=google&code=abc123` → Routes to Google guard with\n  callback\n- `/auth/callback?code=abc123&state={\"provider\":\"google\"}` → Extracts\n  provider from state\n\n## Explanation\n\n### Overview of the Guard Router\n\nThe Auth Router module provides a routing mechanism for authentication\nrather than implementing authentication strategies directly. It acts as a\ndispatcher that:\n\n1. Extracts the `provider` query parameter from incoming requests\n2. Validates the provider and configuration\n3. Routes the request to the appropriate provider-specific guard\n4. Handles the response from the provider guard\n\n### Provider-Based Routing\n\nThe routing system works as follows:\n\n1. **Request Processing**: When a request hits an endpoint protected by\n   `AuthRouterGuard`, the guard extracts the `provider` query parameter.\n\n2. **Callback Detection**: If a `code` parameter is present, the guard\n   handles callback scenarios:\n   - Uses the `provider` from query parameters\n   - Falls back to extracting provider from `state` parameter if needed\n\n3. **Provider Validation**: The guard validates that:\n   - The provider parameter is present and not empty\n   - The provider is configured in the `guards` array\n   - The corresponding guard instance is valid\n\n4. **Guard Delegation**: The request is forwarded to the provider-specific\n   guard's `canActivate` method.\n\n5. **Response Handling**: The guard handles different return types:\n   - `boolean`: Direct return\n   - `Promise<boolean>`: Awaited\n   - `Observable<boolean>`: Converted to Promise and awaited\n\n### Error Handling System\n\nThe module includes comprehensive error handling:\n\n- **`AuthRouterProviderMissingException`**: Thrown when no `provider`\n  query parameter is provided\n- **`AuthRouterProviderNotSupportedException`**: Thrown when the provider\n  is not configured\n- **`AuthRouterConfigNotAvailableException`**: Thrown when the guards\n  configuration is invalid\n- **`AuthRouterGuardInvalidException`**: Thrown when a guard instance\n  doesn't implement `canActivate`\n- **`AuthRouterAuthenticationFailedException`**: Thrown when the provider\n  guard throws an unexpected error\n\nThis approach ensures that authentication errors are properly categorized and\ncan be handled appropriately by your application's error handling middleware.\n","readmeFilename":"README.md"}