On some redirections I get an error message complaining
The specified user domain class 'Person' is not a domain classWith a Config.groovy like this
//spring security configuration
grails.plugins.springsecurity.providerNames = [
'myAuthenticationProvider'
]
grails.plugins.springsecurity.rejectIfNoRule = false
grails.plugins.springsecurity.controllerAnnotations.staticRules = [
'/setting/**': ['ROLE_ADMIN'],
'/*': ['ROLE_USER'],
]
// Added by the Spring Security Core plugin:
//grails.plugins.springsecurity.userLookup.userDomainClassName = 'foo.User'
//grails.plugins.springsecurity.userLookup.authorityJoinClassName = 'foo.UserRole'
//grails.plugins.springsecurity.authority.className = 'foo.Role'
I'd expect the security plugin doesn't check for persistent user class.
I've seen SpringSecurityCoreGrailsPlugin.addControllerMethods(MetaClass, Object) does the following:
if (!mc.respondsTo(null, 'getAuthenticatedUser')) {
mc.getAuthenticatedUser = { ->
if (!ctx.springSecurityService.isLoggedIn()) return null
String userClassName = SpringSecurityUtils.securityConfig.userLookup.userDomainClassName
def dc = ctx.grailsApplication.getDomainClass(userClassName)
if (!dc) {
throw new RuntimeException("The specified user domain class '$userClassName' is not a domain class")
}
Class User = dc.clazz
User.get SCH.context.authentication.principal.id
}
}Isn't it possible to completely avoid having a user class that is not persistent (i.e. GrailsUser)?
I'm using plugins.spring-security-core=1.2.7.2