private Hbase.Client refresh(Hbase.Client client, THttpClient httpClient) {
    httpClient.setCustomHeader("doAs", doAsUser);
    if (secure) {
      try {
        httpClient.setCustomHeader("Authorization", generateTicket());
      } catch (GSSException e) {
        LOG.error("Kerberos authentication failed", e);
      }
    }
    return client;
  }
See the instructions under hbase-examples/README.txt
hbase-examples/src/main/java/org/apache/hadoop/hbase/thrift/HttpDoAsClient.java