具有配置(applicationContext-security.xml):
<authentication-manager alias="authenticationManager">
<authentication-provider>
<password-encoder hash="sha"/>
<jdbc-user-service data-source-ref="dataSource"/>
</authentication-provider>
</authentication-manager>
从另一端dataSource(我的JdbcDaoImpl)有SQL :
...
public static final String DEF_USERS_BY_USERNAME_QUERY =
"select username,password,enabled " +
"from users " +
"where username = ?";
...
sha此代码中现在有一个单词,因此从标准Spring Security users表中选择的密码未编码。
也许,我应该在休眠映射配置中sha为password列提供一些属性:
<class name="model.UserDetails" table="users">
<id name="id">
<generator class="increment"/>
</id>
<property name="username" column="username"/>
<property name="password" column="password"/>
<property name="enabled" column="enabled"/>
<property name="mail" column="mail"/>
<property name="city" column="city"/>
<property name="confirmed" column="confirmed"/>
<property name="confirmationCode" column="confirmation_code"/>
<set name="authorities" cascade="all" inverse="true">
<key column="id" not-null="true"/>
<one-to-many class="model.Authority"/>
</set>
</class>
目前,密码原样保存到DB,但是应该进行编码。
如何让applicationContextconfig和DB查询成为相同的密码编码?
慕桂英4014372
繁星coding
相关分类