Add logout and fixed user specific requirements retrieval

This commit is contained in:
gulimabr
2025-11-30 19:24:06 -03:00
parent eb70598cab
commit 67efbfd317
4 changed files with 148 additions and 27 deletions

View File

@@ -33,7 +33,8 @@ class AuthService {
}
/**
* Logout the current user by clearing the session cookie.
* Logout the current user by clearing the session cookie
* and redirecting to Keycloak logout to end the SSO session.
*/
async logout(): Promise<void> {
try {
@@ -48,6 +49,13 @@ class AuthService {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const data = await response.json()
// Redirect to Keycloak logout URL to end the SSO session
if (data.logout_url) {
window.location.href = data.logout_url
}
} catch (error) {
console.error('Logout failed:', error)
throw error