public String validateCookie(HttpServletRequest request) throws UnsupportedEncodingException {
    // Find all the valid cookies associated with the request.
    Cookie[] cookies = request.getCookies();
    if (cookies == null) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("No valid cookies associated with the request {}", request);
      }
      return null;
    }
    if (LOG.isDebugEnabled()) {
      LOG.debug("Received cookies: {}", toCookieStr(cookies));
    }
    return getClientNameFromCookie(cookies);
  }
Validate the request cookie. This function iterates over the request cookie headers
and finds a cookie that represents a valid client/server session. If it finds one, it
returns the client name associated with the session. Else, it returns null.
@param request The HTTP Servlet Request send by the client
@return Client Username if the request has valid HS2 cookie, else returns null
@throws UnsupportedEncodingException in case of wrong encoding
service/src/java/org/apache/hive/service/auth/HttpAuthService.java