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

Java GoogleConnectionFactory类代码示例

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

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



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

示例1: getConnectionFactory

import org.springframework.social.google.connect.GoogleConnectionFactory; //导入依赖的package包/类
@Override
public ConnectionFactory<?> getConnectionFactory(String providerId) {
    HttpServletRequest req = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes())
        .getRequest();
    String domain = TenantContext.getCurrent().getDomain();
    Optional<SocialConfig> config = socialConfigRepository.findOneByProviderIdAndDomain(providerId, domain);
    if (config.isPresent()) {
        SocialConfig sc = config.get();
        switch (sc.getProviderId()) {
            case "facebook":
                return new FacebookConnectionFactory(sc.getConsumerKey(), sc.getConsumerSecret());
            case "google":
                return new GoogleConnectionFactory(sc.getConsumerKey(), sc.getConsumerSecret());
            case "twitter":
                return new TwitterConnectionFactory(sc.getConsumerKey(), sc.getConsumerSecret());
            case "linkedin":
                return new LinkedInConnectionFactory(sc.getConsumerKey(), sc.getConsumerSecret());
            default:
                break;
        }
    }
    throw new IllegalArgumentException("No provider config found for " + providerId);
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:24,代码来源:DomainConnectionFactoryLocator.java


示例2: addConnectionFactories

import org.springframework.social.google.connect.GoogleConnectionFactory; //导入依赖的package包/类
/**
   * Configures the connection factories for Facebook and Twitter.
   * @param cfConfig
   * @param env
   */
  @Override
  public void addConnectionFactories(ConnectionFactoryConfigurer cfConfig, Environment env) {
      cfConfig.addConnectionFactory(new TwitterConnectionFactory(
              env.getProperty("twitter.consumer.key"),
              env.getProperty("twitter.consumer.secret")
      ));
      cfConfig.addConnectionFactory(new GoogleConnectionFactory(
              env.getProperty("twitter.consumer.key"), //TODO !!!!!!!!!!
              env.getProperty("twitter.consumer.secret") //TODO !!!!!!!!!!
      ));
      FacebookConnectionFactory facebookFactory = new FacebookConnectionFactory(
              env.getProperty("facebook.app.id"),
              env.getProperty("facebook.app.secret"));
      facebookFactory.setScope("public_profile,email,user_friends");
cfConfig.addConnectionFactory(facebookFactory);
  }
 
开发者ID:eduyayo,项目名称:gamesboard,代码行数:22,代码来源:SocialContext.java


示例3: addConnectionFactories

import org.springframework.social.google.connect.GoogleConnectionFactory; //导入依赖的package包/类
@Override
    public void addConnectionFactories(ConnectionFactoryConfigurer config, Environment env) {
        super.addConnectionFactories(config, env);

        // Configured through AutoConfiguration:
//        config.addConnectionFactory(new TwitterConnectionFactory(
//            env.getProperty("spring.social.twitter.appId"),
//            env.getProperty("spring.social.twitter.appSecret")));
//        config.addConnectionFactory(new FacebookConnectionFactory(
//            env.getProperty("spring.social.facebook.appId"),
//            env.getProperty("spring.social.facebook.appSecret")));
//        config.addConnectionFactory(new LinkedInConnectionFactory(
//            env.getProperty("spring.social.linkedin.appId"),
//            env.getProperty("spring.social.linkedin.appSecret")));

        // Adding GitHub Connection with properties from application.yml
        config.addConnectionFactory(new GitHubConnectionFactory(
            env.getProperty("spring.social.github.appId"),
            env.getProperty("spring.social.github.appSecret")));

        // Adding Google Connection with properties from application.yml
        config.addConnectionFactory(new GoogleConnectionFactory(
            env.getProperty("spring.social.google.appId"),
            env.getProperty("spring.social.google.appSecret")));
    }
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:26,代码来源:DatabaseSocialConfigurer.java


示例4: 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;
	}
}
 
开发者ID:openanalytics,项目名称:shinyproxy,代码行数:19,代码来源:SocialConfiguration.java


示例5: 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);
}
 
开发者ID:music-for-all,项目名称:music-for-all-application,代码行数:22,代码来源:SocialConfig.java


示例6: addConnectionFactories

