object references an unsaved transient instance - save the transient instance before flushing: security.SecUser. Stacktrace follows:java.lang.reflect.InvocationTargetException: nullat grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.groovy:53) ~[spring-security-core-3.0.3.jar:na]at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.groovy:62) ~[spring-security-core-3.0.3.jar:na] etc. and
Caused by: org.springframework.beans.InvalidPropertyException: Invalid property 'authorities' of bean class [security.SecUser]: Getter for property 'authorities' threw exception; nested exception is java.lang.reflect.InvocationTargetException
at grails.transaction.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:96) ~[grails-core-3.1.2.jar:3.1.2]
Set<SecRole> getAuthorities() {
SecUserSecRole.findAllBySecUser(this)*.secRole
}
Set<SecRole> getAuthorities() {
if(!this.id){
println "The username: ${this.username}"
println "The password: ${this.password}"
}
return [] as Set
//SecUserSecRole.findAllBySecUser(this)*.secRole
}
The username: jackson
The password: password
The username: jackson
The password: password
The username: jackson
The password: password
The username: jackson
The password: password
The username: jackson
The password: $2a$10$VRakfS5Zp2LUyLqf3zNunuBdlnmrfjTshK1fVV8i3JcnfmdiFVxk.
The username: jackson
The password: $2a$10$VRakfS5Zp2LUyLqf3zNunuBdlnmrfjTshK1fVV8i3JcnfmdiFVxk.
It’s a bug on 3.1.2. You can migrate to 3.1.3 or make this method `transient` or add `static transients = [‘authorities’]` to fix it.
See https://github.com/grails/grails-core/issues/9749 for details
Set<SecRole> getAuthorities() {
if(this.id){
return SecUserSecRole.findAllBySecUser(this)*.secRole
}
else{
return [] as Set
}
}