Grails openid 插件 2.0.0 RC1 : getting "No such property: User exception"

标签 grails plugins openid

已安装 openid plugin 2.0.0 RC1 到我的 grails 应用程序,但我越来越 没有这样的属性:用户异常。有人可以建议应该做什么吗?

| Error 2013-10-28 00:11:55,169 [http-bio-8080-exec-6] ERROR errors.GrailsExceptionResolver  - MissingPropertyException occurred when processing request: [POST] /Test/login/openIdCreateAccount - parameters:
username: valid_gmail@gmail.com
password2: ***
password: ***
No such property: User for class: grails.plugin.springsecurity.openid.OpenIdRegisterCommand. Stacktrace follows:
Message: No such property: User for class: grails.plugin.springsecurity.openid.OpenIdRegisterCommand
   Line | Method
->> 265 | doCall   in grails.plugin.springsecurity.openid.OpenIdRegisterCommand$__clinit__closure1_closure2
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   195 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|    63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
|    53 | doFilter in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
|    49 | doFilter in grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter
|    82 | doFilter in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
|   895 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
|   918 | run      in     ''
^   695 | run . .  in java.lang.Thread

最佳答案

这个bug在RC2中没有修复,我前两天安装了它,遇到了同样的问题。实际上,OpenIdController 中有 4 个错误。我将在下面的建议答案中提及 user2576874 修复的这些错误的详细信息及其解决方案:

1:第 267 行,该类在 OpenIdRegistrationCommand 的静态闭包中引用 grailsApplication bean。这里给出的解决方案是将grailsApplication替换为:grails.util.Holders.getGrailsApplication()

2:第286行,当我们尝试在OpenId登录回调后注册用户时,正则表达式失败。这是一个更简单的 regEx 条件:

(!password.matches('^.*[a-zA-Z].*$') ||
!password.matches('^.*[0-9].*$') ||
!password.matches('^.*[!@#$%^&].*$')))

3:第183行,字段名错误:usernamePropertyName。正确的字段名称是 usernamePropName,如第 49 行所述。

4:运行代码会抛出 NullPointerException,因为 Role 类没有被定义为类型。解决方案是将类类型添加到与 User 和 UserRole 定义相同的变量 Role 中。在 OpenIdConroller 的第 255 行之后添加了以下代码:

角色 = grailsApplication.getClassForName(conf.authority.className)

谢谢

关于Grails openid 插件 2.0.0 RC1 : getting "No such property: User exception",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19624919/

相关文章:

grails - Grails中的域类构造函数?

grails - Grails GORM:映射树旧表

java - eclipse插件开发: how to open a custom editor from a cnf (on double click).

Cordova:调整相机插件会使应用程序和相机崩溃

jwt - 为什么 id_token 通过带有片段标识符而不是查询字符串的 url 传递?

grails - GORM/Grails::是否可以基于模型中List的内容进行查询?

grails - 从 Controller 传递的 gsp 参数

jquery - 关闭并重新打开 jQuery 插件

jquery - OpenID 和 Iframe

php - 集成 openID 和 oauth 作为网站登录、登录和身份验证系统