@Test(expected = SQLException.class)
  public void testTokenReuse() throws Exception {
    setupIDP(true, USER_PASS_MODE, null, null);
    String token = null;
    try (HiveConnection connection = new TestHiveConnection(getSamlJdbcConnectionUrl(),
        new Properties(), USER1, USER1_PASSWORD)) {
      token = connection.getBrowserClient().getServerResponse().getToken();
    }
    assertNotNull(token);
    //inject the token using http.header url param
    String bearerToken = "Bearer%20" + token;
    String jdbcUrl =
        getSamlJdbcConnectionUrl(10) + ";http.header.Authorization=" + bearerToken;
    try (HiveConnection connection = new HiveConnection(jdbcUrl, new Properties())) {
      fail("User should not be able to login just using the token");
    }
  }
Test make sure that a token which is issued for a different connection cannot be
reused.
itests/hive-unit/src/test/java/org/apache/hive/service/auth/saml/TestHttpSamlAuthentication.java