private static OAuthHmacSigner createOAuthSigner() {
   OAuthHmacSigner result = new OAuthHmacSigner();
   if (credentials != null) {
     result.tokenSharedSecret = credentials.tokenSecret;
   }
   result.clientSharedSecret = "anonymous";
   return result;
 }
예제 #2
0
 /**
  * Get Authorization
  *
  * @param requestUrl
  * @param requestMethod
  * @param consumerKey
  * @param consumerSecret
  * @param token
  * @param tokenSecret
  * @return
  * @throws GeneralSecurityException
  */
 protected String getAuthorization(
     String requestUrl,
     String requestMethod,
     String consumerKey,
     String consumerSecret,
     String token,
     String tokenSecret)
     throws GeneralSecurityException {
   OAuthParameters result = new OAuthParameters();
   OAuthHmacSigner signer = new OAuthHmacSigner();
   result.signer = signer;
   result.consumerKey = consumerKey;
   result.token = token;
   signer.clientSharedSecret = consumerSecret;
   signer.tokenSharedSecret = tokenSecret;
   result.computeNonce();
   result.computeTimestamp();
   result.computeSignature(requestMethod, new GenericUrl(requestUrl));
   return result.getAuthorizationHeader();
 }