private boolean hasAuthScheme(HttpServletRequest request, String authScheme) {
    String authHeader = request.getHeader(HttpAuthUtils.AUTHORIZATION);
    if (authHeader == null || authHeader.isEmpty()) {
      return false;
    }

    LOG.debug("HTTP Auth Header [{}]", authHeader);

    String[] parts = authHeader.trim().split(" ");
    if (parts.length < 2) {
      return false;
    }

    return parts[0].equalsIgnoreCase(authScheme.toLowerCase());
  }
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