Skip to content

Commit

Permalink
Filter null ids
Browse files Browse the repository at this point in the history
  • Loading branch information
PasinduYeshan committed Jan 9, 2025
1 parent 3ab3936 commit c9d535b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public boolean doPostGetUserClaimValues(String username, String[] claims, String
try {
String userTenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
String domainQualifiedUserName =
((AbstractUserStoreManager) userStoreManager).getUser(
null, username).getDomainQualifiedUsername();
((AbstractUserStoreManager) userStoreManager).getUser(null, username)
.getDomainQualifiedUsername();
Optional<Long> passwordExpiryTime =
PasswordPolicyUtils.getUserPasswordExpiryTime(userTenantDomain, domainQualifiedUserName);
passwordExpiryTime.ifPresent(expiryTime -> claimMap.put(PasswordPolicyConstants.PASSWORD_EXPIRY_TIME_CLAIM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ private static Set<String> getUserAttributes(PasswordExpiryRuleAttributeEnum att
List<String> roleIdsOfGroups = getRoleIdsOfGroups(new ArrayList<>(userGroupIds), tenantDomain);

List<RoleBasicInfo> userRoles = getUserRoles(tenantDomain, userId);
Set<String> userRoleIds =
userRoles.stream().map(RoleBasicInfo::getId).collect(Collectors.toSet());
Set<String> userRoleIds = userRoles.stream().map(RoleBasicInfo::getId).filter(Objects::nonNull)
.collect(Collectors.toSet());
userRoleIds.addAll(roleIdsOfGroups);
fetchedUserAttributes.put(PasswordExpiryRuleAttributeEnum.ROLES, userRoleIds);
break;
Expand Down

0 comments on commit c9d535b

Please sign in to comment.