@@ -89,18 +89,22 @@ public ResponseEntity<List<Map<String, String>>> getGroupMemberships(@PathVariab
8989 .anyMatch (application -> application .getManageId ().equals (provider .get (ID ))))
9090 .filter (userRole -> userRole .getAuthority ().equals (Authority .GUEST ) || userRole .isGuestRoleIncluded ())
9191 .map (this ::parseUserRole )
92+ //Nees to be mutable
9293 .collect (Collectors .toCollection (ArrayList ::new ));
9394
94- List <Map <String , String >> autorisatieRoles = userRoleList .stream ().filter (m -> m .containsKey (AUTORISATIE )).toList ();
95+ List <Map <String , String >> autorisatieRoles = userRoleList .stream ()
96+ .filter (m -> m .containsKey (AUTORISATIE ))
97+ .toList ();
9598 if (!autorisatieRoles .isEmpty ()) {
96- Role role = user .getUserRoles ().stream ()
99+ user .getUserRoles ().stream ()
97100 .map (userRole -> userRole .getRole ())
98- .filter (r -> StringUtils . hasText ( r . getCrmRoleId ()) )
101+ .filter (r -> r . getOrganisation () != null )
99102 .findFirst ()
100- .orElseThrow (() -> new IllegalArgumentException ("Won't happen" ));
101- Organisation organisation = role .getOrganisation ();
102- userRoleList .add (Map .of (AUTORISATIE , "urn:mace:surfnet.nl:surfnet.nl:sab:organizationCode:" + organisation .getCrmOrganisationAbbrevation ()));
103- userRoleList .add (Map .of (AUTORISATIE , "urn:mace:surfnet.nl:surfnet.nl:sab:organizationGUID:" + organisation .getCrmOrganisationId ()));
103+ .ifPresent (role -> {
104+ Organisation organisation = role .getOrganisation ();
105+ userRoleList .add (Map .of (AUTORISATIE , "urn:mace:surfnet.nl:surfnet.nl:sab:organizationCode:" + organisation .getCrmOrganisationAbbrevation ()));
106+ userRoleList .add (Map .of (AUTORISATIE , "urn:mace:surfnet.nl:surfnet.nl:sab:organizationGUID:" + organisation .getCrmOrganisationId ()));
107+ });
104108 }
105109 LOG .debug (String .format ("Returning %o roles for AA request for user: %s and service %s" , userRoleList .size (), unspecifiedId , spEntityId ));
106110
0 commit comments