use of org.usermanagement.dao.entity.StatusEntity in project open-kilda by telstra.
the class UserService method createSamlUser.
/**
* Creates the saml user.
* @param username the username
* @param roles the user roles
*/
public void createSamlUser(String username, Set<RoleEntity> roles) {
UserEntity userEntity = new UserEntity();
userEntity.setUsername(username);
userEntity.setEmail(username);
userEntity.setName(username);
userEntity.setRoles(roles);
userEntity.setActiveFlag(true);
userEntity.setLoginTime(new Timestamp(System.currentTimeMillis()));
userEntity.setLogoutTime(new Timestamp(System.currentTimeMillis()));
userEntity.setIsAuthorized(true);
userEntity.setIs2FaEnabled(false);
userEntity.setIs2FaConfigured(false);
StatusEntity statusEntity = Status.ACTIVE.getStatusEntity();
userEntity.setStatusEntity(statusEntity);
String password = ValidatorUtil.randomAlphaNumeric(16);
userEntity.setPassword(StringUtil.encodeString(password));
userRepository.save(userEntity);
}
Aggregations