Grails Spring security facebook 插件示例 FacebookAuthDAOImpl

发布于 2024-12-23 04:08:01 字数 931 浏览 3 评论 0原文

我开始研究 这个插件,以便将 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 或普通用户....这就是我继续查看的原因使用来自 DefaultConnectedFacebookAuthDaoImplcreateAppUser()

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

別甾虛僞 2024-12-30 04:08:01

插件已更新(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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文