use of com.autentia.tnt.businessobject.User in project TNTConcept by autentia.
the class ReportBean method getUsers.
public ArrayList<SelectItem> getUsers() {
ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
List<User> refs = userDAO.search(new SortCriteria("name"));
for (User ref : refs) {
ret.add(new SelectItem(ref.getId().toString(), ref.getName()));
}
return ret;
}
use of com.autentia.tnt.businessobject.User in project TNTConcept by autentia.
the class SpringUtilsForTesting method createUser.
public static User createUser(String login) {
final User user = new User();
user.setLogin(login);
user.setPassword(login);
user.setName(login);
user.setRole(createRoleInContext());
user.setDepartment(createDepartmentInContext());
user.setCategory(createUserCategoryInContext());
user.setAgreement(createAgreementInContext());
user.setActive(true);
user.setStartDate(new java.util.Date());
return user;
}
use of com.autentia.tnt.businessobject.User in project TNTConcept by autentia.
the class LdapCustomAuthenticationProviderTest method shouldCallLoadUserFromServiceWhenCreateUserDetailsIsCalled.
@Test
public void shouldCallLoadUserFromServiceWhenCreateUserDetailsIsCalled() {
User user = getUserForTest();
Principal principal = mock(Principal.class);
when(userDetailsService.loadUserByUsername(USERNAME)).thenReturn(principal);
when(principal.getUser()).thenReturn(user);
when(principal.getAuthorities()).thenReturn(new GrantedAuthority[1]);
when(ldapUserDetails.getAttributes()).thenReturn(mock(Attributes.class));
sut.createUserDetails(ldapUserDetails, USERNAME, PASSWORD);
verify(userDetailsService).loadUserByUsername(USERNAME);
verify(ldapUserDetails).isEnabled();
}
use of com.autentia.tnt.businessobject.User in project TNTConcept by autentia.
the class LdapCustomAuthenticationProviderTest method shouldSetExpiredPasswordWhenPwdGraceUseTimeIsActive.
@Test
public void shouldSetExpiredPasswordWhenPwdGraceUseTimeIsActive() {
Attribute pwdGraceUseTime = new BasicAttribute("pwdGraceUseTime");
Attributes attributes = new BasicAttributes();
attributes.put(pwdGraceUseTime);
when(ldapUserDetails.getAttributes()).thenReturn(attributes);
User userForTest = getUserForTest();
Boolean passExpired = sut.checkExpiredPassword(ldapUserDetails.getAttributes());
userForTest.setPasswordExpired(passExpired);
assertThat(passExpired, is(true));
}
use of com.autentia.tnt.businessobject.User in project TNTConcept by autentia.
the class LdapCustomAuthenticationProviderTest method getUserForTest.
private User getUserForTest() {
Role role = mock(Role.class);
when(role.getId()).thenReturn(1);
User user = mock(User.class);
when(user.getId()).thenReturn(1);
when(user.getDepartmentId()).thenReturn(1);
when(user.getLogin()).thenReturn("login");
when(user.getLdapPassword()).thenReturn("ldapPassword");
when(user.isActive()).thenReturn(true);
when(user.getName()).thenReturn("name");
when(user.getRole()).thenReturn(role);
return user;
}
Aggregations