feat(api): add auth guards

This commit is contained in:
dahyeon committed 2026-04-12 22:17:00 +09:00
1 parent 3a86676a12
commit d4b790fd86
16 files changed
+592

No files matched your search

@@ -0,0 +1,18 @@
import { Injectable, NestMiddleware } from '@nestjs/common';
import type { NextFunction, Request, Response } from 'express';
import { AuthService } from './auth.service';
import './auth-request';
@Injectable()
export class AuthMiddleware implements NestMiddleware {
constructor(private readonly authService: AuthService) {}
public async use(req: Request, _res: Response, next: NextFunction) {
const fallback = await this.authService.resolveDevFallbackFromRequest(req);
if (fallback) {
req.user = fallback.user;
req.identity = fallback.identity;
}
next();
}
}