• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java OAuthParameters类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: callApi

import com.google.api.client.auth.oauth.OAuthParameters; //导入依赖的package包/类
public HttpResponse callApi(String apimethod, String httpmethod) throws IOException {
	HttpTransport http_transport = new ApacheHttpTransport();
	OAuthParameters parameters = tokmgr.getOAuthParameters();
	HttpRequestFactory factory = http_transport.createRequestFactory(parameters);
	GenericUrl url = new GenericUrl(API_URL + apimethod);
	HttpRequest req = factory.buildGetRequest(url);
	req.setRequestMethod(httpmethod);
	HttpResponse resp = req.execute();
	return resp;
}
 
开发者ID:phwoelfel,项目名称:FireHydrantLocator,代码行数:11,代码来源:OSMApi.java


示例2: createParameters

import com.google.api.client.auth.oauth.OAuthParameters; //导入依赖的package包/类
public OAuthParameters createParameters() 
{
	OAuthSigner signer = signerFactory.createSigner(tokenSecret);

	OAuthParameters result = new OAuthParameters();
	result.consumerKey = config.getConsumerKey();;
	result.token = token;
	result.signer = signer;
	return result;
}
 
开发者ID:XeroAPI,项目名称:Xero-Java,代码行数:11,代码来源:OAuthRequestResource.java


示例3: createService

import com.google.api.client.auth.oauth.OAuthParameters; //导入依赖的package包/类
public static <S> S createService(Class<S> serviceClass, String baseUrl, final OAuthParameters oAuthParams) {
    OkHttpClient client = new OkHttpClient();
    client.networkInterceptors().add(new OAuthInterceptor(oAuthParams));
    builder.setClient(new OkClient(client));
    builder.setEndpoint(baseUrl).setLogLevel(RestAdapter.LogLevel.FULL);
    builder.setConverter(new SimpleXMLConverter());
    RestAdapter adapter = builder.build();
    return adapter.create(serviceClass);
}
 
开发者ID:ipragmatech,项目名称:OAuth-Magento-Rest-Api-Retrofit,代码行数:10,代码来源:ServiceGenerator.java


示例4: getConsumer

import com.google.api.client.auth.oauth.OAuthParameters; //导入依赖的package包/类
protected OAuthParameters getConsumer() {
    OAuthHmacSigner signer = new OAuthHmacSigner();
    signer.clientSharedSecret = Constants.CONSUMER_SECRET;
    signer.tokenSharedSecret = localCredentialStore.getToken().getAuthTokenSecret();
    OAuthParameters authorizer = new OAuthParameters();
    authorizer.consumerKey = Constants.CONSUMER_KEY;
    authorizer.signer = signer;
    authorizer.token = localCredentialStore.getToken().getAuthToken();

    return authorizer;
}
 
开发者ID:ipragmatech,项目名称:OAuth-Magento-Rest-Api-Retrofit,代码行数:12,代码来源:BaseActivity.java


示例5: postConstruct

import com.google.api.client.auth.oauth.OAuthParameters; //导入依赖的package包/类
private void postConstruct() {
    OAuthHmacSigner signer = new OAuthHmacSigner();
    signer.clientSharedSecret = sharedSecret;
    signer.tokenSharedSecret = tokenSharedSecret;

    authorizer = new OAuthParameters();
    authorizer.consumerKey = consumerKey;
    authorizer.signer = signer;
    authorizer.token = getAccessToken();
}
 
开发者ID:agilie,项目名称:dribbble-android-sdk,代码行数:11,代码来源:OAuthHmacCredential.java


示例6: getParameters

import com.google.api.client.auth.oauth.OAuthParameters; //导入依赖的package包/类
/**
 * Method to retrieve the OAUTHParameters to be used for the HTTP connection
 * 
 * @return the OAUTHParameters to be used for the HTTP connection
 */
private static OAuthParameters getParameters()
{
	// Tokens for [email protected]
	final String TOKEN = "1/uMD0EOMX_4IvJhbKL4EgropZedEZ1ipamLv12oK2F00";
	final String SECRETTOKEN = "IbQ5mS-0rOzWqXDngpYj_RhD";

	// TODO generate and use tokens for app/developer [email protected]

	// initiate the signer
	final OAuthHmacSigner signer = new OAuthHmacSigner();
	signer.clientSharedSecret = CONSUMER_SECRET;
	signer.tokenSharedSecret = SECRETTOKEN;

	// initiate the parameters for the HTTP request factory
	final OAuthParameters parameters = new OAuthParameters();
	parameters.consumerKey = CONSUMER_KEY;
	parameters.token = TOKEN;
	parameters.signer = signer;

	return parameters;
}
 
开发者ID:krevelen,项目名称:coala,代码行数:27,代码来源:DealOAuth1Util.java


