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


Java DefaultOAuthProvider类代码示例

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


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

示例1: getRequestToken

import oauth.signpost.basic.DefaultOAuthProvider; //导入依赖的package包/类
/**
 * This method request a request token and saves the received authUrl in the
 * global variable
 * 
 * @return true if success; false otherwise
 */
public ResponseCode getRequestToken() {
    logger.entry();

    if (isAuthorized) {
        return logger.exit(ResponseCode.APPLICATION_ALREADY_AUTHORIZED);
    }

    mProvider = new DefaultOAuthProvider(mServer.getRequestUrl(), mServer.getAccessUrl(),
            mServer.getAuthorizationUrl());
    try {
        authUrl = mProvider.retrieveRequestToken(mConsumer, "http://studip-client.danner-web.de/callback");
    } catch (OAuthMessageSignerException | OAuthNotAuthorizedException | OAuthExpectationFailedException
            | OAuthCommunicationException e) {
        logger.debug("Unable to fetch oauth_request_token");
        return logger.exit(ResponseCode.SERVER_NOT_REACHABLE);
    }

    return logger.exit(ResponseCode.SUCCESS);
}
 
开发者ID:CollapsedDom,项目名称:Stud.IP-Client,代码行数:26,代码来源:OAuthConnector.java

示例2: startAuthentication

import oauth.signpost.basic.DefaultOAuthProvider; //导入依赖的package包/类
/**
 * Starts the OAuth authentication flow.
 */
public synchronized void startAuthentication(String accountId) {

	WithingsAccount withingsAccount = getAccount(accountId);
	if (withingsAccount == null) {
		logger.warn("Couldn't find Credentials of Account '{}'. Please check openhab.cfg or withings.cfg.", accountId);
		return;
	}
	
	OAuthConsumer consumer = withingsAccount.createConsumer();

	provider = new DefaultOAuthProvider(OAUTH_REQUEST_TOKEN_ENDPOINT,
			OAUTH_ACCESS_TOKEN_ENDPOINT_URL, OAUTH_AUTHORIZE_ENDPOINT_URL);

	try {
		String url = provider.retrieveRequestToken(consumer, this.redirectUrl);
		printSetupInstructions(url);
	} catch (OAuthException ex) {
		logger.error(ex.getMessage(), ex);
		printAuthenticationFailed(ex);
	}

}
 
开发者ID:andrey-desman,项目名称:openhab-hdl,代码行数:26,代码来源:WithingsAuthenticator.java

示例3: Twitter_Handler

import oauth.signpost.basic.DefaultOAuthProvider; //导入依赖的package包/类
public Twitter_Handler(Activity context, String consumerKey,
		String secretKey) {
	this.context = context;

	twitterObj = new TwitterFactory().getInstance();

	mSession = new TwitterSession(context);
	mProgressDlg = new ProgressDialog(context);

	mProgressDlg.requestWindowFeature(Window.FEATURE_NO_TITLE);

	mConsumerKey = consumerKey;
	mSecretKey = secretKey;

	mHttpOauthConsumer = new CommonsHttpOAuthConsumer(mConsumerKey,mSecretKey);

	String request_url = TWITTER_REQUEST_URL;
	String access_token_url = TWITTER_ACCESS_TOKEN_URL;
	String authorize_url = TWITTER_AUTHORZE_URL;

	mHttpOauthprovider = new DefaultOAuthProvider(request_url,
			access_token_url, authorize_url);
	mAccessToken = mSession.getAccessToken();

	configureToken();
}
 
开发者ID:ohmp,项目名称:UniversalSocialLoginAndroid,代码行数:27,代码来源:Twitter_Handler.java

示例4: TwitterApp

import oauth.signpost.basic.DefaultOAuthProvider; //导入依赖的package包/类
private TwitterApp(Context context, String consumerKey, String secretKey) {
	this.context	= context;
	
	mTwitter 		= new TwitterFactory().getInstance();
	mSession		= new TwitterSession(context);
	mProgressDlg	= new ProgressDialog(context);
	
	mProgressDlg.requestWindowFeature(Window.FEATURE_NO_TITLE);
	
	mConsumerKey 	= consumerKey;
	mSecretKey	 	= secretKey;

	mHttpOauthConsumer = new CommonsHttpOAuthConsumer(mConsumerKey, mSecretKey);
	mHttpOauthprovider = new DefaultOAuthProvider("https://api.twitter.com/oauth/request_token	",
												 "https://api.twitter.com/oauth/access_token",
												 "https://api.twitter.com/oauth/authorize");
	
	mAccessToken	= mSession.getAccessToken();
	
	configureToken();
}
 
