Grails spring-security-core using dynamodb

Using Spring Security plugin for grails with Amazon DynamoDB plugin for Amazon DynamoDB is pretty straightforward, but there are two issues to be confronted with.

The id into your User, Role and UserRole classes has to be explicitly set to String, since DynamoDB uses UUID as default primary key hash generator. Otherwise you can set the id_generator to hilo, if you prefer to stick to Spring Security model.

Second issue is a Spring Security bug which will double encode your password if you’re using a second datasource, which is likely unless you removed hibernate from you project. A workaround is posted in the above thread

class User implements Serializable {
transient bEncoded = false
protected void encodePassword() {
if (!bEncoded ) { password = springSecurityService.encodePassword(password); bEncoded = true; }

Besides these two issues, the plugins work like a charm together.

One thought on “Grails spring-security-core using dynamodb

Leave a Reply

Your email address will not be published. Required fields are marked *