Java Code Examples for com.haulmont.cuba.security.entity.User#setPassword()
The following examples show how to use
com.haulmont.cuba.security.entity.User#setPassword() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestUserSessionSource.java From cuba with Apache License 2.0 | 6 votes |
@Override public synchronized UserSession getUserSession() { if (exceptionOnGetUserSession) { throw new NoUserSessionException(UUID.fromString(USER_ID)); } if (session == null) { User user = new User(); user.setId(UUID.fromString(USER_ID)); user.setLogin("test_admin"); user.setName("Test Administrator"); user.setPassword(DigestUtils.md5Hex("test_admin")); session = new UserSession(UUID.randomUUID(), user, Collections.emptyList(), Locale.forLanguageTag("en"), false); session.setJoinedRole(new TestFullAccessRole()); } return session; }
Example 2
Source File: EntityManagerTest.java From cuba with Apache License 2.0 | 6 votes |
@Test public void testMerge() throws Exception { UUID newUserId = UUID.randomUUID(); Transaction tx = cont.persistence().createTransaction(); try { EntityManager em = cont.persistence().getEntityManager(); User user = new User(); user.setId(newUserId); user.setName("testMerge"); user.setLogin("testMerge"); user.setPassword("testMerge"); user.setGroup(em.getReference(Group.class, groupId)); user = em.merge(user); User userFromPersistentContext = em.find(User.class, newUserId); assertEquals(user, userFromPersistentContext); tx.commit(); } finally { tx.end(); cont.deleteRecord("SEC_USER", newUserId); } }
Example 3
Source File: TestUserSessionSource.java From cuba with Apache License 2.0 | 5 votes |
public User createTestUser() { User user = new User(); user.setId(UUID.fromString(USER_ID)); user.setLogin("test_admin"); user.setName("Test Administrator"); user.setPassword(DigestUtils.md5Hex("test_admin")); return user; }
Example 4
Source File: TestUiEnvironment.java From cuba with Apache License 2.0 | 5 votes |
protected User createUser() { User user = container.getBean(Metadata.class).create(User.class); user.setId(UUID.fromString(USER_ID)); user.setLogin(userLogin); user.setName(userName); user.setPassword(DigestUtils.md5Hex(userLogin)); return user; }
Example 5
Source File: LoginTest.java From cuba with Apache License 2.0 | 5 votes |
@BeforeEach public void setUp() throws Exception { PasswordEncryption passwordEncryption = AppBeans.get(PasswordEncryption.NAME); authenticationManager = AppBeans.get(AuthenticationManager.NAME); userSessionSource = AppBeans.get(UserSessionSource.NAME); standardTestUserSession = userSessionSource.getUserSession(); Transaction tx = cont.persistence().createTransaction(); try { EntityManager em = cont.persistence().getEntityManager(); Group group = em.getReference(Group.class, UUID.fromString("0fa2b1a5-1d68-4d69-9fbd-dff348347f93")); User user1 = new User(); user1Id = user1.getId(); user1.setGroup(group); user1.setLogin("user1"); user1.setPassword(passwordEncryption.getPasswordHash(user1.getId(), "1")); em.persist(user1); User user2 = new User(); user2Id = user2.getId(); user2.setGroup(group); user2.setLogin("user2"); user2.setPassword(passwordEncryption.getPasswordHash(user2.getId(), "2")); em.persist(user2); tx.commit(); } finally { tx.end(); } }
Example 6
Source File: PersistenceAttributeLoadedCheckTest.java From cuba with Apache License 2.0 | 5 votes |
@BeforeEach public void setUp() throws Exception { dataManager = AppBeans.get(DataManager.class); persistence = AppBeans.get(Persistence.class); try (Transaction tx = persistence.createTransaction()) { EntityManager em = persistence.getEntityManager(); ScheduledTask task = new ScheduledTask(); task.setBeanName("BeanName"); task.setMethodName("MethodName"); taskId = task.getId(); User user = new User(); userId = user.getId(); user.setName("testUser"); user.setLogin("login" + userId); user.setPassword("000"); user.setGroup(em.find(Group.class, groupId)); em.persist(user); em.persist(task); em.persist(user); tx.commit(); } taskView = new View(ScheduledTask.class, true) .addProperty("beanName"); userView = new View(User.class, true) .addProperty("login") .addProperty("loginLowerCase") .addProperty("name") .addProperty("password") .addProperty("group", new View(Group.class).addProperty("name")) .addProperty("userRoles", new View(UserRole.class)); }
Example 7
Source File: DataManagerCommitTest.java From cuba with Apache License 2.0 | 5 votes |
@BeforeEach public void setUp() throws Exception { dataManager = AppBeans.get(DataManager.class); try (Transaction tx = cont.persistence().createTransaction()) { EntityManager em = cont.persistence().getEntityManager(); Group group = em.find(Group.class, groupId); User user = new User(); userId = user.getId(); user.setName("testUser"); user.setLogin("login" + userId); user.setPassword("000"); user.setGroup(group); em.persist(user); UserRole userRole = new UserRole(); userRoleId = userRole.getId(); userRole.setRoleName("test-role"); userRole.setUser(user); em.persist(userRole); tx.commit(); } view = new View(User.class, true) .addProperty("login") .addProperty("loginLowerCase") .addProperty("name") .addProperty("password") .addProperty("group", new View(Group.class).addProperty("name")) .addProperty("userRoles", new View(UserRole.class)); }