Package org.apache.ambari.server.orm.entities

Examples of org.apache.ambari.server.orm.entities.UserEntity


    authentication =
        new UsernamePasswordAuthenticationToken("allowedAdmin", "password");
    Authentication result = authenticationProvider.authenticate(authentication);
    assertTrue(result.isAuthenticated());

    UserEntity allowedAdminEntity = userDAO.findLdapUserByName("allowedAdmin");

    authentication =
        new UsernamePasswordAuthenticationToken("allowedUser", "password");
    authenticationProvider.authenticate(authentication);
    UserEntity allowedUserEntity = userDAO.findLdapUserByName("allowedUser");


    RoleEntity adminRole = roleDAO.findByName(
        configuration.getConfigsMap().get(Configuration.ADMIN_ROLE_NAME_KEY));
    RoleEntity userRole = roleDAO.findByName(
        configuration.getConfigsMap().get(Configuration.USER_ROLE_NAME_KEY));


    assertTrue(allowedAdminEntity.getRoleEntities().contains(userRole));
    assertTrue(allowedAdminEntity.getRoleEntities().contains(adminRole));

    assertTrue(allowedUserEntity.getRoleEntities().contains(userRole));
    assertFalse(allowedUserEntity.getRoleEntities().contains(adminRole));


  }
View Full Code Here


    userDetailsService.loadUserByUsername("notExists_123123123");
  }

  @Test(expected = UsernameNotFoundException.class)
  public void testEmptyRoles() throws Exception {
    UserEntity user = userDAO.findLocalUserByName("userWithoutRoles");
    userDetailsService.loadUserByUsername(user.getUserName());
  }
View Full Code Here

    populator.createLdapUser(username);

    verifyAll();

    UserEntity capturedCreateEntity = createEntity.getValue();
    UserEntity capturedAddRoleEntity = addRoleEntity.getValue();

    assertTrue(capturedCreateEntity.getLdapUser());
    assertEquals(username, capturedCreateEntity.getUserName());

    assertEquals(capturedCreateEntity,capturedAddRoleEntity);
View Full Code Here

    authentication =
        new UsernamePasswordAuthenticationToken("allowedAdmin", "password");
    Authentication result = authenticationProvider.authenticate(authentication);
    assertTrue(result.isAuthenticated());

    UserEntity allowedAdminEntity = userDAO.findLdapUserByName("allowedAdmin");

    authentication =
        new UsernamePasswordAuthenticationToken("the allowedUser", "password");
    authenticationProvider.authenticate(authentication);
    UserEntity allowedUserEntity = userDAO.findLdapUserByName("the allowedUser");


    RoleEntity adminRole = roleDAO.findByName(
        configuration.getConfigsMap().get(Configuration.ADMIN_ROLE_NAME_KEY));
    RoleEntity userRole = roleDAO.findByName(
        configuration.getConfigsMap().get(Configuration.USER_ROLE_NAME_KEY));


    assertTrue(allowedAdminEntity.getRoleEntities().contains(userRole));
    assertTrue(allowedAdminEntity.getRoleEntities().contains(adminRole));

    assertTrue(allowedUserEntity.getRoleEntities().contains(userRole));
    assertFalse(allowedUserEntity.getRoleEntities().contains(adminRole));


  }
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.orm.entities.UserEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.