开发者ID:kodamirmo,项目名称:LostAndFound,代码行数:22,代码来源:TwitterApp.java

示例5: startAuthentication

import oauth.signpost.basic.DefaultOAuthProvider; //导入依赖的package包/类
/**
 * Starts the OAuth authentication flow.
 */
public synchronized void startAuthentication(String accountId) {

    WithingsAccount withingsAccount = getAccount(accountId);
    if (withingsAccount == null) {
        logger.warn("Couldn't find Credentials of Account '{}'. Please check openhab.cfg or withings.cfg.",
                accountId);
        return;
    }

    OAuthConsumer consumer = withingsAccount.createConsumer();

    provider = new DefaultOAuthProvider(OAUTH_REQUEST_TOKEN_ENDPOINT, OAUTH_ACCESS_TOKEN_ENDPOINT_URL,
            OAUTH_AUTHORIZE_ENDPOINT_URL);

    try {
        String url = provider.retrieveRequestToken(consumer, this.redirectUrl);
        printSetupInstructions(url);
    } catch (OAuthException ex) {
        logger.error(ex.getMessage(), ex);
        printAuthenticationFailed(ex);
    }

}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:27,代码来源:WithingsAuthenticator.java

示例6: onCreate

import oauth.signpost.basic.DefaultOAuthProvider; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) 
{   
	super.onCreate(savedInstanceState);
	//设置屏幕没有标题栏
	requestWindowFeature(Window.FEATURE_NO_TITLE); 
	setContentView(R.layout.welcome);
	
	webInstance = this;
       mContext = getApplicationContext();
       accessInfo = InfoHelper.getAccessInfo(mContext);
       
       //生成consumer,consumer代表我们自己开发的应用JSU
   	consumer = new CommonsHttpOAuthConsumer(ConstantsUtils.CONSUMER_KEY, 
   			ConstantsUtils.CONSUMER_SECRET);
   	
   	//生成provider,provider代表新浪微博,传入认证需要的三个地址
	provider = new DefaultOAuthProvider(
			UrlUtils.REQUEST_TOKEN,
			UrlUtils.ACCESS_TOKEN,
			UrlUtils.AUTHORIZE);
}
 
开发者ID:zzxadi,项目名称:WeiboJSU,代码行数:23,代码来源:WelcomeActivity.java

示例7: oAuthProvider

import oauth.signpost.basic.DefaultOAuthProvider; //导入依赖的package包/类
@Provides public static OAuthProvider oAuthProvider()
{
	return new DefaultOAuthProvider(
			BASE_OAUTH_URL + "request_token",
			BASE_OAUTH_URL + "access_token",
			BASE_OAUTH_URL + "authorize");
}
 
开发者ID:westnordost,项目名称:StreetComplete,代码行数:8,代码来源:OAuthModule.java

示例8: createOAuthService

import oauth.signpost.basic.DefaultOAuthProvider; //导入依赖的package包/类
private void createOAuthService() {
    mOAuthConsumer = new DefaultOAuthConsumer(mApiKey,mApiSecret);

    mOAuthProvider = new DefaultOAuthProvider(
            "https://api.discogs.com/oauth/request_token", "https://api.discogs.com/oauth/access_token",
            "https://www.discogs.com/oauth/authorize");
    mOAuthProvider.setListener(new DiscogsOauthProviderListener());
}
 
开发者ID:jvanhie,项目名称:discogsscrobbler,代码行数:9,代码来源:Discogs.java

示例9: OAuthUtil

import oauth.signpost.basic.DefaultOAuthProvider; //导入依赖的package包/类
public OAuthUtil(String key, String secret) {
    provider = new DefaultOAuthProvider(
            "https://cacoo.com/oauth/request_token",
            "https://cacoo.com/oauth/access_token",
            "https://cacoo.com/oauth/authorize");
    consumer = new DefaultOAuthConsumer(key, secret);
}
 
开发者ID:den2sn,项目名称:cacoo4j,代码行数:8,代码来源:OAuthUtil.java

示例10: createProvider

import oauth.signpost.basic.DefaultOAuthProvider; //导入依赖的package包/类
public static OAuthProvider createProvider() {
    return new DefaultOAuthProvider(
            BASE_OAUTH_URL + "request_token",
            BASE_OAUTH_URL + "access_token",
            BASE_OAUTH_URL + "authorize");
}
 
