Grails - Spring Security / Social - Facebook 插件 setAccessToken 和 getAccessToken
我刚刚完成此页面上的安装说明:
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要对 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 enoughtAs about Facebook Auth dao - did you executed
grails s2-init-facebook
? It generates default Dao implementation for you, and register it atconf/spring/resources.groovy