本文整理汇总了Java中org.springframework.social.google.connect.GoogleConnectionFactory.setScope方法的典型用法代码示例。如果您正苦于以下问题:Java GoogleConnectionFactory.setScope方法的具体用法?Java GoogleConnectionFactory.setScope怎么用?Java GoogleConnectionFactory.setScope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.social.google.connect.GoogleConnectionFactory
的用法示例。
在下文中一共展示了GoogleConnectionFactory.setScope方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createConnectionFactory
import org.springframework.social.google.connect.GoogleConnectionFactory; //导入方法依赖的package包/类
public ConnectionFactory<?> createConnectionFactory(String appId, String appSecret) {
switch(this) {
case facebook:
return new FacebookConnectionFactory(appId, appSecret);
case twitter:
return new TwitterConnectionFactory(appId, appSecret);
case google:
GoogleConnectionFactory factory = new GoogleConnectionFactory(appId, appSecret);
factory.setScope("openid profile");
return factory;
case linkedin:
return new LinkedInConnectionFactory(appId, appSecret);
case github:
return new GitHubConnectionFactory(appId, appSecret);
default:
return null;
}
}
示例2: addConnectionFactories
import org.springframework.social.google.connect.GoogleConnectionFactory; //导入方法依赖的package包/类
@Override
public void addConnectionFactories(ConnectionFactoryConfigurer configurer,
Environment env) {
final FacebookConnectionFactory facebook = new FacebookConnectionFactory(
env.getRequiredProperty("spring.social.facebook.appId"),
env.getRequiredProperty("spring.social.facebook.appSecret"));
facebook.setScope(EMAIL);
final TwitterConnectionFactory twitter = new TwitterConnectionFactory(
env.getRequiredProperty("spring.social.twitter.appId"),
env.getRequiredProperty("spring.social.twitter.appSecret"));
final GoogleConnectionFactory google = new GoogleConnectionFactory(
env.getRequiredProperty("spring.social.google.appId"),
env.getRequiredProperty("spring.social.google.appSecret"));
google.setScope(EMAIL);
configurer.addConnectionFactory(facebook);
configurer.addConnectionFactory(google);
configurer.addConnectionFactory(twitter);
}
示例3: googleConnectionFactory
import org.springframework.social.google.connect.GoogleConnectionFactory; //导入方法依赖的package包/类
private GoogleConnectionFactory googleConnectionFactory() {
log.debug("New instance of " + GoogleConnectionFactory.class);
String key = env.getProperty("spring.social.google.clientId");
String secret = env.getProperty("spring.social.google.clientSecret");
GoogleConnectionFactory result = new GoogleConnectionFactory(key, secret);
result.setScope("https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email");
return result;
}
示例4: addConnectionFactories
import org.springframework.social.google.connect.GoogleConnectionFactory; //导入方法依赖的package包/类
@Override
public void addConnectionFactories(ConnectionFactoryConfigurer cfConfig, Environment env) {
// Facebook
FacebookConnectionFactory ffactory = new FacebookConnectionFactory(
env.getProperty("facebook.app.id"),
env.getProperty("facebook.app.secret"));
ffactory.setScope(env.getProperty("facebook.scope"));
cfConfig.addConnectionFactory(ffactory);
// Google
GoogleConnectionFactory gfactory = new GoogleConnectionFactory(
env.getProperty("google.client.id"),
env.getProperty("google.client.secret"));
gfactory.setScope(env.getProperty("google.scope"));
cfConfig.addConnectionFactory(gfactory);
}
示例5: createConnectionFactory
import org.springframework.social.google.connect.GoogleConnectionFactory; //导入方法依赖的package包/类
@Override
protected ConnectionFactory<Google> createConnectionFactory() {
GoogleConnectionFactory googleConnectionFactory = new GoogleConnectionFactory(googleConsumerKey, googleConsumerSecret);
googleConnectionFactory.setScope("email");
return googleConnectionFactory;
}