Пример #1
0
  @Test
  public void testUser() {
    User user = new User();
    user.setUserName("MyName1");
    user.setEmail("*****@*****.**");
    user.setCreatedUser(getUser("user"));
    user.setCreatedDate(new Date());
    user.setUserId("hello");
    user.setRole(Role.USER);
    user = userRepository.save(user);
    User user2 = new User();
    user2.setUserId("hello2");
    user2.setUserName("MyName2");
    user2.setEmail("*****@*****.**");
    user2.setCreatedUser(getUser("user"));
    user2.setCreatedDate(new Date());
    user2.setRole(Role.USER);
    userRepository.save(user2);

    assertThat(userRepository.count(), is(2L));

    assertThat(userRepository.findAll(UserSpecification.emailLike("gmail")).size(), is(1));

    assertThat(
        userRepository
            .findAll(
                Specifications.where(UserSpecification.emailLike("@paran"))
                    .and(UserSpecification.nameLike("MyName2")))
            .size(),
        is(1));
  }
 @Override
 public User loadUser(final String userId) {
   Map<String, String> map = SiteMinderFilter.threadStorage.get();
   User user = null;
   if (map != null) {
     user = new User();
     user.setUserId(userId);
     user.setUserName(getString(map, "name", ""));
     user.setEmail(getString(map, "email", ""));
     user.setMobilePhone(getString(map, "cellphone", ""));
     user.setAuthProviderClass(SiteminderSSOPlugin.this.getClass().getName());
     user.setEnabled(true);
     user.setExternal(true);
     user.setRole(Role.USER);
     SiteMinderFilter.threadStorage.remove();
   }
   return user;
 }