mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-13 23:14:16 +00:00
- Preserve redirects for server-rendered authentication flows - Return explicit unauthorized responses from report route handlers - Cover invalid sessions and callback fallback behavior
27 lines
570 B
TypeScript
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,
|
|
);
|
|
};
|