@Test
  public void testGroupNameFiltering() throws Exception {
    setupIDP(true, USER_PASS_MODE, Arrays.asList("group1"), null);
    try (TestHiveConnection connection = new TestHiveConnection(
        getSamlJdbcConnectionUrl(), new Properties(), USER1, USER1_PASSWORD)) {
      assertLoggedInUser(connection, USER1);
    }
    try (TestHiveConnection connection = new TestHiveConnection(
        getSamlJdbcConnectionUrl(), new Properties(), USER3, USER3_PASSWORD)) {
      assertLoggedInUser(connection, USER3);
    }
    //user2 does not belong to group1 and hence should not be allowed.
    Exception e1 = null;
    try (TestHiveConnection connection = new TestHiveConnection(
        getSamlJdbcConnectionUrl(), new Properties(), USER2, USER2_PASSWORD)) {
      fail(USER2 +" does not belong to group1 but could still log in.");
    } catch (SQLException e) {
      e1 = e;
    }
    assertNotNull("Exception was expected but was not received", e1);
  }
Test exercises group name filtering for users. Only users who belong for a given
groups should be able to log in. user1 belongs to group1, user2 to group2 and user3
to group1 and group2.
itests/hive-unit/src/test/java/org/apache/hive/service/auth/saml/TestHttpSamlAuthentication.java