Integrating Facebook login (oauth) with existing grails application using spring-security-core plugin
I have an existing grails application that uses spring-security plugin for authentication. I would like to add Facebook connect/login which can be done via Oauth (3 legged). However, spring security plugin now does not support Oauth out of t开发者_JAVA百科he box. Any suggestions on how to go about adding it? If you have done this before, examples would be great. Thank you.
I started out using this:
http://www.grails.org/plugin/facebook-graph
And then I had to switch to:
http://www.janrain.com/products/engage
because I needed more than just Facebook. However, neither integrate directly with Spring Security. I was able to get it working though but taking the information Facebook returns and associating that to a particular User and then manually logging in through the Spring Security mechanism. However, the solution is too much for an answer here.
I had planned on blogging about it but haven't had time. If I do, I'll be sure and link to it here. Sorry I can't be of more help. But the Facebook Graph plugin is a very good place to start.
There is OAuth for Spring Security. The site has links to tutorial as well as sample project, which uses both OAuth 1.0 and OAuth 2.0. No idea how it can be used in grails though:(
This exists, but there is no documentation, and I couldn't figure out how to use it.
https://github.com/grails-plugins/grails-spring-security-oauth-provider
If a bit of Java doesn't scare you, I would take a look at this: http://www.springsource.org/spring-social
It has a demo site too
This project uses much of the same technology as Grails does under the hood. All sources are available for you to read. I have the same task coming up for my current Grails project and this is where I'll go for inspiration.
There is now an actively developed plugin for FaceBook that integrates with the spring security core plugin
http://grails.org/plugin/spring-security-facebook
There are similar plugins for Twitter, etc.
精彩评论