Grails - Spring Security / Social - Facebook 插件 setAccessToken 和 getAccessToken

发布于 2024-12-22 12:24:14 字数 1561 浏览 1 评论 0原文

我刚刚完成此页面上的安装说明:
http://grails.org/plugin/spring-security-facebook

我选择 AuthUser User 域对象名称和 AuthRole 作为我的 Role 域对象名称。在所有其他问题中,我选择默认值或输入我的 Facebook 应用程序 ID 或 Facebook 应用程序密钥。

在该过程结束时,我有一个 AuthUser 作为我的用户。我还有一个实现 FacebookUserDomain 的 FacebookUser。

当我尝试运行该应用程序时,它告诉我我尚未在 FacebookUser 中实现 getAccessToken 或 setAccessToken。这是 FacebookUserDomain 接口所要求的。这是正常的吗?文档需要填写吗?处理这个问题的正确方法是什么?

更新
这是我尝试用来解决问题的 FacebookUser 类代码。

class FacebookUser implements FacebookUserDomain {
  long uid
  String secret
  String session
  String email
  String accessToken

  static belongsTo = [user: AuthUser]

  static constraints = {
    uid unique: true
  }

  public String getAccessToken() {
    return accessToken
  }

  public void setAccessToken(String accessToken) {
    this.accessToken = accessToken
  }
}

还收到此错误:配置 Spring Security Core ... ...完成配置 Spring Security Core

配置 Spring Security Facebook ... 错误:没有为 Facebook Auth 配置 dao 错误:停止配置 Spring Security Facebook 2011-12-19 19:17:30,261 [main] 错误 util.JDBCExceptionReporter - 未知列 n “where 子句”中的“deactivate_code” 无法执行本机批量操作查询 2011-12-19 19:17:30,496 [main] 错误 context.GrailsContextLoader - 执行错误 ing bootstraps:找不到类 [class lmfirst] 的名称 [facebookId] 的属性 .Auth用户] org.codehaus.groovy.grails.exceptions.InvalidPropertyException:没有找到属性 d 代表名称 [facebookId] 代表类别 [class lmfirst.AuthUser] 在 lmfirst.UtilService.createMayor(UtilService.groovy:20)

I just got done walking through the install instructions on this page:
http://grails.org/plugin/spring-security-facebook

I choose AuthUser for the User domain object name and AuthRole as my Role domain object name. In all other questions I choose the defaults or put in my Facebook App ID or Facebook App Secret.

At the end of the process I have a AuthUser as my User. I also have a FacebookUser that implements FacebookUserDomain.

When I try to run the app it tells me I haven't implemented getAccessToken or setAccessToken in my FacebookUser. This is being required by the FacebookUserDomain interface. Is this normal? Does the documentation need to be completed? What is the correct way to handle this?

UPDATE
Here is the FacebookUser class code I tried to use to solve the problem.

class FacebookUser implements FacebookUserDomain {
  long uid
  String secret
  String session
  String email
  String accessToken

  static belongsTo = [user: AuthUser]

  static constraints = {
    uid unique: true
  }

  public String getAccessToken() {
    return accessToken
  }

  public void setAccessToken(String accessToken) {
    this.accessToken = accessToken
  }
}

Also getting this error:Configuring Spring Security Core ...
... finished configuring Spring Security Core

Configuring Spring Security Facebook ...
ERROR: There is no dao configired for Facebook Auth
ERROR: Stop configuring Spring Security Facebook
2011-12-19 19:17:30,261 [main] ERROR util.JDBCExceptionReporter - Unknown colum
n 'deactivate_code' in 'where clause'
could not execute native bulk manipulation query
2011-12-19 19:17:30,496 [main] ERROR context.GrailsContextLoader - Error execut
ing bootstraps: No property found for name [facebookId] for class [class lmfirst
.AuthUser]
org.codehaus.groovy.grails.exceptions.InvalidPropertyException: No property foun
d for name [facebookId] for class [class lmfirst.AuthUser]
at lmfirst.UtilService.createMayor(UtilService.groovy:20)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

柠北森屋 2024-12-29 12:24:14

您不需要对 accessToken 进行获取/设置,因为它是由 Groovy 本身自动添加的。拥有 String accessToken 就足够了

至于 Facebook Auth dao - 您执行了 grails s2-init-facebook 了吗?它为您生成默认的 Dao 实现,并将其注册到 conf/spring/resources.groovy

You don't need to make get/set for accessToken, as it automaticaly added by Groovy itself. Having String accessToken is enought

As about Facebook Auth dao - did you executed grails s2-init-facebook? It generates default Dao implementation for you, and register it at conf/spring/resources.groovy

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