【发布时间】:2011-03-25 11:47:39
【问题描述】:
我希望能够创建具有直接 SHA-1 密码的用户。没有河豚,没什么特别的,只是普通的老式香草 SHA-1。到目前为止,我能够做到这一点的唯一方法是扩展 DefaultUserProvider 并覆盖 createUser,进行以下更改:
if (!usePlainPassword) {
try {
encryptedPassword = StringUtils.hash(password.getBytes(),"SHA-1");
// encryptedPassword = AuthFactory.encryptPassword(password);
// Set password to null so that it's inserted that way.
password = null;
} catch (UnsupportedOperationException uoe) {
// Encrypting the password may have failed if in setup mode.
// Therefore, use the plain password.
}
}
有没有更好的方法来做到这一点?想法?有什么建议吗?
(这个“要求”的原因是我试图通过 mod_auth_mysql 访问ofUser 表,以便我可以为我的项目的所有不同区域(例如 Subversion)提供一个“单点登录”解决方案。)
【问题讨论】:
标签: php xmpp openfire smack asmack