当前位置: 首页>>代码示例>>Java>>正文


Java CommonsHttpOAuthProvider类代码示例

本文整理汇总了Java中oauth.signpost.commonshttp.CommonsHttpOAuthProvider的典型用法代码示例。如果您正苦于以下问题:Java CommonsHttpOAuthProvider类的具体用法?Java CommonsHttpOAuthProvider怎么用?Java CommonsHttpOAuthProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CommonsHttpOAuthProvider类属于oauth.signpost.commonshttp包,在下文中一共展示了CommonsHttpOAuthProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMockedClient

import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; //导入依赖的package包/类
private OAuthClient getMockedClient() throws Exception {
	when(properties.getProperty("consumerKey")).thenReturn("key");
	when(properties.getProperty("consumerSecret")).thenReturn("secret");
	
	final FileInputStream fileInputStreamMock = PowerMockito.mock(FileInputStream.class);
       PowerMockito.whenNew(FileInputStream.class).withArguments(Matchers.anyString())
                           .thenReturn(fileInputStreamMock);
	
	PowerMockito.whenNew(CommonsHttpOAuthConsumer.class).withArguments(Matchers.anyString(), Matchers.anyString())
                           .thenReturn(CommonsHttpOAuthConsumerMock);
       
       PowerMockito.whenNew(CommonsHttpOAuthProvider.class).withArguments(Matchers.anyString(), Matchers.anyString(), Matchers.anyString())
       					.thenReturn(CommonsHttpOAuthProviderMock);
       
       Config config = new Config(properties);
	
	OAuthClient client = new OAuthClient(config);
	
	return client;
}
 
开发者ID:upwork,项目名称:java-upwork,代码行数:21,代码来源:OAuthClientTest.java

示例2: setHttpClient

import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; //导入依赖的package包/类
/**
 * Use a specific {@link HttpClient} for HTTP traffic.
 *
 * @param httpClient
 * {@link HttpClient}, that is used for HTTP communication
 */
public synchronized void setHttpClient( HttpClient httpClient )
{
  this.httpClient = httpClient;

  // register HTTP client in the OAuth provider
  try
  {
    OAuthProvider p = getAuthProvider();
    if (p instanceof CommonsHttpOAuthProvider)
    {
      ((CommonsHttpOAuthProvider) p).setHttpClient( httpClient );
    }
  }
  catch (OAuthNotAuthorizedException ex)
  {
  }
}
 
开发者ID:OpenEstate,项目名称:OpenEstate-IS24-REST,代码行数:24,代码来源:HttpComponents43Client.java

示例3: getProvider

import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; //导入依赖的package包/类
private OAuthProvider getProvider() {
	
	// use our http client that accepts self-signed certificates
	DefaultHttpClient httpclient = MySSLSocketFactory.getNewHttpClient();
	
	// Use the provider bundled with signpost, the android libs are buggy
	// See: http://code.google.com/p/oauth-signpost/issues/detail?id=20
	OAuthProvider provider = new CommonsHttpOAuthProvider(
			requestTokenUrl,
			accessTokenUrl,
			authorizeUrl,
			httpclient);
	provider.setOAuth10a(oauth10a);
	
	return provider;
}
 
开发者ID:Tomdroidd,项目名称:tomdroid,代码行数:17,代码来源:OAuthConnection.java

示例4: onCreate

import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	
	super.onCreate(savedInstanceState);
   	try {

   		System.setProperty("debug", "true");
   	    this.consumer = new CommonsHttpOAuthConsumer(OAuthConstants.CONSUMER_KEY, OAuthConstants.CONSUMER_SECRET);
   	    this.provider = new CommonsHttpOAuthProvider(
   	    		OAuthConstants.REQUEST_URL  + "?scope=" + URLEncoder.encode(OAuthConstants.SCOPE, OAuthConstants.ENCODING),
   	        	OAuthConstants.ACCESS_URL  + "?scope=" + URLEncoder.encode(OAuthConstants.SCOPE, OAuthConstants.ENCODING),
   	        	OAuthConstants.AUTHORIZE_URL);
       	} catch (Exception e) {
       		
       		Log.e(TAG, "Error creating consumer / provider",e);
   		}

       Log.i(TAG, "Starting task to retrieve request token.");
	new OAuthRequestTokenTask(this,consumer,provider).execute();
}
 
