From 993387fa0c965606986e4cbc3174b84af432c6d7 Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Wed, 2 Oct 2024 09:34:26 +0200 Subject: [PATCH] fix(security): update roles claim for granted authorities --- .../de/szut/lf8_starter/security/KeycloakSecurityConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/szut/lf8_starter/security/KeycloakSecurityConfig.java b/src/main/java/de/szut/lf8_starter/security/KeycloakSecurityConfig.java index c37b0bf..7ff32cc 100644 --- a/src/main/java/de/szut/lf8_starter/security/KeycloakSecurityConfig.java +++ b/src/main/java/de/szut/lf8_starter/security/KeycloakSecurityConfig.java @@ -84,8 +84,8 @@ class KeycloakSecurityConfig { List grantedAuthorities = new ArrayList<>(); Map realmAccess = jwt.getClaim(REALM_ACCESS_CLAIM); - if (realmAccess != null && realmAccess.containsKey("roles")) { - List roles = (List) realmAccess.get("roles"); + if (realmAccess != null && realmAccess.containsKey(ROLES_CLAIM)) { + List roles = (List) realmAccess.get(ROLES_CLAIM); for (String role : roles) { grantedAuthorities.add(new SimpleGrantedAuthority("ROLE_" + role)); }