title: Grails Spring-Security-Core plugin - Cannot authenticate user
body: <p>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...</p>
  
  <p>I have looked at the tutorial and run s2. Read that the new plugin encrypts passwords for you, so my bootstrap looks like:</p>
  
  <pre><code>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
      }
  </code></pre>
  
  <p>I can look at the H2 database and I see the users, their encoded passwords, see that the roles are created and can see the user role mappings are properly created as well.</p>
  
  <p>However, I still get "Sorry, we were not able to find a user with that username and password." at the login prompt for both users.  </p>
  
  <p>I have turned on log4j debug 'org.springframework.security' but all I really get out of the logs is:</p>
  
  <pre><code>2012-01-23 23:08:44,875 ["http-bio-8080"-exec-5] DEBUG dao.DaoAuthenticationProvider  - Authentication failed: password does not match stored value
  </code></pre>