开发者ID:CityZenApp,项目名称:Android-Development,代码行数:7,代码来源:OAuth.java

示例11: OAuth

import oauth.signpost.basic.DefaultOAuthProvider; //导入依赖的package包/类
private OAuth(ServiceInfo info) {
    this.info = info;
    provider = new DefaultOAuthProvider(info.requestTokenURL, info.accessTokenURL, info.authorizationURL);
    provider.setOAuth10a(true);
}
 
开发者ID:eBay,项目名称:restcommander,代码行数:6,代码来源:OAuth.java

示例12: buildOAuthProvider

import oauth.signpost.basic.DefaultOAuthProvider; //导入依赖的package包/类
/**
 * Create an {@link OAuthProvider} for the IS24-Webservice.
 * <p>
 * Different implementations of {@link AbstractClient} may create different
 * {@link OAuthProvider} objects.
 *
 * @param apiBaseUrl
 * URL of the IS24-Webservice
 *
 * @return
 * an instance of {@link OAuthProvider} for the provided URL
 */
protected OAuthProvider buildOAuthProvider( String apiBaseUrl )
{
  return new DefaultOAuthProvider(
    apiBaseUrl + "/security/oauth/request_token",
    apiBaseUrl + "/security/oauth/access_token",
    apiBaseUrl + "/security/oauth/confirm_access" );
}
 
开发者ID:OpenEstate,项目名称:OpenEstate-IS24-REST,代码行数:20,代码来源:AbstractClient.java

示例13: onCreate

import oauth.signpost.basic.DefaultOAuthProvider; //导入依赖的package包/类
@Override
public void onCreate() {
	// TODO Auto-generated method stub
	super.onCreate();
	
	this.consumer = new DefaultOAuthConsumer(CONSUMER_KEY,
			CONSUMER_SECRET);

	this.provider = new DefaultOAuthProvider(
			TUMBLR_REQUEST_TOKEN_URL, TUMBLR_ACCESS_TOKEN_URL,
			TUMBLR_AUTHORIZE_URL);

	
	
}
 
开发者ID:secondsun,项目名称:devnexus2013demo,代码行数:16,代码来源:NoteblurApplication.java

示例14: main

import oauth.signpost.basic.DefaultOAuthProvider; //导入依赖的package包/类
/**
 * Main function.
 *
 * @param args
 * command line arguments
 */
public static void main( String[] args ) throws Exception
{

  OAuthConsumer consumer =
    new DefaultOAuthConsumer( "testzugang-import-api-maklermanagerKey", "VXyCmVpjR4GQVCVBf33T" );

  OAuthProvider provider =
    new DefaultOAuthProvider( "http://sandbox.immobilienscout24.de/restapi/security/oauth/request_token",
    "http://sandbox.immobilienscout24.de/restapi/security/oauth/access_token",
    "http://sandbox.immobilienscout24.de/restapi/security/oauth/confirm_access" );


  LOGGER.info( "Fetching request token..." );

  String authUrl =
    provider.retrieveRequestToken( consumer, "http://www.google.de" );

  String requestToken = consumer.getToken();
  String requestTokenSecret = consumer.getTokenSecret();

  LOGGER.info( "Request token: "+requestToken );
  LOGGER.info( "Token secret: "+requestTokenSecret );

  LOGGER.info( "Now visit:\n"+authUrl
    +"\n... and grant this app authorization" );
  LOGGER.info( "Enter the verification code and hit ENTER when you're done:" );

  BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
  String verificationCode = br.readLine();

  LOGGER.info( "Fetching access token..." );

  provider.retrieveAccessToken( consumer, verificationCode.trim() );

  String accessToken = consumer.getToken();
  String accessTokenSecret = consumer.getTokenSecret();
  LOGGER.info( "Access token: "+accessToken );
  LOGGER.info( "Token secret: "+accessTokenSecret );

  //LOGGER.debug( "first call" );

  requestObjectApi( consumer );

  //LOGGER.debug( "second call" );

  requestObjectApi( consumer );

  //LOGGER.debug( "third call" );

  OAuthConsumer consumer2 =
    new DefaultOAuthConsumer( "testzugang-import-api-maklermanagerKey", "VXyCmVpjR4GQVCVBf33T" );

  consumer2.setTokenWithSecret( accessToken, accessTokenSecret );

  requestObjectApi( consumer2 );
}
 
开发者ID:OpenEstate,项目名称:OpenEstate-IS24-REST,代码行数:63,代码来源:IS24OauthExample.java


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