示例7: getOAuthParameters

import com.google.api.client.auth.oauth.OAuthParameters; //导入依赖的package包/类
public OAuthParameters getOAuthParameters() {
	if (token != null && tokenSecret != null) {
		OAuthParameters parameters = new OAuthParameters();
		parameters.consumerKey = CONSUMER_KEY;
		parameters.token = token;
		parameters.signer = signer;
		return parameters;
	}
	else {
		return null;
	}
}
 
开发者ID:phwoelfel,项目名称:FireHydrantLocator,代码行数:13,代码来源:OAuthTokenmanager.java


示例8: getClientOAuthParameters

import com.google.api.client.auth.oauth.OAuthParameters; //导入依赖的package包/类
private static OAuthParameters getClientOAuthParameters() {
    OAuthHmacSigner signer = new OAuthHmacSigner();
    signer.clientSharedSecret = ApplicationConfiguration.getOAuthConsumerSecret();

    OAuthParameters oauthParameters = new OAuthParameters();
    oauthParameters.version = "1.0";
    oauthParameters.consumerKey = ApplicationConfiguration.getOAuthConsumerKey();
    oauthParameters.signer = signer;
    return oauthParameters;
}
 
开发者ID:openmash,项目名称:mashmesh,代码行数:11,代码来源:GoogleApiUtils.java


示例9: getSignature

import com.google.api.client.auth.oauth.OAuthParameters; //导入依赖的package包/类
public LinkedHashMap<String, String> getSignature(Map<String, String> options, RequestMethod requestMethod, String endpoint) {
    LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();

    OAuthParameters parameters = new OAuthParameters();
    parameters.computeTimestamp();
    parameters.computeNonce();
    parameters.version = "1.0";
    parameters.consumerKey = wooCommerce.getWc_key();
    GenericUrl genericUrl = new GenericUrl();
    genericUrl.setScheme(wooCommerce.isHttps() ? "https" : "http");
    genericUrl.setHost(wooCommerce.getBaseUrl());
    genericUrl.appendRawPath("/wc-api");
    genericUrl.appendRawPath("/v3");
    /*
     *    The endpoint to be called is specified next
     *    */

    genericUrl.appendRawPath(endpoint);

    for (Map.Entry<String, String> entry : options.entrySet())
    {
        System.out.println(entry.getKey() + "/" + entry.getValue());
        genericUrl.appendRawPath("/"+entry.getValue());
    }

    OAuthHmacSigner oAuthHmacSigner = new OAuthHmacSigner();
    oAuthHmacSigner.clientSharedSecret = wooCommerce.getWc_secret();


    parameters.signer = oAuthHmacSigner;
    parameters.signatureMethod = wooCommerce.getSigning_method().getVal();
    try {
        parameters.computeSignature(requestMethod.getVal(), genericUrl);
    } catch (GeneralSecurityException e) {
        e.printStackTrace();
    }

    map.put("oauth_consumer_key", parameters.consumerKey);
    map.put("oauth_signature_method", parameters.signatureMethod);
    map.put("oauth_timestamp", parameters.timestamp);
    map.put("oauth_nonce", parameters.nonce);
    map.put("oauth_version", parameters.version);
    map.put("oauth_signature", parameters.signature);

    genericUrl.put("oauth_consumer_key", parameters.consumerKey);
    genericUrl.put("oauth_signature_method", parameters.signatureMethod);
    genericUrl.put("oauth_timestamp", parameters.timestamp);
    genericUrl.put("oauth_nonce", parameters.nonce);
    genericUrl.put("oauth_version", parameters.version);
    genericUrl.put("oauth_signature", parameters.signature);

    Log.i(TAG,genericUrl.build());


    return map;
}
 
开发者ID:rajatady,项目名称:Woocommerce-Android-Client,代码行数:57,代码来源:OAuthSigner.java


示例10: OAuthInterceptor

import com.google.api.client.auth.oauth.OAuthParameters; //导入依赖的package包/类
public OAuthInterceptor(OAuthParameters oAuthParams) {
    this.oAuthParams = oAuthParams;
}
 
开发者ID:ipragmatech,项目名称:OAuth-Magento-Rest-Api-Retrofit,代码行数:4,代码来源:OAuthInterceptor.java


示例11: DownloadJson

import com.google.api.client.auth.oauth.OAuthParameters; //导入依赖的package包/类
public DownloadJson(String apiRequest, OAuthParameters consumer) {
    this.url = apiRequest;
    this.consumer = consumer;
}
 
开发者ID:ipragmatech,项目名称:OAuth-Magento-Rest-Api-Retrofit,代码行数:5,代码来源:MainActivity.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MinguoEra类代码示例发布时间:2022-05-22
下一篇:
Java ModuleChunk类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap