Authenticating user with Facebook using Spring Sec

2020-06-19 05:02发布

I'm using Spring Security 3.0.x and I'd like my users to authenticate using OpenId and Facebook. Currently I've got the OpenId-part working, but I'm confused about how users can login with Facebook. I've read about the OAuth for Spring security, but as fas as I undestand, it is only good for accessing resources. The example applications authenticate with username and password.

So my question is, how do I authenticate users with Facebook using Spring security?

3条回答
smile是对你的礼貌
2楼-- · 2020-06-19 05:51

You can also use https://github.com/pac4j/spring-security-pac4j which supports OAuth (Facebook, Twitter, Google...), CAS, SAML, OpenID (Connect) and GAE. See the demo: https://github.com/pac4j/spring-security-pac4j-demo

查看更多
孤傲高冷的网名
3楼-- · 2020-06-19 05:59

I have created a new project called spring-security-social for Facebook, which provides an authentication filter based on spring-security-oauth. As opposed to spring-security-facebook, it is actively maintained by acoveo software development and builts upon the new spring-security-oauth release.

查看更多
我欲成王,谁敢阻挡
4楼-- · 2020-06-19 06:00

Spring Security doesn't address this (as of yet). Check out Spring Social which is designed to connect your app to Facebook, Twitter, etc. Also check out this blog post, where they have integrated Spring Social and Spring Security.

查看更多
登录 后发表回答