Exemplo n.º 1
0
 /** {@inheritDoc} */
 @Override
 public AccessToken getOAuthAccessToken() throws MoefouException {
   ensureTokenIsAvailable();
   if (oauthToken instanceof AccessToken) return (AccessToken) oauthToken;
   oauthToken = new AccessToken(http.post(conf.getOAuthAccessTokenURL(), this));
   return (AccessToken) oauthToken;
 }
Exemplo n.º 2
0
 /** {@inheritDoc} */
 @Override
 public AccessToken getOAuthAccessToken(final String oauthVerifier) throws MoefouException {
   ensureTokenIsAvailable();
   final String url = conf.getOAuthAccessTokenURL();
   oauthToken =
       new AccessToken(
           http.post(
               url,
               new HttpParameter[] {new HttpParameter("oauth_verifier", oauthVerifier)},
               this));
   return (AccessToken) oauthToken;
 }
Exemplo n.º 3
0
 /** {@inheritDoc} */
 @Override
 public RequestToken getOAuthRequestToken(final String callbackURL) throws MoefouException {
   if (oauthToken instanceof AccessToken)
     throw new IllegalStateException("Access token already available.");
   final List<HttpParameter> params = new ArrayList<HttpParameter>();
   if (callbackURL != null) {
     params.add(new HttpParameter("oauth_callback", callbackURL));
   }
   final String url = conf.getOAuthRequestTokenURL();
   oauthToken =
       new RequestToken(
           conf, http.post(url, params.toArray(new HttpParameter[params.size()]), this), this);
   return (RequestToken) oauthToken;
 }
Exemplo n.º 4
0
 /** @param conf configuration */
 public OAuthAuthorization(final Configuration conf) {
   this.conf = conf;
   http = new HttpClientWrapper(conf);
   setOAuthConsumer(conf.getOAuthConsumerKey(), conf.getOAuthConsumerSecret());
 }