@VisibleForTesting
  public boolean isAuthTypeEnabled(HttpServletRequest request,
      HiveAuthConstants.AuthTypes authType) {

    if (hasAuthScheme(request, HttpAuthUtils.BASIC) && this.authType.isPasswordBasedAuth(authType)
        && this.authType.isEnabled(authType)) {
      // The "Authorization: Basic" scheme indicates password-based authentication.
      return true;
    }
    if (this.authType.isEnabled(HiveAuthConstants.AuthTypes.KERBEROS) &&
       authType == HiveAuthConstants.AuthTypes.KERBEROS &&
       (StringUtils.isNotEmpty(request.getHeader(HIVE_DELEGATION_TOKEN_HEADER)) ||
       hasAuthScheme(request, HttpAuthUtils.NEGOTIATE))) {
      // Hive delegation token or "Authorization: Negotiate" scheme indicates Kerberos
      // authentication.
      return true;
    }
    if (this.authType.isEnabled(HiveAuthConstants.AuthTypes.SAML) &&
        authType == HiveAuthConstants.AuthTypes.SAML &&
        (StringUtils.isNotEmpty(request.getHeader(HiveSamlUtils.SSO_TOKEN_RESPONSE_PORT)) ||
        hasAuthScheme(request, HttpAuthUtils.BEARER) && !hasJWT(request))) {
      // X-Hive-Token-Response-Port header or "Authorization: Bearer <SAML TOKEN>" scheme
      // indicates SAML authentication.
      return true;
    }
    if (this.authType.isEnabled(HiveAuthConstants.AuthTypes.JWT) &&
        authType == HiveAuthConstants.AuthTypes.JWT &&
        hasAuthScheme(request, HttpAuthUtils.BEARER) && hasJWT(request)) {
      // The "Authorization: Bearer <any.JWT.token>" scheme indicates JWT authentication.
      return true;
    }
    return false;
  }
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