Package oauth.signpost

Examples of oauth.signpost.OAuthConsumer.sign()


  private byte[] doRequest(HttpRequestBase request, TokenHolder tokenHolder, HttpParameters oauthParams) {
    try {
      OAuthConsumer consumer = tokenHolder.createConsumer();
      consumer.setAdditionalParameters(oauthParams);
      consumer.sign(request);
      HttpResponse response = client.execute(request);
      int statusCode = response.getStatusLine().getStatusCode();
      HttpEntity entity = response.getEntity();
      byte[] content = entity != null ? readBytes(entity.getContent()) : new byte[0];
      switch (statusCode) {
View Full Code Here


       
        // this is required by the Metaweb API to avoid XSS
        httpRequest.setHeader("X-Requested-With", "1");
       
        // sign the request with the oauth library
        consumer.sign(httpRequest);

        // execute the request
        HttpClient httpClient = new DefaultHttpClient();
        HttpResponse httpResponse = httpClient.execute(httpRequest);
       
View Full Code Here

        // this is required by the Metaweb API to avoid XSS
        httpRequest.setHeader("X-Requested-With", "1");

        // sign the request with the oauth library
        consumer.sign(httpRequest);

        // execute the request
        HttpClient httpClient = new DefaultHttpClient();
        HttpResponse httpResponse = httpClient.execute(httpRequest);
   
View Full Code Here

               
                OAuthConsumer consumer = OAuthUtilities.getConsumer(credentials, provider);
   
                // TODO(SM) This method uses a lot of memory and often results in OutOfMemoryErrors.
                // Is there something we can do to generate an oauth signature without consuming so much memory?
                consumer.sign(surrogateRequest);
                   
                Header[] h = surrogateRequest.getHeaders("Authorization");
                if (h.length > 0) {
                    httpRequest.setHeader("X-Freebase-Credentials", h[0].getValue());
                } else {
View Full Code Here

      consumer.setMessageSigner(new HmacSha1MessageSigner());
      consumer.setSendEmptyTokens(true);

      // sign the request (consumer is a Signpost DefaultOAuthConsumer)
      try {
        consumer.sign(request);
      } catch (Exception e) {
        throw new RuntimeException("OAuth exception: " + e.getMessage());
      }
      request.connect();
            final int httpResponseCode = request.getResponseCode();
View Full Code Here

                    guestService.getApiKeyAttribute(apiKey,"accessToken"),
                    guestService.getApiKeyAttribute(apiKey,"tokenSecret"));

      // sign the request (consumer is a Signpost DefaultOAuthConsumer)
      try {
        consumer.sign(request);
      } catch (Exception e) {
        throw new RuntimeException("OAuth exception: " + e.getMessage());
      }
      request.connect();
            final int httpResponseCode = request.getResponseCode();
View Full Code Here

                    guestService.getApiKeyAttribute(apiKey,"accessToken"),
                    guestService.getApiKeyAttribute(apiKey,"tokenSecret"));

            // sign the request (consumer is a Signpost DefaultOAuthConsumer)
            try {
                consumer.sign(request);
            } catch (Exception e) {
                throw new RuntimeException("OAuth exception: " + e.getMessage());
            }
            request.connect();
            final int httpResponseCode = request.getResponseCode();
View Full Code Here

        env.get("freshbooksConsumerSecret"));
    consumer.setMessageSigner(new PlainTextMessageSigner());
    consumer.setTokenWithSecret(guestService.getApiKeyAttribute(updateInfo.apiKey,"accessToken"),
                                    guestService.getApiKeyAttribute(updateInfo.apiKey,"tokenSecret"));

    consumer.sign(request);
   
    request.setDoOutput(true);
    Writer requestWriter = new OutputStreamWriter(
        request.getOutputStream());
View Full Code Here

                    guestService.getApiKeyAttribute(updateInfo.apiKey,"accessToken"),
                    guestService.getApiKeyAttribute(updateInfo.apiKey,"tokenSecret"));

            // sign the request (consumer is a Signpost DefaultOAuthConsumer)
            try {
                consumer.sign(request);
            } catch (Exception e) {
                throw new RuntimeException("OAuth exception: " + e.getMessage());
            }
            request.connect();
            final int httpResponseCode = request.getResponseCode();
View Full Code Here

        System.out.println("Token secret: " + consumer.getTokenSecret());

        URL url = new URL("http://api.netflix.com/catalog/titles");
        HttpURLConnection request = (HttpURLConnection) url.openConnection();

        consumer.sign(request);

        System.out.println("Sending request...");
        request.connect();

        System.out.println("Response: " + request.getResponseCode() + " "
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.