fix(security): update roles claim for granted authorities
This commit is contained in:
parent
8e7b0770de
commit
993387fa0c
@ -84,8 +84,8 @@ class KeycloakSecurityConfig {
|
|||||||
List<GrantedAuthority> grantedAuthorities = new ArrayList<>();
|
List<GrantedAuthority> grantedAuthorities = new ArrayList<>();
|
||||||
|
|
||||||
Map<String, Object> realmAccess = jwt.getClaim(REALM_ACCESS_CLAIM);
|
Map<String, Object> realmAccess = jwt.getClaim(REALM_ACCESS_CLAIM);
|
||||||
if (realmAccess != null && realmAccess.containsKey("roles")) {
|
if (realmAccess != null && realmAccess.containsKey(ROLES_CLAIM)) {
|
||||||
List<String> roles = (List<String>) realmAccess.get("roles");
|
List<String> roles = (List<String>) realmAccess.get(ROLES_CLAIM);
|
||||||
for (String role : roles) {
|
for (String role : roles) {
|
||||||
grantedAuthorities.add(new SimpleGrantedAuthority("ROLE_" + role));
|
grantedAuthorities.add(new SimpleGrantedAuthority("ROLE_" + role));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user