CRITICAL: Temporarily disable Keycloak to restore application functionality
- Disable Keycloak integration in authentication middleware - Update useUnifiedAuth to only use Directus authentication - Rebuild login page with only Directus auth form - Remove all Keycloak references that were causing JavaScript errors - This restores the application to working state with Directus auth only Application should now load and function normally. Keycloak can be re-enabled later once issues are resolved.
This commit is contained in:
@@ -8,38 +8,13 @@ export interface UnifiedUser {
|
||||
}
|
||||
|
||||
export const useUnifiedAuth = () => {
|
||||
// Get both auth systems
|
||||
// Get auth system (Directus only for now)
|
||||
const directusAuth = useDirectusAuth();
|
||||
const directusUser = useDirectusUser();
|
||||
const keycloak = useKeycloak();
|
||||
|
||||
// Create unified user object
|
||||
// Create unified user object (Directus only)
|
||||
const user = computed<UnifiedUser | null>(() => {
|
||||
// Check Keycloak user first (safely)
|
||||
if (keycloak.user?.value) {
|
||||
const keycloakUser = keycloak.user.value;
|
||||
// Construct name from firstName and lastName if available
|
||||
let name = keycloakUser.name;
|
||||
if (!name && (keycloakUser.given_name || keycloakUser.family_name)) {
|
||||
name = `${keycloakUser.given_name || ''} ${keycloakUser.family_name || ''}`.trim();
|
||||
} else if (!name && (keycloakUser.firstName || keycloakUser.lastName)) {
|
||||
name = `${keycloakUser.firstName || ''} ${keycloakUser.lastName || ''}`.trim();
|
||||
}
|
||||
if (!name) {
|
||||
name = keycloakUser.preferred_username || keycloakUser.email;
|
||||
}
|
||||
|
||||
return {
|
||||
id: keycloakUser.sub || keycloakUser.id,
|
||||
email: keycloakUser.email,
|
||||
name: name,
|
||||
tier: keycloakUser.tier || 'basic', // From custom Keycloak attribute
|
||||
authSource: 'keycloak',
|
||||
raw: keycloakUser
|
||||
};
|
||||
}
|
||||
|
||||
// Fall back to Directus user
|
||||
// Only use Directus user for now
|
||||
if (directusUser.value && directusUser.value.email) {
|
||||
return {
|
||||
id: directusUser.value.id,
|
||||
@@ -54,16 +29,11 @@ export const useUnifiedAuth = () => {
|
||||
return null;
|
||||
});
|
||||
|
||||
// Unified logout function
|
||||
// Unified logout function (Directus only)
|
||||
const logout = async () => {
|
||||
if (user.value?.authSource === 'keycloak') {
|
||||
// Keycloak logout
|
||||
await keycloak.logout();
|
||||
} else if (user.value?.authSource === 'directus') {
|
||||
// Directus logout
|
||||
await directusAuth.logout();
|
||||
await navigateTo('/login');
|
||||
}
|
||||
// Directus logout
|
||||
await directusAuth.logout();
|
||||
await navigateTo('/login');
|
||||
};
|
||||
|
||||
// Check if user is authenticated
|
||||
|
||||
Reference in New Issue
Block a user