I require to add Spring Security core to Grails. I have added the spring core security plugin to a grails 2.3.8 app, using: BuildConfig.groovy plugins { ... compile ":spring-security-core:2.0-RC4" ...
then s2-quickstart sim GUser GRole
The file GUserGRole.groovy contains the following errors:
Groovy:unexpected token: validator @ line 82, column 9. Multiple markers at this line - Groovy:expecting EOF, found 'if' @ line 83, column 4. - Groovy:unexpected token: if @ line 83, column 4.
which corresponds to the following code:
static constraints = {
GRole validator: { GRole r, GUserGRole ur ->
if (ur.GUser == null) return
boolean existing = false
GUserGRole.withNewSession {
existing = GUserGRole.exists(ur.GUser.id, r.id)
}
if (existing) {
return 'userRole.exists'
}
}
}
How can this be resolved? How can I cleanly add Spring Security core to Grails??