Files
prowler/ui/lib/auth-headers.ts
T
Alan Buscaglia 627d3b6199 fix(ui): return 401 for unauthenticated report routes
- Preserve redirects for server-rendered authentication flows
- Return explicit unauthorized responses from report route handlers
- Cover invalid sessions and callback fallback behavior
2026-07-29 11:35:14 +02:00

27 lines
570 B
TypeScript

import "server-only";
import { auth } from "@/auth.config";
import {
getAuthHeadersIfAvailable,
getRequiredAuthHeaders,
} from "./server-auth";
export const getAuthHeaders = async (options?: { contentType?: boolean }) => {
const session = await auth();
return getRequiredAuthHeaders(session?.accessToken, options, session?.error);
};
export const getRouteAuthHeaders = async (options?: {
contentType?: boolean;
}) => {
const session = await auth();
return getAuthHeadersIfAvailable(
session?.accessToken,
options,
session?.error,
);
};