title: Grails Spring-Security -how to compare passwords-
body: <p>Im using SpringSecurity 2.0-RC2 and want users to give the possibilty to change their passwords while they are online.</p>
  
  <p>My User domain class has the following </p>
  
  <pre><code>def beforeInsert() {
      encodePassword()
  }
  
  def beforeUpdate() {
      if (isDirty('password')) {
          encodePassword()
      }
  }
  
  protected void encodePassword() {
      password = springSecurityService.encodePassword(password)
  }
  </code></pre>
  
  <p>To check whether the user was enterering the correct current password i was doing the following in a controller:</p>
  
  <pre><code>if (springSecurityService.encodePassword(params.currentPassword) == user.password) {    
  </code></pre>
  
  <p>... but surprsingly (for me) the check always fails. Even more strange if im doing this:</p>
  
  <pre><code>            println springSecurityService.encodePassword(params.currentPassword)
              println springSecurityService.encodePassword(params.currentPassword)
  </code></pre>
  
  <p>i receive the following in the console</p>
  
  <p>$2a$10$sWt7mUSHPFT.Np6m.gXyl.h8tWqblJbwtzQ6EQeMHxXMoGwOffC3e
  $2a$10$lwHz1SkNlW8ibznt.mOiruAg5eG/BTtsjM7ChyYVBvamRcrL8tucm</p>
  
  <p>(like there would be a salt - but i didnt configure one myself)</p>
  
  <p>My Settings are more or less the default settings; except the package names of the three domain classes.</p>
  
  <p>As the documention is down since severely days im asking here if somebody has a idea what im doing wrong...</p>