Skip to content

Commit

Permalink
Merge pull request #614 from JeethJJ/master-24083
Browse files Browse the repository at this point in the history
AssociatedRolesConfig null check is only required when getting list of roles
  • Loading branch information
JeethJJ authored May 17, 2024
2 parents 01ee988 + bc8a9a2 commit ed8d783
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ public void apply(ServiceProvider serviceProvider, AssociatedRolesConfig associa

org.wso2.carbon.identity.application.common.model.AssociatedRolesConfig rolesConfig =
new org.wso2.carbon.identity.application.common.model.AssociatedRolesConfig();
if (associatedRolesConfig != null && associatedRolesConfig.getRoles() != null) {
if (associatedRolesConfig != null) {
rolesConfig.setAllowedAudience(associatedRolesConfig.getAllowedAudience().toString());
List<org.wso2.carbon.identity.application.common.model.RoleV2> listOfRoles =
associatedRolesConfig.getRoles().stream()
.map(role -> new org.wso2.carbon.identity.application.common.model.RoleV2(role.getId()))
.collect(Collectors.toList());
rolesConfig.setRoles(listOfRoles.toArray(new RoleV2[0]));
if (associatedRolesConfig.getRoles() != null) {
List<org.wso2.carbon.identity.application.common.model.RoleV2> listOfRoles =
associatedRolesConfig.getRoles().stream()
.map(role -> new org.wso2.carbon.identity.application.common.model.RoleV2(role.getId()))
.collect(Collectors.toList());
rolesConfig.setRoles(listOfRoles.toArray(new RoleV2[0]));
}
}
serviceProvider.setAssociatedRolesConfig(rolesConfig);
}
Expand Down

0 comments on commit ed8d783

Please sign in to comment.