Add logout and fixed user specific requirements retrieval
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user