private boolean hasJWT(HttpServletRequest request) {
    String authHeaderString;
    try {
      authHeaderString = httpAuthService.getAuthHeader(request);
    } catch (HttpAuthenticationException e) {
      return false;
    }
    // Assume JWT consists of three parts separated by dots
    String[] jwt = authHeaderString.split("\\.");
    return jwt.length == 3;
  }
Do the GSS-API kerberos authentication.
We already have a logged in subject in the form of serviceUGI,
which GSS-API will extract information from.
In case of a SPNego request we use the httpUGI,
for the authenticating service tickets.
@param request Request to act on
@return client principal name
@throws HttpAuthenticationException on error authenticating the user
service/src/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java