Search code examples
mongodbgrailsspring-securitygrails-orm

Grails spring security core 3.1.2 and mongodb


I have been using spring-security-ccore 3.1.1 a while. I decided to update to 3.1.2, but I found some problems working together with mongodb database.

Since the password encoding is not directly in domain class enter image description here

I'm using mongoDB as primary database, so I commented all hibernate plugins. enter image description here

This is the error. enter image description here

Is it missing something? I know the bean name is 'hibernateDatastore', but I did not find any documentation relate about mongodb and spring security.

Should I use the password encoding directly in domain class?

enter image description here

User.groovy (With mongodb modifications)

enter image description here

application.yml

enter image description here

gradle.properties

enter image description here


Solution

  • I have created a simple app with Spring Security Core and MongoDB:

    https://github.com/grails-spring-security-samples/grails-ssc-mongodb

    You need to modify slightly the output of s2-quickstart

    You would need to replace in grails-app/conf/spring/resources.groovy

    userPasswordEncoderListener(UserPasswordEncoderListener, ref('hibernateDatastore'))
    

    with:

    userPasswordEncoderListener(UserPasswordEncoderListener, ref('mongoDatastore'))