commit | 21b0036759f97dae3cf7c2b9dbd084851467de2e | [log] [tgz] |
---|---|---|
author | Simon Reis <simon.reis@pta.de> | Mon Sep 07 18:39:13 2020 +0200 |
committer | Simon Reis <simon.reis@pta.de> | Mon Sep 07 18:39:13 2020 +0200 |
tree | 068b5c08d90c302934a993e63cd196819b795e13 | |
parent | 0e2c8e160d807b35982c5fe9a48a4457d2ff556d [diff] |
SI-2183-Keycloak-Client-Rollen
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/auth/JwtAuthenticationTokenFilter.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/auth/JwtAuthenticationTokenFilter.java index ff3cd1e..178ffe6 100644 --- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/auth/JwtAuthenticationTokenFilter.java +++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/config/auth/JwtAuthenticationTokenFilter.java
@@ -85,7 +85,9 @@ token.getResourceAccess().forEach((client, access) -> allRoles.addAll(access.getRoles())); //Realmroles - allRoles.addAll(token.getRealmAccess().getRoles()); + if (token.getRealmAccess() != null) { + allRoles.addAll(token.getRealmAccess().getRoles()); + } List<GrantedAuthority> authorities= new ArrayList<>(); allRoles.forEach( x -> authorities.add(new SimpleGrantedAuthority("ROLE_"+x.toUpperCase())));