diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index d08d9bd..05c90f5 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -32,7 +32,7 @@ - +

Page not found

diff --git a/frontend/src/Components/Login.svelte b/frontend/src/Components/Login.svelte index ce8b999..db333fe 100644 --- a/frontend/src/Components/Login.svelte +++ b/frontend/src/Components/Login.svelte @@ -4,6 +4,7 @@ import { checkUser, tryLogin } from '../user.svelte.js'; let credentials = { username : null, password : null } + let services = $state([]); function doLogin(ev){ tryLogin(credentials); @@ -15,7 +16,26 @@ onMount(async () => { await checkUser(); + const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/buttons`; + const resp = await fetch(url,{credentials:'include'}); + if (resp.ok){ + const json = await resp.json(); + for (let service of json) services.push(service); + } }); + + async function redirectTo(service){ + const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/oidc/redirect/${service}`; + const resp = await fetch(url,{credentials:'include'}); + if (resp.ok){ + var json = await resp.json(); + if (json.authorization_endpoint) { + var endpoint = json.authorization_endpoint; + delete json.authorization_endpoint; + location.href = endpoint + '?' + new URLSearchParams(json); + } + } + }