任何示例如何將Spring Boot應用程序與Spring Social Google(GabiAxel/spring-social-google)提供程序集成?我發現這個,但它似乎是未完成的。 Spring Boot解釋瞭如何使它與Spring Facebook,Twitter一起工作,但與Google登錄相同嗎?Spring Boot with Spring社交Google提供商
6
A
回答
2
正如你在你的問題中提到的,你可以使用github上託管的項目。
您可以使用此dependency
在配置類,你將不得不延長SocialConfigurerAdapter,覆蓋addConnectionFactories方法,並添加GoogleConnectionFactory。例如:
@Configuration
@EnableSocial
public class SocialConfig extends SocialConfigurerAdapter {
@Override
public void addConnectionFactories(ConnectionFactoryConfigurer connectionFactoryConfigurer, Environment environment) {
GoogleConnectionFactory googleConnectionFactory = new GoogleConnectionFactory(environment.getProperty("spring.social.google.app-id"), environment.getProperty("spring.social.google.app-secret"));
googleConnectionFactory.setScope("https://www.googleapis.com/auth/plus.login");
connectionFactoryConfigurer.addConnectionFactory(googleConnectionFactory);
}
@Bean
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
public Google google(ConnectionRepository repository) {
Connection<Google> connection = repository.findPrimaryConnection(Google.class);
return connection != null ? connection.getApi() : null;
}
}
您可以將其與Spring Social示例一起使用。
+0
非常類似於我已經。我還只有/連接映射自動添加,我不應該也有一些/登錄映射Spring Boot添加可以登錄? – Zveratko
相關問題
- 1. inMemoryAuthentication with Spring Boot
- 2. Memcached with Spring Boot
- 3. Apache-camel with spring-boot
- 4. java.lang.ClassNotFoundException:org.eclipse.jgit.api.TransportConfigCallback with spring-boot 1.5.7
- 5. Spring Boot starter社交Facebook添加權限
- 6. 帶有特定域名的Spring Boot的Google社交登錄
- 7. Spring oauth2授權提供商
- 8. Spring Boot with Jersey and Spring Security OAuth2
- 9. spring 3.1 with spring 4 with spring security 3.1:如何確保在spring安全性之前提供交易建議。
- 10. Elastic Search 5.4 with Spring Boot 1.5。*
- 11. QuerydslPredicate with spring-boot-starter-jpa
- 12. NoHandlerForCommandException with axon-spring-boot-starter
- 13. Spring Boot - Angularjs $ stateProvider with Security
- 14. Spring Boot和Google SSO
- 15. spring boot和google oauth
- 16. Grails上的spring-security-oauth2提供商提供商
- 17. Spring Boot&Spring Security未提供/靜態文件夾中的內容
- 18. Liberty Spring Boot vs Spring Boot
- 19. Spring社交XML配置
- 20. Spring社交.NET OAuth混淆
- 21. spring社交xml配置
- 22. spring boot websocket + rabbitmq stowp with undertow ClassCastException
- 23. Spring Boot Maven Plugin和Grunt with live reload
- 24. Spring RestTemplate POST with Google Translate API
- 25. 集成Spring Boot與Spring Security
- 26. GAE上的Spring Boot + Spring Data with CloudSql - 數據庫連接
- 27. Springboot with Spring OAuth2
- 28. spring-boot-starter-jta-atomikos和spring-boot-starter-batch
- 29. spring-boot-starter-tomcat vs spring-boot-starter-web
- 30. 春季社交:提供商登錄控制器
[this](https://github.com/spring-projects/spring-social-samples/tree/master/spring-social-showcase-boot)正是我所需要的,但是與Google提供商 – Zveratko