public String signCookie(String str) {
    if (str == null || str.isEmpty()) {
      throw new IllegalArgumentException("NULL or empty string to sign");
    }
    String signature = getSignature(str);

    LOG.debug("Signature generated for {} is {}", str, signature);
    return str + SIGNATURE + signature;
  }
Sign the cookie given the string token as input.
@param str Input token
@return Signed token that can be used to create a cookie
service/src/java/org/apache/hive/service/CookieSigner.java