import org.springframework.social.google.connect.GoogleConnectionFactory; //导入依赖的package包/类
@Override
public void addConnectionFactories(ConnectionFactoryConfigurer connectionFactoryConfigurer, Environment environment) {
    connectionFactoryConfigurer.addConnectionFactory(new FacebookConnectionFactory(
        environment.getProperty("spring.social.facebook.appId"),
        environment.getProperty("spring.social.facebook.appSecret")));
    connectionFactoryConfigurer.addConnectionFactory(new TwitterConnectionFactory(
        environment.getProperty("twitter.consumerKey"),
        environment.getProperty("twitter.consumerSecret")));
    connectionFactoryConfigurer.addConnectionFactory(new LinkedInConnectionFactory(
        environment.getProperty("spring.social.linkedin.appId"),
        environment.getProperty("spring.social.linkedin.appSecret")));
    connectionFactoryConfigurer.addConnectionFactory(new GoogleConnectionFactory(
        environment.getProperty("spring.social.google.appId"),
        environment.getProperty("spring.social.google.appSecret")));
    connectionFactoryConfigurer.addConnectionFactory(new GitHubConnectionFactory(
        environment.getProperty("spring.social.github.appId"),
        environment.getProperty("spring.social.github.appSecret")));
    connectionFactoryConfigurer.addConnectionFactory(new LiveConnectionFactory(
        environment.getProperty("spring.social.live.appId"),
        environment.getProperty("spring.social.live.appSecret")));
}
 
开发者ID:callistaenterprise,项目名称:blog-social-login-with-spring-social,代码行数:22,代码来源:SocialConfig.java


示例7: addConnectionFactories

import org.springframework.social.google.connect.GoogleConnectionFactory; //导入依赖的package包/类
@Override
public void addConnectionFactories(
		final ConnectionFactoryConfigurer configurer,
		final Environment environment) {
	final GoogleConnectionFactory factory = new GoogleConnectionFactory(
			this.properties.getAppId(), this.properties.getAppSecret());
	configurer.addConnectionFactory(factory);
}
 
开发者ID:PacktPublishing,项目名称:OAuth-2.0-Cookbook,代码行数:9,代码来源:GoogleConfigurerAdapter.java


示例8: addConnectionFactories

import org.springframework.social.google.connect.GoogleConnectionFactory; //导入依赖的package包/类
@Override
public void addConnectionFactories(ConnectionFactoryConfigurer cfConfig, Environment env) {
    cfConfig.addConnectionFactory(new TwitterConnectionFactory(appSettings.getTwitterAppId(),
            appSettings.getTwitterAppSecret()));
    cfConfig.addConnectionFactory(new FacebookConnectionFactory(appSettings.getFacebookAppId(),
            appSettings.getFacebookAppSecret()));
    cfConfig.addConnectionFactory(new GoogleConnectionFactory(appSettings.getGoogleAppId(),
            appSettings.getGoogleAppSecret()));
}
 
开发者ID:mintster,项目名称:nixmash-blog,代码行数:10,代码来源:SocialConfig.java


示例9: addConnectionFactories

import org.springframework.social.google.connect.GoogleConnectionFactory; //导入依赖的package包/类
@Override
public void addConnectionFactories(ConnectionFactoryConfigurer connectionFactoryConfigurer,
		Environment environment) {
	// a TwitterConnectionFactory has already been configured elsewhere
       connectionFactoryConfigurer.addConnectionFactory(new GoogleConnectionFactory(
           environment.getProperty("spring.social.google.app-id"),
           environment.getProperty("spring.social.google.app-secret")));
       connectionFactoryConfigurer.addConnectionFactory(new GitHubConnectionFactory(
               environment.getProperty("spring.social.github.app-id"),
               environment.getProperty("spring.social.github.app-secret")));
}
 
开发者ID:Itema-as,项目名称:dawn-marketplace-server,代码行数:12,代码来源:SocialConfiguration.java


示例10: 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;
}
 
开发者ID:esutoniagodesu,项目名称:egd-web,代码行数:9,代码来源:SocialConfig.java


示例11: connectionFactoryLocator

import org.springframework.social.google.connect.GoogleConnectionFactory; //导入依赖的package包/类
@Bean
@Scope(value = "singleton", proxyMode = ScopedProxyMode.INTERFACES)
public ConnectionFactoryLocator connectionFactoryLocator() {
  ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry();
  final GoogleConnectionFactory gcf = new GoogleConnectionFactory(
      environment.getProperty("google.consumerKey"),
      environment.getProperty("google.consumerSecret"));
  registry.addConnectionFactory(gcf);
  final TwitterConnectionFactory tcf = new TwitterConnectionFactory
      (environment.getProperty("twitter.consumerKey"),
          environment.getProperty("twitter.consumerSecret"));
  registry.addConnectionFactory(tcf);
  return registry;
}
 
开发者ID:MikhailErofeev,项目名称:mars-calendar,代码行数:15,代码来源:SocialConfig.java


示例12: createConnectionFactory

