Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Installed openid plugin 2.0.0 RC1 to my grails application, but I'm getting No such property: User exception. Can someone suggest what should be done?

| 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: [email protected]
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
like image 465
user2576874 Avatar asked Dec 04 '25 14:12

user2576874


1 Answers

The bug is not fixed in RC2, I installed it 2 days ago and ran into the same problem. Actually, there are 4 errors in OpenIdController. I'll mention the details of these errors and their solutions that user2576874 fixed in his suggested answer below:

1: line 267, the class refers to grailsApplication bean in a static closure of OpenIdRegistrationCommand. The solution given here is to replace grailsApplication by: grails.util.Holders.getGrailsApplication()

2: line 286, the regEx fail when we try to register a user after an OpenId login callback. Here's a simpler regEx condition:

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

3: line 183, there was a mistake with the field name: usernamePropertyName. The right field name is usernamePropName as described in line 49.

4: Running the code throws a NullPointerException because of the Role class not being defined a type. The solution was to add the class type to the variable Role same like User and UserRole definition. The following code was added right after line 255 of OpenIdConroller:

Role = grailsApplication.getClassForName(conf.authority.className)

Thx

like image 192
Baha Avatar answered Dec 06 '25 06:12

Baha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!