12 lines
369 B
TypeScript
12 lines
369 B
TypeScript
import {Session} from "~/auth/Session";
|
|
import {useRuntimeConfig} from "#imports";
|
|
|
|
export default defineEventHandler(async (event) =>
|
|
{
|
|
const cookie = getCookie(event, Session.COOKIE);
|
|
if (cookie == null)
|
|
{
|
|
console.log("Request is unauthorized. Redirect to IDP.");
|
|
await sendRedirect(event, useRuntimeConfig().public.idpUrl, 302);
|
|
}
|
|
}); |