keycloak teil 2

This commit is contained in:
2026-08-03 22:42:59 +02:00
parent 0a8fd60c96
commit fd1d0bdda5
3 changed files with 19 additions and 6 deletions
@@ -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;
@@ -4,9 +4,13 @@ import { createRoot } from 'react-dom/client'
import '@fontsource-variable/inter/wght.css'; import '@fontsource-variable/inter/wght.css';
import './index.css' import './index.css'
import App from './App.tsx' 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(
<StrictMode> <StrictMode>
<App /> <App />
</StrictMode>, </StrictMode>,
) )
});
@@ -1,10 +1,12 @@
import React from 'react'; import React from 'react';
import keycloak from '../keycloak';
const HomePage: React.FC = () => { const HomePage: React.FC = () => {
return ( return (
<div> <div>
<h1>Welcome to the Home Page</h1> <h1>Welcome to the Home Page</h1>
<p>This is the main landing page of the application.</p> <p>This is the main landing page of the application.</p>
<p>Angemeldet als: {keycloak.tokenParsed?.preferred_username}</p>
</div> </div>
); );
}; };