I have checked this forum and the docs, but found no answer to this question, that is, how can I do a basic Spring Security configuration setup using a basic java Object as a salt for MD5 encoding?
Here is my Spring Security context snippet configuration:
<beans:bean id="saltSource" class="com.myproject.sec.util.MyString" scope="singleton" >
<beans:constructor-arg value="12345" />
</beans:bean>
<authentication-manager alias="authenticationManager">
<authentication-provider user-service-ref="userService">
<password-encoder hash="md5">
<salt-source ref="saltSource" />
</password-encoder>
</authentication-provider>
</authentication-manager>
...but this configuration throws an unwanted error Exception complaining that the Salt source is not of org.springframework.security.authentication.dao.SaltSource interface, but I do not want to use a property of User details as my salt (as this interface supports User Details), but rather my custom String Object as demonstrated above. How do I do achieve this?
Also, as a second closely related question, I know I can get the Salt as the Username like this:
<authentication-manager alias="authenticationManager">
<authentication-provider user-service-ref="userService">
<password-encoder hash="md5">
<salt-source user-property="username"/>
</password-encoder>
</authentication-provider>
</authentication-manager>
and, have a system wide fixed Salt of "12345" like this:
<authentication-manager alias="authenticationManager">
<authentication-provider user-service-ref="userService">
<password-encoder hash="md5">
<salt-source system-wide="12345"/>
</password-encoder>
</authentication-provider>
</authentication-manager>
...but how do I get the Salt as a concatenation of both the Username and system wide constant of "12345", e.g., if the username is fred, to have the Salt as "fred12345" without resorting to overriding to implement my own Encoding?