title: Spring Security salt for custom UserDetails
body: <p>I would like to add salt like:</p>
  
  <pre><code>PasswordEncoder encoder = new ShaPasswordEncoder();
          userDetails.setPassword(encoder.encodePassword(userDetails.getPassword(),saltSource.getSalt(userDetails));
  </code></pre>
  
  <p>as far <code>userDetails</code> is instance of my custom <code>UserDetail</code> class,i obliged to cast it to this spring class:<a href="http://static.springsource.org/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/core/userdetails/User.html" rel="noreferrer">UserDetails</a>
  ,but as it's logically expected i got in Runtime:</p>
  
  <pre><code>java.lang.ClassCastException: model.UserDetails cannot be cast to org.springframework.security.core.userdetails.UserDetails
  </code></pre>
  
  <p>config:</p>
  
  <pre><code>&lt;beans:bean id="saultSource" class="org.springframework.security.authentication.dao.ReflectionSaltSource"&gt;
          &lt;beans:property name="userPropertyToUse" value="username"/&gt;
  &lt;/beans:bean&gt;
  
  &lt;authentication-manager alias="authenticationManager"&gt;
  &lt;authentication-provider&gt;
  &lt;password-encoder hash="sha"&gt;
      &lt;salt-source user-property="username"/&gt;
  &lt;/password-encoder&gt;
      &lt;jdbc-user-service data-source-ref="dataSource"/&gt;
  &lt;/authentication-provider&gt;
  &lt;/authentication-manager&gt;
  </code></pre>
  
  <p>How can I configure <strong>salt</strong> correctly in this case?</p>