congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
oauth.signpost.commonshttp
Code IndexAdd Tabnine to your IDE (free)

How to use oauth.signpost.commonshttp

Best Java code snippets using oauth.signpost.commonshttp (Showing top 20 results out of 315)

origin: stackoverflow.com

 //The consumer object was lost because the browser got into foreground, need to instantiate it again with your apps token and secret.
consumer = new CommonsHttpOAuthConsumer("xxx", "yyy"); 

//Set the requestToken and the tokenSecret that you got earlier by calling retrieveRequestToken.
consumer.setTokenWithSecret(requestToken, tokenSecret);

//The provider object is lost, too, so instantiate it again.
provider = new CommonsHttpOAuthProvider("https://api.twitter.com/oauth/request_token", 
                "https://api.twitter.com/oauth/access_token", 
                "https://api.twitter.com/oauth/authorize");     
//Now that's really important. Because you don't perform the retrieveRequestToken method at this moment, the OAuth method is not detected automatically (there is no communication with Twitter). So, the default is 1.0 which is wrong because the initial request was performed with 1.0a.
provider.setOAuth10a(true);

provider.retrieveAccessToken(consumer, verifier);
origin: mttkay/signpost

@Override
protected HttpRequest createRequest(String endpointUrl) throws Exception {
  HttpPost request = new HttpPost(endpointUrl);
  return new HttpRequestAdapter(request);
}
origin: mttkay/signpost

  @Override
  protected OAuthProvider buildProvider(String requestTokenUrl, String accessTokenUrl,
      String websiteUrl, boolean mockConnection) throws Exception {
    if (mockConnection) {
      CommonHttpOAuthProviderMock provider = new CommonHttpOAuthProviderMock(requestTokenUrl,
          accessTokenUrl, websiteUrl);
      provider.mockConnection(OAuth.OAUTH_TOKEN + "=" + TOKEN + "&"
          + OAuth.OAUTH_TOKEN_SECRET + "=" + TOKEN_SECRET);
      return provider;
    }
    return new CommonsHttpOAuthProvider(requestTokenUrl, accessTokenUrl, websiteUrl);
  }
}
origin: org.openestate.is24/OpenEstate-IS24-REST-hc42

@Override
protected OAuthConsumer buildOAuthConsumer( String apiAccessKey, String apiAccessSecret )
{
 return new CommonsHttpOAuthConsumer( apiAccessKey, apiAccessSecret );
}
origin: org.openestate.is24/OpenEstate-IS24-REST-HC43

@Override
protected OAuthProvider buildOAuthProvider(String apiBaseUrl) {
  if (httpClient == null) setDefaultHttpClient();
  return new CommonsHttpOAuthProvider(
      apiBaseUrl + "/security/oauth/request_token",
      apiBaseUrl + "/security/oauth/access_token",
      apiBaseUrl + "/security/oauth/confirm_access",
      httpClient);
}
origin: matburt/mobileorg-android

private void buildConsumer() {
  if (consumer_key != null && consumer_secret != null
      && access_token != null && token_secret != null) {
    consumer = new CommonsHttpOAuthConsumer(consumer_key, consumer_secret);
    consumer.setMessageSigner(new HmacSha1MessageSigner());
    consumer.setTokenWithSecret(access_token, token_secret);
  }
}
origin: mttkay/signpost

@Override
protected oauth.signpost.http.HttpResponse sendRequest(HttpRequest request) throws Exception {
  HttpResponse response = httpClient.execute((HttpUriRequest) request.unwrap());
  return new HttpResponseAdapter(response);
}
origin: stackoverflow.com

//Generate a new oAuthConsumer object
     commonsHttpOAuthConsumer
         = new CommonsHttpOAuthConsumer(
         "Consumer Key",
         "Consumer Secret Key");
     //Generate a new oAuthProvider object
     commonsHttpOAuthProvider
         = new CommonsHttpOAuthProvider(
         "https://www.tumblr.com/oauth/request_token",
         "https://www.tumblr.com/oauth/access_token",
         "https://www.tumblr.com/oauth/authorize");
     //Retrieve the URL to which the user must be sent in order to authorize the consumer
     return commonsHttpOAuthProvider.retrieveRequestToken(
         commonsHttpOAuthConsumer,
         "Callback URL as registered with Tumblr"
     );
origin: com.comcast.drivethru/drive-thru

