1.spring-shiro配置文件中配置加密器
<!--加密器-->
<bean id="credentialsMatcher" class="org.apache.shiro.authc.credential.HashedCredentialsMatcher">
<!--加密算法-->
<property name="hashAlgorithmName" value="md5" />
<!--散列次数-->
<property name="hashIterations" value="3" />
</bean>
2.自定义realm引用加密器
<!--配置自定义的realm-->
<bean id="userRealm" class="cn.wolfcode.shiro.realm.UserRealm">
<!--密码需要加密:加密器-->
<property name="credentialsMatcher" ref="credentialsMatcher" />
</bean>
3.修改UserRealm中的认证操作, 添加加密的盐