本文整理汇总了Java中org.springframework.social.oauth2.OAuth2Template类的典型用法代码示例。如果您正苦于以下问题:Java OAuth2Template类的具体用法?Java OAuth2Template怎么用?Java OAuth2Template使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OAuth2Template类属于org.springframework.social.oauth2包,在下文中一共展示了OAuth2Template类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getOAuth2Template
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
private static OAuth2Template getOAuth2Template(String appId,
String appSecret, String apiVersion) {
String graphApiURL = "https://graph.facebook.com/v" + apiVersion + "/";
OAuth2Template template = new OAuth2Template(appId, appSecret,
"https://www.facebook.com/v" + apiVersion + "/dialog/oauth",
graphApiURL + "oauth/access_token");
template.setUseParametersForClientAuthentication(true);
return template;
}
开发者ID:PacktPublishing,项目名称:OAuth-2.0-Cookbook,代码行数:12,代码来源:CustomFacebookServiceProvider.java
示例2: create
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
@Override
public CredentialProvider create(final SocialProperties properties) {
@SuppressWarnings("unchecked")
final OAuth2ConnectionFactory<Object> connectionFactory = mock(OAuth2ConnectionFactory.class);
when(connectionFactory.generateState()).thenReturn("test-state");
properties.setAppId("appId");
properties.setAppSecret("appSecret");
final OAuth2Applicator applicator = new OAuth2Applicator(properties);
applicator.setAccessTokenProperty("accessToken");
applicator.setClientIdProperty("clientId");
applicator.setClientSecretProperty("clientSecret");
applicator.setRefreshTokenProperty("refreshToken");
final CredentialProvider credentialProvider = new OAuth2CredentialProvider<>("test-provider", connectionFactory,
applicator);
@SuppressWarnings({ "unchecked", "rawtypes" })
final Class<MultiValueMap<String, String>> additionalParametersType = (Class) MultiValueMap.class;
final OAuth2Operations operations = spy(new OAuth2Template("testClientId", "testClientSecret",
"https://test/oauth2/authorize", "https://test/oauth2/token"));
doReturn(new AccessGrant("token")).when(operations).exchangeForAccess(Matchers.anyString(),
Matchers.anyString(), Matchers.any(additionalParametersType));
when(connectionFactory.getOAuthOperations()).thenReturn(operations);
return credentialProvider;
}
开发者ID:syndesisio,项目名称:syndesis,代码行数:30,代码来源:TestCredentialProviderFactory.java
示例3: createConnectionFactory
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
static SalesforceConnectionFactory
createConnectionFactory(final SocialProperties salesforceProperties) {
final SalesforceConnectionFactory salesforce = new SalesforceConnectionFactory(salesforceProperties.getAppId(),
salesforceProperties.getAppSecret());
final OAuth2Template oAuthOperations = (OAuth2Template) salesforce.getOAuthOperations();
// Salesforce requires OAuth client id and secret on the OAuth request
oAuthOperations.setUseParametersForClientAuthentication(true);
return salesforce;
}
开发者ID:syndesisio,项目名称:syndesis,代码行数:13,代码来源:SalesforceCredentialProviderFactory.java
示例4: getOAuth2Template
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
private static OAuth2Template getOAuth2Template(String appId, String appSecret)
{
OAuth2Template oauth2Template = new WechatOAuth2Template(appId, appSecret,
"https://open.weixin.qq.com/connect/oauth2/authorize", "https://api.weixin.qq.com/cgi-bin/token");
oauth2Template.setUseParametersForClientAuthentication(true);
return oauth2Template;
}
开发者ID:edwardluzi,项目名称:spring-social-wechat,代码行数:8,代码来源:WechatServiceProvider.java
示例5: create
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
@Override
public CredentialProvider create(final SocialProperties properties) {
@SuppressWarnings("unchecked")
final OAuth2ConnectionFactory<Object> connectionFactory = mock(OAuth2ConnectionFactory.class);
when(connectionFactory.generateState()).thenReturn("test-state");
properties.setAppId("appId");
properties.setAppSecret("appSecret");
final OAuth2Applicator applicator = new OAuth2Applicator(properties);
applicator.setAccessTokenProperty("accessToken");
applicator.setClientIdProperty("clientId");
applicator.setClientSecretProperty("clientSecret");
applicator.setRefreshTokenProperty("refreshToken");
final CredentialProvider credentialProvider = new OAuth2CredentialProvider<>("test-provider", connectionFactory,
applicator);
final OAuth2Operations operations = spy(new OAuth2Template("testClientId", "testClientSecret",
"https://test/oauth2/authorize", "https://test/oauth2/token"));
doReturn(new AccessGrant("token")).when(operations).exchangeForAccess(Matchers.anyString(),
Matchers.anyString(), Matchers.any(MultiValueMap.class));
when(connectionFactory.getOAuthOperations()).thenReturn(operations);
return credentialProvider;
}
开发者ID:syndesisio,项目名称:syndesis-rest,代码行数:28,代码来源:TestCredentialProviderFactory.java
示例6: GitlabServiceProvider
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
public GitlabServiceProvider(GitlabConfiguration configuration) {
super(new OAuth2Template(
configuration.getApplicationId(),
configuration.getApplicationSecret(),
configuration.getAuthorizeUrl(),
configuration.getAccessTokenUrl()
));
this.configuration = configuration;
}
开发者ID:burning-duck,项目名称:spring-social-gitlab,代码行数:10,代码来源:GitlabServiceProvider.java
示例7: getOAuth2Template
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
private static OAuth2Template getOAuth2Template(String appId, String appSecret) {
OAuth2Template oAuth2Template = new OAuth2Template(appId, appSecret,
KeyRockTemplate.API_BASE_URL + "/oauth2/authorize",
KeyRockTemplate.API_BASE_URL + "/oauth2/token");
//False to send clientId and clientSecret in "Authentication" header rather than POST body when exchanging the code
oAuth2Template.setUseParametersForClientAuthentication(false);
return oAuth2Template;
}
开发者ID:TribalyteTechnologies,项目名称:spring-social-fiware-lab,代码行数:9,代码来源:KeyRockServiceProvider.java
示例8: exchangeCredentialsForClientToken
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
private static String exchangeCredentialsForClientToken(String consumerKey, String consumerSecret) {
OAuth2Template oauth2 = new OAuth2Template(consumerKey, consumerSecret, "",
"https://api.twitter.com/oauth2/token");
return oauth2.authenticateClient().getAccessToken();
}
开发者ID:xm-online,项目名称:xm-uaa,代码行数:6,代码来源:TwitterTemplate.java
示例9: createOAuth2Template
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
private static OAuth2Template createOAuth2Template(String clientId, String clientSecret) {
OAuth2Template oAuth2Template = new OAuth2Template(clientId, clientSecret, "https://discordapp.com/api/oauth2/authorize", "https://discordapp.com/api/oauth2/token");
oAuth2Template.setUseParametersForClientAuthentication(true);
return oAuth2Template;
}
开发者ID:quanticc,项目名称:sentry,代码行数:6,代码来源:DiscordServiceProvider.java
示例10: getOauth2Operations
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
private static OAuth2Template getOauth2Operations(String clientId, String clientSecret, String accessTokenUrl) {
OAuth2Template template = new OAuth2Template(clientId, clientSecret, "", accessTokenUrl);
template.setUseParametersForClientAuthentication(true);
return template;
}
开发者ID:antonleliuk,项目名称:spring-social-botFramework,代码行数:6,代码来源:BotFrameworkServiceProvider.java
示例11: createOAuth2Template
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
private static OAuth2Template createOAuth2Template(String clientId, String clientSecret) {
OAuth2Template oAuth2Template = new OAuth2Template(clientId, clientSecret, "https://www.strava.com/oauth/authorize", "https://www.strava.com/oauth/token");
oAuth2Template.setUseParametersForClientAuthentication(true);
return oAuth2Template;
}
开发者ID:pivotal,项目名称:spring-social-strava,代码行数:6,代码来源:StravaServiceProvider.java
示例12: getOAuth2Template
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
private static OAuth2Template getOAuth2Template(String clientId, String clientSecret) {
OAuth2Template oAuth2Template = new WeiboOAuth2Template(clientId, clientSecret, "https://api.weibo.com/oauth2/authorize",
"https://api.weibo.com/oauth2/access_token");
oAuth2Template.setUseParametersForClientAuthentication(true);
return oAuth2Template;
}
开发者ID:xfcjscn,项目名称:spring-social-weibo,代码行数:7,代码来源:WeiboServiceProvider.java
示例13: createOAuth2Template
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
private static OAuth2Template createOAuth2Template(String domain, String clientId, String clientSecret) {
OAuth2Template oAuth2Template = new OAuth2Template(clientId, clientSecret, "https://" + domain + ".auth0.com/authorize", "https://" + domain + ".auth0.com/oauth/token");
oAuth2Template.setUseParametersForClientAuthentication(true);
return oAuth2Template;
}
开发者ID:cpitman,项目名称:spring-social-auth0,代码行数:6,代码来源:Auth0ServiceProvider.java
示例14: BattlenetServiceProvider
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
public BattlenetServiceProvider(String clientId, String clientSecret) {
super(new OAuth2Template(clientId, clientSecret,
// TODO eu -> settings
"https://eu.battle.net/oauth/authorize",
"https://eu.battle.net/oauth/token"));
}
开发者ID:saladinkzn,项目名称:spring-social-battlenet,代码行数:7,代码来源:BattlenetServiceProvider.java
示例15: oauth2Template
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
@Bean
public OAuth2Operations oauth2Template(Environment env) {
return new OAuth2Template(env.getProperty("clientId"), env.getProperty("clientSecret"), "", "https://api.twitter.com/oauth2/token");
}
开发者ID:andypiper,项目名称:spring-int-mqtt,代码行数:5,代码来源:Application.java
示例16: BoxServiceProvider
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
private BoxServiceProvider(String clientId, String clientSecret, BoxUrlService boxUrlService) {
super(new OAuth2Template(clientId, clientSecret, boxUrlService.getOauth2AuthorizationUrl(), boxUrlService.getOauth2TokenUrl()));
this.apiUrl = boxUrlService.getApiUrl();
this.uploadUrl = boxUrlService.getUploadUrl();
((OAuth2Template)getOAuthOperations()).setUseParametersForClientAuthentication(true);
}
开发者ID:eSignLive,项目名称:spring-social-box,代码行数:7,代码来源:BoxServiceProvider.java
示例17: createOAuthTemplate
import org.springframework.social.oauth2.OAuth2Template; //导入依赖的package包/类
private static OAuth2Template createOAuthTemplate(String clientId, String clientSecret) {
OAuth2Template template = new OAuth2Template(clientId, clientSecret, AUTH_URL, TOKEN_URL);
template.setUseParametersForClientAuthentication(true);
return template;
}
开发者ID:Glamdring,项目名称:google-plus-java-api,代码行数:6,代码来源:GooglePlusFactory.java
注:本文中的org.springframework.social.oauth2.OAuth2Template类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论