开发者ID:OneStopTransport,项目名称:OAuth-1-android-demo,代码行数:21,代码来源:PrepareRequestTokenActivity.java

示例5: IOSTwitterAPI

import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; //导入依赖的package包/类
public IOSTwitterAPI(TwitterConfig config) {
	super(config);

	consumer = new CommonsHttpOAuthConsumer(config.TWITTER_CONSUMER_KEY, config.TWITTER_CONSUMER_SECRET);
	provider = new CommonsHttpOAuthProvider("https://api.twitter.com/oauth/request_token", "https://api.twitter.com/oauth/access_token",
			"https://api.twitter.com/oauth/authorize");

}
 
开发者ID:TomGrill,项目名称:gdx-twitter,代码行数:9,代码来源:IOSTwitterAPI.java

示例6: onCreate

import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	mIntent = this.getIntent();

	consumerKey = mIntent.getStringExtra("TWITTER_CONSUMER_KEY");
	consumerSecret = mIntent.getStringExtra("TWITTER_CONSUMER_SECRET");
	callbackURL = mIntent.getStringExtra("TWITTER_CALLBACK_URL");
	// transporterFilename = mIntent.getStringExtra("STORAGE_FILENAME");

	consumer = new CommonsHttpOAuthConsumer(consumerKey, consumerSecret);
	provider = new CommonsHttpOAuthProvider("https://api.twitter.com/oauth/request_token", "https://api.twitter.com/oauth/access_token",
			"https://api.twitter.com/oauth/authorize");

	/**
	 * we delete all existing knowledge of this user and assume he canceled
	 * the signin process.
	 */
	AndroidTwitterAuthIntent.TWITTER_USER_TOKEN = null;
	AndroidTwitterAuthIntent.TWITTER_USER_TOKEN_SECRET = null;
	AndroidTwitterAuthIntent.TWITTER_SIGNIN_CANCELED = true;

	if (mIntent.getData() == null) {
		try {
			(new RetrieveRequestTokenTask()).execute(new Void[0]);
		} catch (Exception e) {
			Gdx.app.log(TAG, e.getMessage());
			throw new RuntimeException(e);
		}
	}
}
 
开发者ID:TomGrill,项目名称:gdx-twitter,代码行数:33,代码来源:AndroidTwitterAuthIntent.java

示例7: DesktopTwitterAPI

import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; //导入依赖的package包/类
public DesktopTwitterAPI(TwitterConfig config) {
	super(config);

	consumer = new CommonsHttpOAuthConsumer(config.TWITTER_CONSUMER_KEY, config.TWITTER_CONSUMER_SECRET);
	provider = new CommonsHttpOAuthProvider("https://api.twitter.com/oauth/request_token", "https://api.twitter.com/oauth/access_token",
			"https://api.twitter.com/oauth/authorize");
}
 
开发者ID:TomGrill,项目名称:gdx-twitter,代码行数:8,代码来源:DesktopTwitterAPI.java

示例8: prepareRequestToken

import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; //导入依赖的package包/类
public void prepareRequestToken() {
	try {		
		consumer = new CommonsHttpOAuthConsumer(twitterConsumerKey, twitterConsumerSecret);
		provider = new CommonsHttpOAuthProvider(SocialConstants.TWITTER_REQUEST_URL,SocialConstants.TWITTER_ACCESS_URL,SocialConstants.TWITTER_AUTHORIZE_URL);
	} catch (Exception e) {
		//Log.e(TAG, "Error creating consumer / provider",e);
		SessionEvents.onLoginError("Error", SessionListenerType.TWITTER_SESSION_LISTENER);
	}
	//Log.i(TAG, "Starting task to retrieve request token.");
	provider.setOAuth10a(true);
}
 
开发者ID:Nikhil-Nandagopal,项目名称:Socialite,代码行数:12,代码来源:TwitterConnector.java

示例9: FiveHundredPxOAuthHelper

import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; //导入依赖的package包/类
public FiveHundredPxOAuthHelper(String consumerKey, String consumerSecret) {
    if (TextUtils.isEmpty(consumerKey) || TextUtils.isEmpty(consumerSecret)) {
        throw new IllegalArgumentException(getClass().getSimpleName() + " must be started with" +
                "a non-empty consumerKey and consumerSecret");
    }

    mOAuthConsumer = new CommonsHttpOAuthConsumer(consumerKey, consumerSecret);
    mOAuthProvider = new CommonsHttpOAuthProvider(REQUEST_TOKEN_URL,
            ACCESS_TOKEN_URL, AUTHORIZE_URL);
}
 