import org.springframework.social.google.connect.GoogleConnectionFactory; //导入依赖的package包/类
@Override
protected ConnectionFactory<?> createConnectionFactory(
		RelaxedPropertyResolver properties) {
	GoogleConnectionFactory factory = new GoogleConnectionFactory(
			properties.getRequiredProperty("app-id"),
			properties.getRequiredProperty("app-secret"));

	return factory;
}
 
开发者ID:markoradinovic,项目名称:Vaadin4Spring-MVP-Sample-SpringSecuritySocial,代码行数:10,代码来源:GoogleAutoConfiguration.java


示例13: connectionFactoryLocator

import org.springframework.social.google.connect.GoogleConnectionFactory; //导入依赖的package包/类
/**
 * When a new provider is added to the app, register its
 * {@link ConnectionFactory} here.
 * 
 * @see GoogleConnectionFactory
 */
@Bean
public ConnectionFactoryLocator connectionFactoryLocator () {
  ConnectionFactoryRegistry registry = new ConnectionFactoryRegistry ();
  registry.addConnectionFactory (new GoogleConnectionFactory (key, secret) {
    {
      setScope ("https://www.googleapis.com/auth/userinfo.profile" +
                ";https://www.googleapis.com/auth/userinfo.email" +
                ";https://www.googleapis.com/auth/plus.me" +
                ";https://www.googleapis.com/auth/plus.login" +
                ";https://www.googleapis.com/auth/plus.circles.read");
    }
  });
  return registry;
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:21,代码来源:GoogleConfiguration.java


示例14: initializeApis

import org.springframework.social.google.connect.GoogleConnectionFactory; //导入依赖的package包/类
private void initializeApis() {
    apiTypeIndex.put(FacebookConnectionFactory.class, "facebook");
    apiTypeIndex.put(GoogleConnectionFactory.class, "google");
    apiTypeIndex.put(TwitterConnectionFactory.class, "twitter");
    apiTypeIndex.put(LinkedInConnectionFactory.class, "linkedin");
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:7,代码来源:DomainConnectionFactoryLocator.java


示例15: addConnectionFactories

import org.springframework.social.google.connect.GoogleConnectionFactory; //导入依赖的package包/类
@Override
public void addConnectionFactories(ConnectionFactoryConfigurer connectionFactoryConfigurer, Environment environment) {
    // Google configuration
    String googleClientId = environment.getProperty("spring.social.google.client-id");
    String googleClientSecret = environment.getProperty("spring.social.google.client-secret");
    if (googleClientId != null && googleClientSecret != null) {
        log.debug("Configuring GoogleConnectionFactory");
        connectionFactoryConfigurer.addConnectionFactory(
            new GoogleConnectionFactory(
                googleClientId,
                googleClientSecret
            )
        );
    } else {
        log.error("Cannot configure GoogleConnectionFactory id or secret null");
    }

    // Facebook configuration
    String facebookClientId = environment.getProperty("spring.social.facebook.client-id");
    String facebookClientSecret = environment.getProperty("spring.social.facebook.client-secret");
    if (facebookClientId != null && facebookClientSecret != null) {
        log.debug("Configuring FacebookConnectionFactory");
        connectionFactoryConfigurer.addConnectionFactory(
            new FacebookConnectionFactory(
                facebookClientId,
                facebookClientSecret
            )
        );
    } else {
        log.error("Cannot configure FacebookConnectionFactory id or secret null");
    }

    // Twitter configuration
    String twitterClientId = environment.getProperty("spring.social.twitter.client-id");
    String twitterClientSecret = environment.getProperty("spring.social.twitter.client-secret");
    if (twitterClientId != null && twitterClientSecret != null) {
        log.debug("Configuring TwitterConnectionFactory");
        connectionFactoryConfigurer.addConnectionFactory(
            new TwitterConnectionFactory(
                twitterClientId,
                twitterClientSecret
            )
        );
    } else {
        log.error("Cannot configure TwitterConnectionFactory id or secret null");
    }

    // jhipster-needle-add-social-connection-factory
}
 
开发者ID:Microsoft,项目名称:MTC_Labrat,代码行数:50,代码来源:SocialConfiguration.java


示例16: addConnectionFactories

import org.springframework.social.google.connect.GoogleConnectionFactory; //导入依赖的package包/类
@Override
public void addConnectionFactories(ConnectionFactoryConfigurer connectionFactoryConfigurer, Environment environment) {
    // Google configuration
    String googleClientId = environment.getProperty("spring.social.google.clientId");
    String googleClientSecret = environment.getProperty("spring.social.google.clientSecret");
    if (googleClientId != null && googleClientSecret != null) {
        log.debug("Configuring GoogleConnectionFactory");
        connectionFactoryConfigurer.addConnectionFactory(
            new GoogleConnectionFactory(
                googleClientId,
                googleClientSecret
            )
        );
    } else {
        log.error("Cannot configure GoogleConnectionFactory id or secret null");
    }

    // Facebook configuration
    String facebookClientId = environment.getProperty("spring.social.facebook.clientId");
    String facebookClientSecret = environment.getProperty("spring.social.facebook.clientSecret");
    if (facebookClientId != null && facebookClientSecret != null) {
        log.debug("Configuring FacebookConnectionFactory");
        connectionFactoryConfigurer.addConnectionFactory(
            new FacebookConnectionFactory(
                facebookClientId,
                facebookClientSecret
            )
        );
    } else {
        log.error("Cannot configure FacebookConnectionFactory id or secret null");
    }

    // Twitter configuration
    String twitterClientId = environment.getProperty("spring.social.twitter.clientId");
    String twitterClientSecret = environment.getProperty("spring.social.twitter.clientSecret");
    if (twitterClientId != null && twitterClientSecret != null) {
        log.debug("Configuring TwitterConnectionFactory");
        connectionFactoryConfigurer.addConnectionFactory(
            new TwitterConnectionFactory(
                twitterClientId,
                twitterClientSecret
            )
        );
    } else {
        log.error("Cannot configure TwitterConnectionFactory id or secret null");
    }
}
 
开发者ID:RawSanj,项目名称:blogAggr,代码行数:48,代码来源:SocialConfiguration.java


示例17: addConnectionFactories

import org.springframework.social.google.connect.GoogleConnectionFactory; //导入依赖的package包/类
@Override
public void addConnectionFactories(ConnectionFactoryConfigurer connectionFactoryConfigurer, Environment environment) {
    // Google configuration
    String googleClientId = environment.getProperty("spring.social.google.clientId");
    String googleClientSecret = environment.getProperty("spring.social.google.clientSecret");
    if (googleClientId != null && googleClientSecret != null) {
        log.debug("Configuring GoogleConnectionFactory");
        connectionFactoryConfigurer.addConnectionFactory(
            new GoogleConnectionFactory(
                googleClientId,
                googleClientSecret
            )
        );
    } else {
        log.error("Cannot configure GoogleConnectionFactory id or secret null");
    }

    // Facebook configuration
    String facebookClientId = environment.getProperty("spring.social.facebook.clientId");
    String facebookClientSecret = environment.getProperty("spring.social.facebook.clientSecret");
    if (facebookClientId != null && facebookClientSecret != null) {
        log.debug("Configuring FacebookConnectionFactory");
        connectionFactoryConfigurer.addConnectionFactory(
            new FacebookConnectionFactory(
                facebookClientId,
                facebookClientSecret
            )
        );
    } else {
        log.error("Cannot configure FacebookConnectionFactory id or secret null");
    }

    // Twitter configuration
    String twitterClientId = environment.getProperty("spring.social.twitter.clientId");
    String twitterClientSecret = environment.getProperty("spring.social.twitter.clientSecret");
    if (twitterClientId != null && twitterClientSecret != null) {
        log.debug("Configuring TwitterConnectionFactory");
        connectionFactoryConfigurer.addConnectionFactory(
            new TwitterConnectionFactory(
                twitterClientId,
                twitterClientSecret
            )
        );
    } else {
        log.error("Cannot configure TwitterConnectionFactory id or secret null");
    }

    // jhipster-needle-add-social-connection-factory
}
 
开发者ID:jbernach,项目名称:transandalus-backend,代码行数:50,代码来源:SocialConfiguration.java


示例18: 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);
}
 
开发者ID:DmitriyLy,项目名称:travel_portal,代码行数:23,代码来源:SocialConfig.java


示例19: addConnectionFactories

import org.springframework.social.google.connect.GoogleConnectionFactory; //导入依赖的package包/类
@Override
public void addConnectionFactories(ConnectionFactoryConfigurer configurer, Environment environment) {
  configurer.addConnectionFactory(new GoogleConnectionFactory(
    this.properties.getAppId(),
    this.properties.getAppSecret()));
}
 
开发者ID:domix,项目名称:social-google-spring-boot-starter,代码行数:7,代码来源:GoogleAutoConfiguration.java


示例20: addGoogleConfiguration

import org.springframework.social.google.connect.GoogleConnectionFactory; //导入依赖的package包/类
private void addGoogleConfiguration(ConnectionFactoryConfigurer configurer, String clientId, String clientSecret) {
  GoogleConnectionFactory googleConnectionFactory = new GoogleConnectionFactory(clientId, clientSecret);
  configurer.addConnectionFactory(googleConnectionFactory);
}
 
开发者ID:priitl,项目名称:p2p-webtv,代码行数:5,代码来源:SocialConfiguration.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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