Skip to content

Commit

Permalink
[2.x] Avoid ConcurrentModificationException for User class fields (#5084
Browse files Browse the repository at this point in the history
)

Signed-off-by: shikharj05 <[email protected]>
  • Loading branch information
shikharj05 authored Feb 4, 2025
1 parent 443c59c commit 05e56ec
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,10 @@ private Set<String> map(final User user, final TransportAddress caller) {
return Collections.emptySet();
}

final Set<String> securityRoles = new HashSet<>(user.getSecurityRoles());
final Set<String> securityRoles = new HashSet<>();
synchronized (user.getSecurityRoles()) {
securityRoles.addAll(user.getSecurityRoles());
}

if (rolesMappingResolution == ConfigConstants.RolesMappingResolution.BOTH
|| rolesMappingResolution == ConfigConstants.RolesMappingResolution.BACKENDROLES_ONLY) {
Expand Down

0 comments on commit 05e56ec

Please sign in to comment.