@Override public Collection<AccountGroup> collectGroups(@NotNull AuthenticatedAccount authenticatedAccount) { // Gets the list of LDAP groups from the account Collection<String> ldapGroups = getLdapGroups(authenticatedAccount); // Maps them to the account groups return ldapGroups.stream() .flatMap(ldapGroup -> accountGroupMappingService.getGroups(LDAPExtensionFeature.LDAP_GROUP_MAPPING, ldapGroup).stream()) .collect(Collectors.toList()); }