Centralize authentication logic and integrate token refresh mechanism

- Introduce `AuthWrapper` component for streamlined session-based layouts and authentication handling.
- Add new utilities (`tokenUtils.ts`) for JWT decoding, token expiration checks, and refresh operations via Keycloak.
- Refactor `serverCall` and `authOptions` to use centralized token refresh logic, removing redundant implementations.
- Implement `ClientSessionProvider` for consistent session management across the client application.
- Simplify `RootLayout` by delegating authentication enforcement to `AuthWrapper`.
This commit is contained in:
2025-07-11 23:42:41 +02:00
parent 6aae06635d
commit bdbaf36456
6 changed files with 272 additions and 165 deletions

View File

@@ -0,0 +1,12 @@
"use client";
import {SessionProvider} from "next-auth/react";
import React from "react";
interface Props {
children: React.ReactNode;
}
export function ClientSessionProvider({children}: Props) {
return <SessionProvider refetchInterval={180}>{children}</SessionProvider>;
}