开发者ID:lkorth,项目名称:photo-paper,代码行数:11,代码来源:FiveHundredPxOAuthHelper.java

示例10: buildOAuthProvider

import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; //导入依赖的package包/类
@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 );
}
 
开发者ID:OpenEstate,项目名称:OpenEstate-IS24-REST,代码行数:11,代码来源:HttpComponents43Client.java

示例11: init

import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; //导入依赖的package包/类
private void init() throws Exception {
	CommonsHttpOAuthConsumer consumer = new CommonsHttpOAuthConsumer(
			this.consumerKey, this.consumerSecret);
	
	CommonsHttpOAuthProvider provider = new CommonsHttpOAuthProvider(
			request_token_url, access_token_url, authorize_url);

	final String urlString = provider.retrieveRequestToken(consumer, "");
	
	this.requestOauthToken = HttpParameterUtil.getUrlParamValue(urlString,
			"oauth_token");
	this.requestOauthSecret = consumer.getTokenSecret();

}
 
开发者ID:fsiu,项目名称:dw2020,代码行数:15,代码来源:OAuthAuthorization.java

示例12: RetrieveAccessTokenTask

import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; //导入依赖的package包/类
public RetrieveAccessTokenTask(OpenStreetMapUpload activity,
		CommonsHttpOAuthProvider oAuthProvider,
		CommonsHttpOAuthConsumer oAuthConsumer,
		String verifier) {
	this.activity = activity;
	this.oAuthProvider = oAuthProvider;
	this.oAuthConsumer = oAuthConsumer;
	this.verifier = verifier;
}
 
开发者ID:WanderWiki,项目名称:WanderWiki-client,代码行数:10,代码来源:RetrieveAccessTokenTask.java

示例13: RetrieveRequestTokenTask

import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; //导入依赖的package包/类
public RetrieveRequestTokenTask(Context context,
		CommonsHttpOAuthProvider oAuthProvider,
		CommonsHttpOAuthConsumer oAuthConsumer, String callbackUrl) {
	this.context = context;
	this.oAuthProvider = oAuthProvider;
	this.oAuthConsumer = oAuthConsumer;
	this.callbackUrl = callbackUrl;
}
 
开发者ID:WanderWiki,项目名称:WanderWiki-client,代码行数:9,代码来源:RetrieveRequestTokenTask.java

示例14: getProvider

import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; //导入依赖的package包/类
public CommonsHttpOAuthProvider getProvider(android.content.Context context ) {
    //System.setProperty("debug", "true");
    final String scope = Consts.GMAIL_SCOPE + " " + Consts.CONTACTS_SCOPE;
    return new CommonsHttpOAuthProvider(
        String.format("https://www.google.com/accounts/OAuthGetRequestToken" +
          "?scope=%s&xoauth_displayname=%s",
          urlEncode(scope),
          urlEncode(context.getString(R.string.app_name))),
        "https://www.google.com/accounts/OAuthGetAccessToken",
        "https://www.google.com/accounts/OAuthAuthorizeToken?btmpl=mobile") {
            { setOAuth10a(true); }
        };
}
 
开发者ID:zhenlonghe,项目名称:fnzy,代码行数:14,代码来源:XOAuthConsumer.java

示例15: buildProvider

import oauth.signpost.commonshttp.CommonsHttpOAuthProvider; //导入依赖的package包/类
/**
 * Builds an {@see OAuthProvider} based on these parameters and a OAuth consumer <code>consumer</code>.
 * 
 * @return the provider
 * @throws IllegalArgumentException thrown if consumer is null
 */
public OAuthProvider buildProvider() throws IllegalArgumentException {
    
    return new CommonsHttpOAuthProvider(
            requestTokenUrl,
            accessTokenUrl,
            authoriseUrl
    );
}
 
开发者ID:Mapzen-POI-Collector,项目名称:Mapzen-Android,代码行数:15,代码来源:OAuthParameters.java


注:本文中的oauth.signpost.commonshttp.CommonsHttpOAuthProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。