From fd1d0bdda5d603ae70b3af44781caf244082f487 Mon Sep 17 00:00:00 2001 From: Thomas Sindt Date: Mon, 3 Aug 2026 22:42:59 +0200 Subject: [PATCH] keycloak teil 2 --- buildtime/client/material-editor/src/keycloak.ts | 7 +++++++ buildtime/client/material-editor/src/main.tsx | 14 +++++++++----- .../client/material-editor/src/pages/HomePage.tsx | 4 +++- 3 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 buildtime/client/material-editor/src/keycloak.ts diff --git a/buildtime/client/material-editor/src/keycloak.ts b/buildtime/client/material-editor/src/keycloak.ts new file mode 100644 index 000000000..65719eceb --- /dev/null +++ b/buildtime/client/material-editor/src/keycloak.ts @@ -0,0 +1,7 @@ +import Keycloak from 'keycloak-js'; + const keycloak = new Keycloak({ + url: 'https://barefacedlean.ddnss.de:9099', + realm: 'simplycpq', + clientId: 'simplycpq', +}); +export default keycloak; diff --git a/buildtime/client/material-editor/src/main.tsx b/buildtime/client/material-editor/src/main.tsx index 8a57a39d8..892320cd2 100644 --- a/buildtime/client/material-editor/src/main.tsx +++ b/buildtime/client/material-editor/src/main.tsx @@ -4,9 +4,13 @@ import { createRoot } from 'react-dom/client' import '@fontsource-variable/inter/wght.css'; import './index.css' import App from './App.tsx' +import keycloak from './keycloak.ts'; + +keycloak.init({ onLoad: 'login-required' }).then(() => { + createRoot(document.getElementById('root')!).render( + + + , + ) +}); -createRoot(document.getElementById('root')!).render( - - - , -) diff --git a/buildtime/client/material-editor/src/pages/HomePage.tsx b/buildtime/client/material-editor/src/pages/HomePage.tsx index 650671374..469422a9a 100644 --- a/buildtime/client/material-editor/src/pages/HomePage.tsx +++ b/buildtime/client/material-editor/src/pages/HomePage.tsx @@ -1,12 +1,14 @@ import React from 'react'; +import keycloak from '../keycloak'; const HomePage: React.FC = () => { return (

Welcome to the Home Page

This is the main landing page of the application.

+

Angemeldet als: {keycloak.tokenParsed?.preferred_username}

); }; - + export default HomePage;