コード例 #1
0
 @Test
 public void validateOriginAndExternalIDDuringCreateAndUpdate() {
   String origin = "test";
   String externalId = "testId";
   ScimUser user = new ScimUser(null, "*****@*****.**", "Jo", "User");
   user.setOrigin(origin);
   user.setExternalId(externalId);
   user.addEmail("*****@*****.**");
   ScimUser created = db.createUser(user, "j7hyqpassX");
   assertEquals("*****@*****.**", created.getUserName());
   assertNotNull(created.getId());
   assertNotSame(user.getId(), created.getId());
   Map<String, Object> map =
       template.queryForMap("select * from users where id=?", created.getId());
   assertEquals(user.getUserName(), map.get("userName"));
   assertEquals(user.getUserType(), map.get(UaaAuthority.UAA_USER.getUserType()));
   assertNull(created.getGroups());
   assertEquals(origin, created.getOrigin());
   assertEquals(externalId, created.getExternalId());
   String origin2 = "test2";
   String externalId2 = "testId2";
   created.setOrigin(origin2);
   created.setExternalId(externalId2);
   ScimUser updated = db.update(created.getId(), created);
   assertEquals(origin2, updated.getOrigin());
   assertEquals(externalId2, updated.getExternalId());
 }
コード例 #2
0
 @Test
 public void canCreateUserWithoutGivenNameAndFamilyName() {
   ScimUser user = new ScimUser(null, "*****@*****.**", null, null);
   user.addEmail("*****@*****.**");
   ScimUser created = db.createUser(user, "j7hyqpassX");
   assertEquals("*****@*****.**", created.getUserName());
   assertNotNull(created.getId());
   assertNotSame(user.getId(), created.getId());
   Map<String, Object> map =
       template.queryForMap("select * from users where id=?", created.getId());
   assertEquals(user.getUserName(), map.get("userName"));
   assertEquals(user.getUserType(), map.get(UaaAuthority.UAA_USER.getUserType()));
   assertNull(created.getGroups());
 }
コード例 #3
0
 @Test
 public void canCreateUserInOtherIdentityZone() {
   String otherZoneId = "my-zone-id";
   createOtherIdentityZone(otherZoneId);
   String idpId = createOtherIdentityProvider(OriginKeys.UAA, otherZoneId);
   ScimUser user = new ScimUser(null, "*****@*****.**", "Jo", "User");
   user.addEmail("*****@*****.**");
   ScimUser created = db.createUser(user, "j7hyqpassX");
   assertEquals("*****@*****.**", created.getUserName());
   assertNotNull(created.getId());
   assertNotSame(user.getId(), created.getId());
   Map<String, Object> map =
       jdbcTemplate.queryForMap("select * from users where id=?", created.getId());
   assertEquals(user.getUserName(), map.get("userName"));
   assertEquals(user.getUserType(), map.get(UaaAuthority.UAA_USER.getUserType()));
   assertNull(created.getGroups());
   assertEquals(OriginKeys.UAA, created.getOrigin());
   assertEquals("my-zone-id", map.get("identity_zone_id"));
 }
コード例 #4
0
 @Test
 public void canCreateUserInDefaultIdentityZone() {
   ScimUser user = new ScimUser(null, "*****@*****.**", "Jo", "User");
   user.addEmail("*****@*****.**");
   ScimUser created = db.createUser(user, "j7hyqpassX");
   assertEquals("*****@*****.**", created.getUserName());
   assertNotNull(created.getId());
   assertNotSame(user.getId(), created.getId());
   Map<String, Object> map =
       jdbcTemplate.queryForMap("select * from users where id=?", created.getId());
   assertEquals(user.getUserName(), map.get("userName"));
   assertEquals(user.getUserType(), map.get(UaaAuthority.UAA_USER.getUserType()));
   assertNull(created.getGroups());
   assertEquals(OriginKeys.UAA, created.getOrigin());
   assertEquals("uaa", map.get("identity_zone_id"));
   assertNull(user.getPasswordLastModified());
   assertNotNull(created.getPasswordLastModified());
   assertEquals(
       (created.getMeta().getCreated().getTime() / 1000l) * 1000l,
       created.getPasswordLastModified().getTime());
 }