Skip to content

Commit

Permalink
Ignore groups without IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
PasinduYeshan committed Dec 16, 2024
1 parent f244f5c commit e818afc
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -463,7 +464,7 @@ private static Set<String> getUserGroupIds(String userId, UserStoreManager userS
List<Group> userGroups =
((AbstractUserStoreManager) userStoreManager).getGroupListOfUser(userId,
null, null);
return userGroups.stream().map(Group::getGroupID).collect(Collectors.toSet());
return userGroups.stream().map(Group::getGroupID).filter(Objects::nonNull) .collect(Collectors.toSet());
} catch (UserStoreException e) {
throw new PostAuthenticationFailedException(PasswordPolicyConstants.ErrorMessages.
ERROR_WHILE_RETRIEVING_USER_GROUPS.getCode(),
Expand Down

0 comments on commit e818afc

Please sign in to comment.