diff --git a/src/testcase/twitter/OAuthHeader.java b/src/testcase/twitter/OAuthHeader.java index 15c8316..3ad945d 100644 --- a/src/testcase/twitter/OAuthHeader.java +++ b/src/testcase/twitter/OAuthHeader.java @@ -55,6 +55,11 @@ } public void generateSignature(){ + params.put("oauth_consumer_key", consumer_key); + params.put("oauth_signature_method", "HMAC-SHA1"); + params.put("oauth_timestamp", String.valueOf(getUnixTime())); + params.put("oauth_nonce", String.valueOf(Math.random())); + params.put("oauth_version", "1.0"); String paramStr = ""; for (Entry param : params.entrySet()) { paramStr += "&" + param.getKey() + "=" + param.getValue(); @@ -93,7 +98,13 @@ } public String getAuthorization() { - return ""; + String paramStr = ""; + for (Entry param : params.entrySet()) { + paramStr += ", " + param.getKey() + "=\"" + + urlEncode(param.getValue()) + "\""; + } + paramStr = paramStr.substring(2); + return "OAuth " + paramStr; } private int getUnixTime() {