feat: [fcm] Admin FCM API 추가 - MNG에서 API 호출로 FCM 발송

- AdminFcmController, AdminFcmService 추가
- FormRequest 검증 (AdminFcmSendRequest 등)
- Swagger 문서 추가 (AdminFcmApi.php)
- ApiKeyMiddleware: admin/fcm/* 화이트리스트 추가
- FCM 에러 메시지 i18n 추가
This commit is contained in:
2025-12-23 12:45:28 +09:00
parent c8ad3c908c
commit 75be618f98
10 changed files with 1192 additions and 2 deletions

View File

@@ -122,13 +122,22 @@ public function handle(Request $request, Closure $next)
'api/v1/refresh',
'api/v1/debug-apikey',
'api/v1/internal/exchange-token', // 내부 서버간 토큰 교환 (HMAC 인증 사용)
// 추가적으로 허용하고 싶은 라우트
'api/v1/admin/fcm/*', // Admin FCM API (MNG에서 API Key만으로 접근)
];
// 현재 라우트 확인 (경로 또는 이름)
$currentRoute = $request->route()?->uri() ?? $request->path();
if (! in_array($currentRoute, $allowWithoutAuth)) {
// 화이트리스트 패턴 매칭 (와일드카드 지원)
$isAllowedWithoutAuth = false;
foreach ($allowWithoutAuth as $pattern) {
if ($pattern === $currentRoute || fnmatch($pattern, $currentRoute)) {
$isAllowedWithoutAuth = true;
break;
}
}
if (! $isAllowedWithoutAuth) {
// 인증정보(api_user, tenant_id) 없으면 튕김
if (! app()->bound('api_user')) {
throw new AuthenticationException('회원정보 정보 없음');