我正在使用 Jasypt 1.9.0、Spring 3.1.1.RELEASE 和 Maven 3.0.3。使用 Jasypt 命令行工具,我生成了类似这样的密码……</p>
./digest.sh input=admin providerClassName=org.bouncycastle.jce.provider.BouncyCastleProvider algorithm=SHA-256 saltGeneratorClassName=org.jasypt.salt.ZeroSaltGenerator
但是,当我配置 Spring 安全性以尝试匹配某人在登录屏幕上输入的密码时……</p>
<beans:bean id="bcProvider" class="org.bouncycastle.jce.provider.BouncyCastleProvider" />
<beans:bean id="jasyptStringDigester" class="org.jasypt.digest.StandardStringDigester">
<beans:property name="algorithm">
<beans:value>SHA-256</beans:value>
</beans:property>
<beans:property name="provider">
<beans:ref bean="bcProvider" />
</beans:property>
<beans:property name="saltGenerator">
<beans:bean id="saltGenerator" class="org.jasypt.salt.ZeroSaltGenerator"/>
</beans:property>
</beans:bean>
<!-- This Spring Security-friendly PasswordEncoder implementation will -->
<!-- wrap the StringDigester instance so that it can be used from -->
<!-- the security framework. -->
<beans:bean id="passwordEncoder" class="org.jasypt.spring.security3.PasswordEncoder">
<property name="stringDigester">
<ref bean="jasyptStringDigester" />
</property>
</beans:bean>
<authentication-manager alias="authenticationManager" id="authenticationManager">
<authentication-provider user-service-ref="sbdUserDetailsService">
<password-encoder ref="passwordEncoder" />
</authentication-provider>
</authentication-manager>
Spring 生成的密码与存储的密码不同,因此我无法验证我的用户。我缺少一些配置吗?为什么在身份验证期间,SPring 会生成与 Jasypt 不同的东西?