[英]Salting a password with spring 3 security
我整天都在嘗試尋找或使用Google,如何在通過Spring 3 security
進行身份驗證的過程中將salt
添加到我的哈希密碼中,並使它們一起工作。 不加鹽就可以。
<!-- authentication from database -->
<security:authentication-manager>
<security:authentication-provider>
<security:password-encoder hash='md5'/>
<security:jdbc-user-service
data-source-ref='dataSource'
users-by-username-query="
select username,password, salt
from users where username=?"
authorities-by-username-query="
select u.username, ur.authority from users u, user_roles ur
where u.user_id = ur.user_id and u.username =? " />
</security:authentication-provider>
</security:authentication-manager>
而且,如果我想創建加鹽的pasword,只需通過user.setPassword(md5(somePassword+someSalt));
感謝您的任何建議。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.