/**
 * Construct a new {@link OAuthSecurityProvider} using the given OAUTH key and secret.
 *
 * @param key
 *            the OAUTH key
 * @param secret
 *            the OAUTH secret
 */
public OAuthSecurityProvider(String key, String secret) {
  this(new CommonsHttpOAuthConsumer(key, secret));
}
origin: com.typesafe.play/play-java-ws

public OAuth(ServiceInfo info, boolean use10a) {
  this.info = info;
  this.provider = new CommonsHttpOAuthProvider(info.requestTokenURL, info.accessTokenURL, info.authorizationURL);
  this.provider.setOAuth10a(use10a);
}
origin: mttkay/signpost

@Override
protected HttpRequest wrap(Object request) {
  if (!(request instanceof org.apache.http.HttpRequest)) {
    throw new IllegalArgumentException(
        "This consumer expects requests of type "
            + org.apache.http.HttpRequest.class.getCanonicalName());
  }
  return new HttpRequestAdapter((org.apache.http.client.methods.HttpUriRequest) request);
}
origin: mttkay/signpost

@Override
protected oauth.signpost.http.HttpResponse sendRequest(HttpRequest request) throws Exception {
  HttpResponse resp = httpClientMock.execute((HttpUriRequest) request.unwrap());
  return new HttpResponseAdapter(resp);
}
origin: org.openestate.is24/OpenEstate-IS24-REST-hc43

@Override
protected OAuthConsumer buildOAuthConsumer( String apiAccessKey, String apiAccessSecret )
{
 return new CommonsHttpOAuthConsumer( apiAccessKey, apiAccessSecret );
}
origin: play/play-java

public OAuth(ServiceInfo info, boolean use10a) {
  this.info = info;
  this.provider = new CommonsHttpOAuthProvider(info.requestTokenURL, info.accessTokenURL, info.authorizationURL);
  this.provider.setOAuth10a(use10a);
}
origin: mttkay/signpost

  @Override
  public void prepareRequest() throws Exception {
    HttpPost r = new HttpPost(URL);
    r.setHeader(HEADER_NAME, HEADER_VALUE);
    StringEntity body = new StringEntity(PAYLOAD);
    body.setContentType(CONTENT_TYPE);
    r.setEntity(body);
    request = new HttpRequestAdapter(r);
  }
}
origin: org.openestate.is24/OpenEstate-IS24-REST-HC43

@Override
protected OAuthConsumer buildOAuthConsumer(String apiAccessKey, String apiAccessSecret) {
  return new CommonsHttpOAuthConsumer(apiAccessKey, apiAccessSecret);
}
origin: org.openestate.is24/OpenEstate-IS24-REST-hc43

@Override
protected OAuthProvider buildOAuthProvider( String apiBaseUrl )
{
 if (httpClient==null) setDefaultHttpClient();
 return new CommonsHttpOAuthProvider(
  apiBaseUrl + "/security/oauth/request_token",
  apiBaseUrl + "/security/oauth/access_token",
  apiBaseUrl + "/security/oauth/confirm_access",
  httpClient );
}
origin: oauth.signpost/signpost-commonshttp4

@Override
protected HttpRequest createRequest(String endpointUrl) throws Exception {
  HttpPost request = new HttpPost(endpointUrl);
  return new HttpRequestAdapter(request);
}
origin: org.codehaus.groovy.modules.http-builder/http-builder

public OAuthSigner( String consumerKey, String consumerSecret,
  String accessToken, String secretToken ) {
  this.oauth = new CommonsHttpOAuthConsumer( consumerKey, consumerSecret );
  oauth.setTokenWithSecret( accessToken, secretToken );
}
origin: jgritman/httpbuilder

public OAuthSigner( String consumerKey, String consumerSecret,
  String accessToken, String secretToken ) {
  this.oauth = new CommonsHttpOAuthConsumer( consumerKey, consumerSecret );
  oauth.setTokenWithSecret( accessToken, secretToken );
}
oauth.signpost.commonshttp

Most used classes

  • CommonsHttpOAuthConsumer
    Supports signing HTTP requests of type org.apache.http.HttpRequest.
  • CommonsHttpOAuthProvider
    This implementation uses the Apache Commons HttpClient 4.x HTTP implementation to fetch OAuth tokens
  • HttpRequestAdapter
  • HttpResponseAdapter
  • Http3RequestAdapter
  • CommonHttpOAuthProviderMock,
  • CommonHttpOAuthProviderMock,
  • CommonsHttp3OAuthProvider
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now