mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-21 11:46:41 +02:00
Replace HTTP POST to /api/v1/auth/validate with local JWT verification using jose + createRemoteJWKSet. Eliminates ~5-20ms HTTP roundtrip per API request across all backends. JWKS cached automatically by jose. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
29 lines
788 B
TypeScript
29 lines
788 B
TypeScript
/**
|
|
* @manacore/shared-nestjs-auth
|
|
*
|
|
* Shared authentication utilities for NestJS backends.
|
|
* Verifies JWT tokens locally using JWKS from the Mana Core Auth service.
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* import { JwtAuthGuard, CurrentUser, CurrentUserData } from '@manacore/shared-nestjs-auth';
|
|
*
|
|
* @Controller('api')
|
|
* @UseGuards(JwtAuthGuard)
|
|
* export class MyController {
|
|
* @Get('profile')
|
|
* getProfile(@CurrentUser() user: CurrentUserData) {
|
|
* return { userId: user.userId, email: user.email };
|
|
* }
|
|
* }
|
|
* ```
|
|
*/
|
|
|
|
// Guards
|
|
export { JwtAuthGuard } from './guards/jwt-auth.guard';
|
|
|
|
// Decorators
|
|
export { CurrentUser } from './decorators/current-user.decorator';
|
|
|
|
// Types
|
|
export type { CurrentUserData, AuthModuleConfig, TokenValidationResponse } from './types';
|