use of org.cloudfoundry.identity.uaa.scim.ScimGroup in project uaa by cloudfoundry.
the class ScimGroupEndpointsTests method addGroup.
private String addGroup(String name, List<ScimGroupMember> m) {
ScimGroup g = new ScimGroup(null, name, identityZoneManager.getCurrentIdentityZoneId());
g = jdbcScimGroupProvisioning.create(g, identityZoneManager.getCurrentIdentityZoneId());
for (ScimGroupMember member : m) {
jdbcScimGroupMembershipManager.addMember(g.getId(), member, identityZoneManager.getCurrentIdentityZoneId());
}
return g.getId();
}
use of org.cloudfoundry.identity.uaa.scim.ScimGroup in project uaa by cloudfoundry.
the class ScimGroupEndpointsTests method createGroupWithInvalidMemberFails.
@Test
void createGroupWithInvalidMemberFails() {
ScimGroup g = new ScimGroup(null, "clients.read", identityZoneManager.getCurrentIdentityZoneId());
g.setMembers(Collections.singletonList(new ScimGroupMember("non-existent id", ScimGroupMember.Type.USER)));
try {
scimGroupEndpoints.createGroup(g, new MockHttpServletResponse());
fail("must have thrown exception");
} catch (InvalidScimResourceException ex) {
// ensure that the group was not created
validateSearchResults(scimGroupEndpoints.listGroups("id", "displayName eq \"clients.read\"", "id", "ASC", 1, 100), 0);
}
}
use of org.cloudfoundry.identity.uaa.scim.ScimGroup in project uaa by cloudfoundry.
the class ScimGroupEndpointsTests method getGroup.
@Test
void getGroup() {
MockHttpServletResponse httpServletResponse = new MockHttpServletResponse();
ScimGroup g = scimGroupEndpoints.getGroup(groupIds.get(groupIds.size() - 1), httpServletResponse);
validateGroup(g, "uaa.none", 2);
assertEquals("\"0\"", httpServletResponse.getHeader("ETag"));
}
use of org.cloudfoundry.identity.uaa.scim.ScimGroup in project uaa by cloudfoundry.
the class ScimGroupEndpointsTests method deleteGroupRemovesMembershipsInZone.
@Test
void deleteGroupRemovesMembershipsInZone() {
IdentityZone zone = MultitenancyFixture.identityZone("test-zone-id", "test");
zone.getConfig().getUserConfig().setDefaultGroups(emptyList());
identityZoneManager.setCurrentIdentityZone(zone);
ScimGroup group = new ScimGroup(null, "clients.read", identityZoneManager.getCurrentIdentityZoneId());
ScimGroupMember member = createMember(ScimGroupMember.Type.GROUP);
group.setMembers(Collections.singletonList(member));
group = scimGroupEndpoints.createGroup(group, new MockHttpServletResponse());
scimGroupEndpoints.deleteGroup(member.getMemberId(), "*", new MockHttpServletResponse());
List<ScimGroupMember> members = scimGroupEndpoints.listGroupMemberships(group.getId(), true, "").getBody();
assertEquals(0, members.size());
}
use of org.cloudfoundry.identity.uaa.scim.ScimGroup in project uaa by cloudfoundry.
the class ScimUserEndpointsTests method groupsIsSyncedCorrectlyOnGet.
@Test
void groupsIsSyncedCorrectlyOnGet() {
ScimUser user = new ScimUser(null, "dave", "David", "Syer");
user.setPassword("password");
user.addEmail("dsyer@vmware.com");
ScimUser created = scimUserEndpoints.createUser(user, new MockHttpServletRequest(), new MockHttpServletResponse());
validateUserGroups(created, "uaa.user");
ScimGroup g = new ScimGroup(null, "test1", identityZone.getId());
g.setMembers(Collections.singletonList(new ScimGroupMember(created.getId())));
scimGroupEndpoints.createGroup(g, new MockHttpServletResponse());
validateUserGroups(scimUserEndpoints.getUser(created.getId(), new MockHttpServletResponse()), "test1");
}
Aggregations