public static String generateToken(String cookie,String url,String method,long currentTimeSecs){
  String data=url + " " + method+ " "+ currentTimeSecs;
  byte[] hmac;
  try {
    hmac=computeSHA1HMac(data,cookie);
  }
 catch (  GeneralSecurityException e) {
    throw new RuntimeException("Security exception - " + e.getMessage());
  }
  return Base64.encodeWebSafe(hmac,true);
}

public static String generateToken ( String cookie , String url , String method , long currentTimeSecs ) { String data = url + " " + method + " " + currentTimeSecs ; byte [ ] hmac ; try { hmac = computeSHA1HMac ( data , cookie ) ; } catch ( GeneralSecurityException e ) { throw new RuntimeException ( "Security exception - " + e . getMessage ( ) ) ; } return Base64 . encodeWebSafe ( hmac , true ) ; }
generates a secure token to be used to protect a url .
