for (final Group group : groups) {
List<Authority> groupAuths = getAuthorities(group);
for (final Authority groupAuth : groupAuths) {
if (authorities.containsKey(groupAuth.getResource())) {
Authority existed = authorities.get(groupAuth.getResource());
existed.merge(groupAuth);
} else {
authorities.put(groupAuth.getResource(), groupAuth);
}
}
}