如何将 spring security 与 rest oauth2 服务和 spring social 集成?

Posted

技术标签:

【中文标题】如何将 spring security 与 rest oauth2 服务和 spring social 集成?【英文标题】:How can I integrate spring security with rest oauth2 services and spring social? 【发布时间】:2017-02-19 00:59:12 【问题描述】:

我有一个应用程序 (A) 公开使用 oauth2 保护的 REST 服务。 (弹簧安全 oauth2/弹簧网络) 我想创建第二个应用程序 (B)(spring-boot 或普通 spring),我可以从中登录,然后从 A 调用 REST 服务。

如何在应用 B 中配置安全性,以便既可以使用社交登录(facebook、twitter、google)又可以从应用 A 调用 REST 服务?有没有使用spring security/oauth/social integration的例子?

我找到了一些示例,但没有一个说明如何集成它们

【问题讨论】:

【参考方案1】:

您是否尝试过使用 FB 和 Google 登录的Spring oAuth2 tutorial?这还包括本地登录。教程右栏中的链接中的所有代码都可以在 git 中找到。

【讨论】:

我之前尝试过,但它不是我想要的。我一直在寻找一个简单的解决方案,这帮助我理解我必须真正了解事情是如何工作的,而不仅仅是“采用那个配置”“把它放在那里”。所以我会将此标记为答案:) 大喜欢

以上是关于如何将 spring security 与 rest oauth2 服务和 spring social 集成?的主要内容,如果未能解决你的问题,请参考以下文章

Spring Security + Keycloak 授权:如何将端点与资源相关联?

如何将 Spring Security 与 Spring Boot Rest API 一起使用?

如何将 ActiveDirectory 与 Spring-Security LDAP 一起使用

如何将 OAuth 身份验证与 Spring Security 联系起来

如何将 spring security 与 rest oauth2 服务和 spring social 集成?

Spring Security:如何将 UserDetailsS​​ervice 与 JwtAuthenticationProvider 一起使用?