code: private static void tokenToAuthCookie(
        HttpServletResponse resp,
        String token,
        String domain,
        String path,
        long expires,
        boolean isCookiePersistent,
        boolean isSecure
    )
    {
      resp.addHeader("Set-Cookie", tokenToCookieString(token, domain, path, expires, isCookiePersistent, isSecure));
    }
docs: Creates the Hadoop authentication HTTP cookie.
  
  @param resp the response object.
  @param token authentication token for the cookie.
  @param domain the cookie domain.
  @param path the cookie path.
  @param expires UNIX timestamp that indicates the expire date of the
  cookie. It has no effect if its value &lt; 0.
  @param isSecure is the cookie secure?
  @param isCookiePersistent whether the cookie is persistent or not.
  the following code copy/past from Hadoop 3.0.0 copied to avoid compilation issue due to new signature,
  org.apache.hadoop.security.authentication.server.AuthenticationFilter#createAuthCookie
  (
  javax.servlet.http.HttpServletResponse,
  java.lang.String,
  java.lang.String,
  java.lang.String,
  long, boolean, boolean)