fix(vessel): 선박 라우터 전체에 requireAuth 미들웨어 추가
/in-area, /all, /status 세 엔드포인트 모두 인증 없이 접근 가능한 상태였음. 모든 라우트에 requireAuth를 적용하여 미인증 요청 시 401 반환. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
부모
1f2e493226
커밋
559ebd666a
@ -1,4 +1,5 @@
|
|||||||
import { Router } from 'express';
|
import { Router } from 'express';
|
||||||
|
import { requireAuth } from '../auth/authMiddleware.js';
|
||||||
import { getVesselsInBounds, getAllVessels, getCacheStatus } from './vesselService.js';
|
import { getVesselsInBounds, getAllVessels, getCacheStatus } from './vesselService.js';
|
||||||
import type { BoundingBox } from './vesselTypes.js';
|
import type { BoundingBox } from './vesselTypes.js';
|
||||||
|
|
||||||
@ -6,7 +7,7 @@ const vesselRouter = Router();
|
|||||||
|
|
||||||
// POST /api/vessels/in-area
|
// POST /api/vessels/in-area
|
||||||
// 현재 뷰포트 bbox 안의 선박 목록 반환 (메모리 캐시에서 필터링)
|
// 현재 뷰포트 bbox 안의 선박 목록 반환 (메모리 캐시에서 필터링)
|
||||||
vesselRouter.post('/in-area', (req, res) => {
|
vesselRouter.post('/in-area', requireAuth, (req, res) => {
|
||||||
const { bounds } = req.body as { bounds?: BoundingBox };
|
const { bounds } = req.body as { bounds?: BoundingBox };
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -25,13 +26,13 @@ vesselRouter.post('/in-area', (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// GET /api/vessels/all — 캐시된 전체 선박 목록 반환 (검색용)
|
// GET /api/vessels/all — 캐시된 전체 선박 목록 반환 (검색용)
|
||||||
vesselRouter.get('/all', (_req, res) => {
|
vesselRouter.get('/all', requireAuth, (_req, res) => {
|
||||||
const vessels = getAllVessels();
|
const vessels = getAllVessels();
|
||||||
res.json(vessels);
|
res.json(vessels);
|
||||||
});
|
});
|
||||||
|
|
||||||
// GET /api/vessels/status — 캐시 상태 확인 (디버그용)
|
// GET /api/vessels/status — 캐시 상태 확인 (디버그용)
|
||||||
vesselRouter.get('/status', (_req, res) => {
|
vesselRouter.get('/status', requireAuth, (_req, res) => {
|
||||||
const status = getCacheStatus();
|
const status = getCacheStatus();
|
||||||
res.json(status);
|
res.json(status);
|
||||||
});
|
});
|
||||||
|
|||||||
불러오는 중...
Reference in New Issue
Block a user