session correction sidebar items 4

This commit is contained in:
alma 2025-04-18 14:41:11 +02:00
parent 932ee9f94c
commit 1440eae3a2

View File

@ -93,8 +93,12 @@ export const authOptions: NextAuthOptions = {
profile
});
// Get roles from the token claims
const roles = profile.roles || [];
console.log('Raw roles from Keycloak:', roles);
// Clean up roles by removing ROLE_ prefix and converting to lowercase
const cleanRoles = (profile.roles ?? []).map(role =>
const cleanRoles = roles.map(role =>
role.replace(/^ROLE_/, '').toLowerCase()
);