Implementerer autentisering med Authentik via @auth/sveltekit:
- OIDC authorization code flow med PKCE og state-verifisering
- JWT-callback lagrer authentik_sub (SHA256-hash, ikke UUID) for
konsistens med maskinrommets auth_identities-tabell
- Server hooks: alle ruter unntatt /signin og /auth/* krever sesjon
- Uautentiserte brukere redirectes til /signin (303)
- Innloggingsside med client-side signIn('authentik')
- Hovedside viser innlogget bruker med logg ut-knapp
- TypeScript-typer utvidet med JWT.authentik_sub
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7 lines
162 B
TypeScript
7 lines
162 B
TypeScript
import type { LayoutServerLoad } from './$types';
|
|
|
|
export const load: LayoutServerLoad = async (event) => {
|
|
return {
|
|
session: await event.locals.auth()
|
|
};
|
|
};
|