public String getUsername(HttpServletRequest request) throws HttpAuthenticationException {
    // If the request contains username parameter, return its value
    String usernameParam = request.getParameter(USERNAME_REQUEST_PARAM_NAME);
    if (usernameParam != null && !usernameParam.isEmpty()) {
      return usernameParam;
    }
    // If the request contains username parameter, return its value
    String authHeaderDecodedString = getAuthHeaderDecodedString(request);
    String[] credentials = authHeaderDecodedString.split(":", 2);
    if (credentials[0] == null || credentials[0].isEmpty()) {
      throw new HttpAuthenticationException("Authorization header received from the client does not contain username.");
    }
    return credentials[0];
  }
Retrieves username from http request
@param request The HTTP Servlet Request send by the client
@return String containing username
service/src/java/org/apache/hive/service/auth/HttpAuthService.java