OpenFire:没有河豚加密的 SHA-1 密码
我希望能够创建具有直接 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)提供“单点登录”解决方案。 )
I want to be able to create users that have a straight up SHA-1 password. No Blowfish, nothing special, just plain old vanilla SHA-1. The only way I have been able to accomplish this so far has been to extend DefaultUserProvider and override the createUser, making the following change:
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.
}
}
Is there a better way to do this? Thoughts? Suggestions?
(The reason for this "requirement" is that I am trying to access ofUser
table via mod_auth_mysql so that I can have a "single sign on" solution for all the different areas of my project such as Subversion.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明我的初始解决方案(问题中提供)是完成此功能的唯一方法。我在 openfire 支持论坛上与其他人交谈过,他们也同意。
Turns out my initial solution (provided in the question) is the only way to accomplish this functionality. I have conversed with others on the openfire support forum and they concur.