Grails Spring security facebook 插件示例 FacebookAuthDAOImpl
我开始研究 这个插件,以便将 facebook 集成到 grails 2.0 应用程序中。我浏览了列出的设置说明,并得到了一个示例应用程序的工作......大部分。
我在充实实现 FacebookAuthDao 接口的 FacebookAuthDaoImpl
时遇到问题。现在我知道这个类应该配置为匹配应用程序域结构,但是对于没有异常域设置的示例应用程序,该接口的适当实现是什么?
我想要实现的是,当创建 facebook 用户时,还应该创建一个 spring security 用户,并且它们都关联起来。
编辑:
运行 s2-init-facebook 并获取生成的 FacebookAuthDaoImpl 后。 我执行了 run-app
,然后在生成的 impl 的 getRoles()
中收到错误角色。
No such property: roles for class: com.gotomanners.auth.FacebookUser
我通过添加
roles = [new GrantedAuthorityImpl('ROLE_USER'), new GrantedAuthorityImpl('ROLE_FACEBOOK')]
应用程序现在启动正常,我可以单击连接到 facebook 的 fbConnect 按钮来修复此问题,但返回到应用程序时,数据库中没有 facebookUser 或普通用户....这就是我继续查看的原因使用来自 DefaultConnectedFacebookAuthDaoImpl
的 createAppUser()
I started looking at this plugin for facebook integration in grails 2.0 apps. I ran through he setup instructions listed and got a sample app working....for the most part.
I'm having problems fleshing out FacebookAuthDaoImpl
which implements the interface FacebookAuthDao
. Now I know this class is supposed to be configured to match the apps domain structure, but for a sample app with no out-of-the-ordinary domain settings what would be an appropraite implementation of this interface?
What I'm trying to achieve is when a facebook user is created, a spring security user should also be created and they both be associated.
Edit:
After running s2-init-facebook
and getting the generated FacebookAuthDaoImpl
.
I executed run-app
and then I get an error roles in getRoles()
of the generated impl.
No such property: roles for class: com.gotomanners.auth.FacebookUser
I fixed this by adding
roles = [new GrantedAuthorityImpl('ROLE_USER'), new GrantedAuthorityImpl('ROLE_FACEBOOK')]
The app starts fine now and I can click the fbConnect button which connects to facebook fine but on returning to the app there is no facebookUser or regular user in the DB .... which is why I went on to look at using createAppUser()
from DefaultConnectedFacebookAuthDaoImpl
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此插件已更新(
0.6.2
at this撰写本文时),这个问题现已解决!This plugin has since been updated(
0.6.2
at this time of writing) and this issue is now resolved!