Skip to content

Commit

Permalink
Merge pull request #896 from PasinduYeshan/password-expiry-time-patch2
Browse files Browse the repository at this point in the history
Exclude groups without IDs when retrieving roles associated with groups
  • Loading branch information
PasinduYeshan authored Dec 16, 2024
2 parents f244f5c + aea0643 commit 6516a19
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 6516a19

Please sign in to comment.