OpenFire:没有河豚加密的 SHA-1 密码

发布于 2024-09-12 17:36:10 字数 725 浏览 5 评论 0原文

我希望能够创建具有直接 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北渚 2024-09-19 17:36:10

事实证明我的初始解决方案(问题中提供)是完成此功能的唯一方法。我在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文