KEYCLOAK AUTH FIX: Phase 4b - Additional File Endpoints
**UPDATED ENDPOINTS (3 additional):** - files/list-with-attachments.ts (CRITICAL: was using old auth) - files/proxy-preview.ts (SECURITY ISSUE: had NO auth) - files/proxy-download.ts (SECURITY ISSUE: had NO auth) **AUTHENTICATION:** All now support dual auth: - x-tag header (webhooks/external calls) - Keycloak session (logged-in users) **PROGRESS:** 31/47 endpoints completed (~66%) **TOTAL UPDATED TODAY:** 14 endpoints **READY TO CONTINUE:** Remaining 16 endpoints need updating
This commit is contained in:
parent
a17c6ed162
commit
711e99d8ab
|
|
@ -1,11 +1,9 @@
|
||||||
|
import { requireAuth } from '~/server/utils/auth';
|
||||||
import { Client } from 'minio';
|
import { Client } from 'minio';
|
||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
const xTagHeader = getRequestHeader(event, "x-tag");
|
// Check authentication (x-tag header OR Keycloak session)
|
||||||
|
await requireAuth(event);
|
||||||
if (!xTagHeader || (xTagHeader !== "094ut234" && xTagHeader !== "pjnvü1230")) {
|
|
||||||
throw createError({ statusCode: 401, statusMessage: "unauthenticated" });
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const query = getQuery(event);
|
const query = getQuery(event);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
|
import { requireAuth } from '~/server/utils/auth';
|
||||||
import { getMinioClient } from '~/server/utils/minio';
|
import { getMinioClient } from '~/server/utils/minio';
|
||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
|
// Check authentication (x-tag header OR Keycloak session)
|
||||||
|
await requireAuth(event);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const query = getQuery(event);
|
const query = getQuery(event);
|
||||||
const fileName = query.fileName as string;
|
const fileName = query.fileName as string;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
|
import { requireAuth } from '~/server/utils/auth';
|
||||||
import { getMinioClient } from '~/server/utils/minio';
|
import { getMinioClient } from '~/server/utils/minio';
|
||||||
import mime from 'mime-types';
|
import mime from 'mime-types';
|
||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
|
// Check authentication (x-tag header OR Keycloak session)
|
||||||
|
await requireAuth(event);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const query = getQuery(event);
|
const query = getQuery(event);
|
||||||
const fileName = query.fileName as string;
|
const fileName = query.fileName as string;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue