So, I am banging my head against the wall, trying to get spring-security-core-1.2.7.1 to work with Grails 2.0 ...
I looked through the tutorial and ran s2. Read that the new plugin encrypts passwords for you, so my bootstrap looks like this:
def userRole = Role.findByAuthority('ROLE_USER') ?: new Role(authority: 'ROLE_USER').save(failOnError: true) def adminRole = Role.findByAuthority('ROLE_ADMIN') ?: new Role(authority: 'ROLE_ADMIN').save(failOnError: true) def adminUser = User.findByUsername('admin') ?: new User( username: 'admin', password: "admin", enabled: true).save(failOnError: true) def testUser = User.findByUsername('test') ?: new User( username: 'test', password: "test", enabled: true).save(failOnError: true) if (!adminUser.authorities.contains(adminRole)) { UserRole.create adminUser, adminRole } if (!testUser.authorities.contains(userRole)) { UserRole.create testUser, userRole }
I can look at the H2 database, and I see the users, their encoded passwords, I see that the roles are created and can see that the user role mappings are also created correctly.
However, I still get "Sorry, we could not find the user with this username and password." in the login invitation for both users.
I have included log4j debug 'org.springframework.security', but all I really get out of the logs is:
2012-01-23 23:08:44,875 ["http-bio-8080"-exec-5] DEBUG dao.DaoAuthenticationProvider - Authentication failed: password does not match stored value
source share