• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java OAuthSecrets类的典型用法和代码示例

java 1次浏览

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

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

示例1: getResource

点赞 4

import com.sun.jersey.oauth.signature.OAuthSecrets; //导入依赖的package包/类
@Override
public WebResource getResource() {
	WebResource webResource = null;
	ClientConfig config = new DefaultClientConfig();
	config.getClasses().add(GsonJerseyProvider.class);
	Client client = Client.create(config);
	OAuthParameters oaParams = new OAuthParameters().signatureMethod("HMAC-SHA1").consumerKey(consumerKey)
			.token(accessToken).version("1.0");
	OAuthSecrets oaSecrets = new OAuthSecrets().consumerSecret(consumerSecret).tokenSecret(accessTokenSecret);

	OAuthClientFilter oAuthFilter = new OAuthClientFilter(client.getProviders(), oaParams, oaSecrets);
	client.addFilter(oAuthFilter);

	if (this.sandbox) {
		webResource = client.resource(Constants.SANDBOX_BASE_API_URL);
	} else if (null!= this.domain){
		webResource = client.resource(this.domain);
	}
	else{
		webResource = client.resource(Constants.BASE_API_URL);
	}
	
	
	if (this.trace) {
		webResource.addFilter(new LoggingFilter());
	}
	return webResource;
}
 

开发者ID:mrisney,
项目名称:twitter-java-ads-sdk,
代码行数:29,
代码来源:ClientServiceImpl.java

示例2: setOAuth10IfNeeded

点赞 4

import com.sun.jersey.oauth.signature.OAuthSecrets; //导入依赖的package包/类
protected void setOAuth10IfNeeded(HttpURLConnection conn, Map<String, String> parameters) {
    if (SECURITY_OAUTH_10.equals(security)) {
        OAuthParameters parms = new OAuthParameters();
        parms.setConsumerKey(oa1ConsumerKey);
        parms.setSignatureMethod(HMAC_SHA1.NAME);
        parms.setVersion(oa1Version);
        parms.setRealm(oa1Realm);
        parms.setNonce();
        parms.setTimestamp();
        parms.setToken(oa1Token);
        OAuthSecrets secrets = new OAuthSecrets();
        secrets.setConsumerSecret(oa1ConsumerSecret);
        secrets.setTokenSecret(oa1TokenSecret);
        OAuthReq req = new OAuthReq(conn, parameters, url);
        try {
            OAuthSignature.sign(req, parms, secrets);
        } catch (Exception e) {
            log.error(e.getMessage());
            throw new RuntimeException(e);
        }
    }
}
 

开发者ID:JumpMind,
项目名称:metl,
代码行数:23,
代码来源:HttpDirectory.java

示例3: getClient

点赞 4

import com.sun.jersey.oauth.signature.OAuthSecrets; //导入依赖的package包/类
public Client getClient() {

		ClientConfig config = new DefaultClientConfig();
		Client client = Client.create(config);

		OAuthParameters oaParams = new OAuthParameters().signatureMethod("HMAC-SHA1").consumerKey(consumerKey)
				.token(accessToken).version("1.0");

		OAuthSecrets oaSecrets = new OAuthSecrets().consumerSecret(consumerSecret).tokenSecret(accessTokenSecret);

		OAuthClientFilter oAuthFilter = new OAuthClientFilter(client.getProviders(), oaParams, oaSecrets);
		client.addFilter(oAuthFilter);

		return client;
	}
 

开发者ID:mrisney,
项目名称:twitter-java-ads-sdk,
代码行数:16,
代码来源:ClientServiceImpl.java

示例4: addSignHeader

点赞 4

import com.sun.jersey.oauth.signature.OAuthSecrets; //导入依赖的package包/类
/**
 * Adds the required Authorization Header in order to access the protected resources of the DropBox API
 *
    * @param webResource The WebResource in which the header will be added
    */
private WebResource addSignHeader(WebResource webResource) {

       OAuthParameters params = new OAuthParameters();
       params.signatureMethod("PLAINTEXT");
       params.consumerKey(getConnector().getConsumerKey());
       params.setToken(getConnector().getAccessToken());

       OAuthSecrets secrets = new OAuthSecrets();
       secrets.consumerSecret(getConnector().getConsumerSecret());
       secrets.setTokenSecret(getConnector().getAccessTokenSecret());

       OAuthClientFilter filter = new OAuthClientFilter(client.getProviders(), params, secrets);

       webResource.addFilter(filter);
       return webResource;
}
 

开发者ID:mulesoft-labs,
项目名称:devkit-documentation-rest-jersey,
代码行数:22,
代码来源:DropboxClient.java

示例5: getOAuthSecrets

点赞 2

import com.sun.jersey.oauth.signature.OAuthSecrets; //导入依赖的package包/类
@Override
protected OAuthSecrets getOAuthSecrets() {
    return super.getOAuthSecrets().consumerSecret(consumerSecret).tokenSecret(tokenSecret);
}
 

开发者ID:Tradeshift,
项目名称:Tradeshift-Java-Client,
代码行数:5,
代码来源:OAuth1TokenClient.java

示例6: getOAuthSecrets

点赞 2

import com.sun.jersey.oauth.signature.OAuthSecrets; //导入依赖的package包/类
@Override
protected OAuthSecrets getOAuthSecrets() {
    return super.getOAuthSecrets().consumerSecret(consumerSecret);
}
 

开发者ID:Tradeshift,
项目名称:Tradeshift-Java-Client,
代码行数:5,
代码来源:OAuth1ConsumerClient.java

示例7: getOAuthSecrets

点赞 2

import com.sun.jersey.oauth.signature.OAuthSecrets; //导入依赖的package包/类
protected OAuthSecrets getOAuthSecrets() {
    return new OAuthSecrets();
}
 

开发者ID:Tradeshift,
项目名称:Tradeshift-Java-Client,
代码行数:4,
代码来源:OAuth1Client.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)