Skip to content

Commit

Permalink
Prioritize groups path over groups claim
Browse files Browse the repository at this point in the history
Potentially existing group claims will be overwritten by the
claim specified in `smallrye.jwt.path.groups`.

Signed-off-by: Lukas Ziefle <[email protected]>
  • Loading branch information
oemel09 committed Feb 29, 2024
1 parent 811160f commit 3308b38
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public static void setClaims(JwtClaims claimsSet, String token, JWTAuthContextIn
claimsSet.setClaim(Claims.sub.name(), sub);
}
Object groupsClaim = claimsSet.getClaimValue(Claims.groups.name());
if (groupsClaim == null || groupsClaim instanceof Map) {
if (groupsClaim == null || groupsClaim instanceof Map
|| authContextInfo.getGroupsPath() != null) { // specified groups path takes precedence over existing groups and replaces them
List<String> groups = findGroups(authContextInfo, claimsSet);
claimsSet.setClaim(Claims.groups.name(), groups);
} else if (groupsClaim instanceof String) {
Expand Down

0 comments on commit 3308b38

Please sign in to comment.