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

Java OAuthHmacSigner类代码示例

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

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



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

示例1: new10aTokenRequest

import com.google.api.client.auth.oauth.OAuthHmacSigner; //导入依赖的package包/类
/**
 * Returns a new instance of a token request based on the given verifier
 * code. This step is defined in <a
 * href="http://oauth.net/core/1.0a/#auth_step3">Obtaining an Access
 * Token</a>.
 * 
 * @param temporaryCredentials
 * @param verifierCode
 * @return
 */
public OAuthGetAccessToken new10aTokenRequest(OAuthCredentialsResponse temporaryCredentials,
        String verifierCode) {
    OAuthGetAccessToken request = new OAuthGetAccessToken(getTokenServerEncodedUrl());
    request.temporaryToken = temporaryCredentials.token;
    request.transport = getTransport();

    OAuthHmacSigner signer = new OAuthHmacSigner();
    ClientParametersAuthentication clientAuthentication = (ClientParametersAuthentication) getClientAuthentication();
    signer.clientSharedSecret = clientAuthentication.getClientSecret();
    signer.tokenSharedSecret = temporaryCredentials.tokenSecret;

    request.signer = signer;
    request.consumerKey = clientAuthentication.getClientId();
    request.verifier = verifierCode;
    return request;
}
 
开发者ID:agilie,项目名称:dribbble-android-sdk,代码行数:27,代码来源:AuthorizationFlow.java


示例2: OAuthTokenmanager

import com.google.api.client.auth.oauth.OAuthHmacSigner; //导入依赖的package包/类
public OAuthTokenmanager(Context c){
	cont = c;

	// this signer will be used to sign all the requests in the "oauth dance"
	signer = new OAuthHmacSigner();
	signer.clientSharedSecret = CONSUMER_SECRET;

	//
	// OAuthParameters parameters = new OAuthParameters();
	// parameters.consumerKey = CONSUMER_KEY;
	// parameters.token = "xwE1arKNIsn3hycHmoej2yq9zfI6dUf9LnpRKMqO";
	// parameters.signer = signer;
	// xwE1arKNIsn3hycHmoej2yq9zfI6dUf9LnpRKMqO token
	// rjhTmVFcOU65nWRfQDLouW88xvapzKEa3WOoaHqv tokenSecret
	// utilize accessToken to access protected resources
	// HttpRequestFactory factory = http_transport.createRequestFactory(parameters);
	// GenericUrl url = new GenericUrl("http://api.openstreetmap.org/api/0.6/permissions");
	// HttpRequest req = factory.buildGetRequest(url);
	// req.setRequestMethod("GET");
	// HttpResponse resp = req.execute();
	// System.out.println("Response Status Code: " + resp.getStatusCode());
	// System.out.println("Response body:" + resp.parseAsString());
}
 
开发者ID:phwoelfel,项目名称:FireHydrantLocator,代码行数:24,代码来源:OAuthTokenmanager.java


示例3: createSigner

import com.google.api.client.auth.oauth.OAuthHmacSigner; //导入依赖的package包/类
@Override
public OAuthHmacSigner createSigner(String tokenSecret) {
  OAuthHmacSigner signer = new OAuthHmacSigner();
  signer.tokenSharedSecret = tokenSecret;
  signer.clientSharedSecret = consumerSecret;
  return signer;
}
 
开发者ID:XeroAPI,项目名称:Xero-Java,代码行数:8,代码来源:HmacSignerFactory.java


示例4: getConsumer

import com.google.api.client.auth.oauth.OAuthHmacSigner; //导入依赖的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: getOAuthHmacSigner

import com.google.api.client.auth.oauth.OAuthHmacSigner; //导入依赖的package包/类
private OAuthHmacSigner getOAuthHmacSigner(
    @Nullable String clientSecret, @Nullable String oauthTemporaryToken)
    throws NoSuchAlgorithmException, InvalidKeySpecException {
  final OAuthHmacSigner signer = new OAuthHmacSigner();
  signer.clientSharedSecret = clientSecret;
  signer.tokenSharedSecret = sharedTokenSecrets.remove(oauthTemporaryToken);
  return signer;
}
 
开发者ID:eclipse,项目名称:che,代码行数:9,代码来源:OAuthAuthenticator.java


示例6: postConstruct

import com.google.api.client.auth.oauth.OAuthHmacSigner; //导入依赖的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


示例7: new10aTemporaryTokenRequest

import com.google.api.client.auth.oauth.OAuthHmacSigner; //导入依赖的package包/类
/**
 * Returns the response of a Request Token request as defined in <a
 * href="http://oauth.net/core/1.0a/#auth_step1">Obtaining an Unauthorized
 * Request Token</a>.
 * 
 * @param redirectUri the {@code oauth_callback} as defined in <a
 *            href="http://oauth.net/core/1.0a/#rfc.section.6.1.1">Consumer
 *            Obtains a Request Token</a>
 * @return
 * @throws IOException
 */
public OAuthCredentialsResponse new10aTemporaryTokenRequest(String redirectUri)
        throws IOException {
    OAuthGetTemporaryToken temporaryToken =
            new OAuthGetTemporaryToken(getTemporaryTokenRequestUrl());
    OAuthHmacSigner signer = new OAuthHmacSigner();
    ClientParametersAuthentication clientAuthentication = (ClientParametersAuthentication) getClientAuthentication();
    signer.clientSharedSecret = clientAuthentication.getClientSecret();
    temporaryToken.signer = signer;
    temporaryToken.consumerKey = clientAuthentication.getClientId();
    temporaryToken.callback = redirectUri;
    temporaryToken.transport = getTransport();
    return temporaryToken.execute();
}
 
开发者ID:agilie,项目名称:dribbble-android-sdk,代码行数:25,代码来源:AuthorizationFlow.java


示例8: getParameters

import com.google.api.client.auth.oauth.OAuthHmacSigner; //导入依赖的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


示例9: getClientOAuthParameters

import com.google.api.client.auth.oauth.OAuthHmacSigner; //导入依赖的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


示例10: getSignature

import com.google.api.client.auth.oauth.OAuthHmacSigner; //导入依赖的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


示例11: ProcessToken

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java BasicRouteDirector类代码示例发布时间:2022-05-22
下一篇:
Java FileSaverDescriptor类代码示例发布时间: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