您好,我无法将现有的OpenFire安装与现有的数据库集成。
我有2个数据库(例如用途)
在我的db_mainsite中,我有一个名为tbl_user的表,其中有两列,即gw_userunique和gw_password(VARCHAR 255,但是使用SHA-1哈希算法)。
两个数据库都位于同一台机器(服务器)内,因此具有相同的物理位置。
在我的conf / openfire.xml中,我设置了以下行
<jive>
...
<jdbcProvider>
<driver>com.mysql.jdbc.Driver</driver>
<connectionString>jdbc:mysql://localhost/db_mainsite?user=username&password=secret</connectionString>
</jdbcProvider>
<provider>
<auth>
<className>org.jivesoftware.openfire.auth.JDBCAuthProvider</className>
</auth>
</provider>
<jdbcAuthProvider>
<passwordSQL>SELECT password FROM tbl_user WHERE gw_userunique=?</passwordSQL>
<passwordType>sha1</passwordType>
</jdbcAuthProvider>
...
</jive>
可悲的是,每当我尝试使用存储在db_mainsite中的用户名+密码登录时,它总是会失败。
我也重启了OpenFire。
谁能告诉我出了什么问题?
干杯,
答案 0 :(得分:0)
无需修改配置文件,只需在openfire数据库中运行脚本(在3.10.3中验证):
## add jdbc drive
INSERT INTO `ofproperty` VALUES ('jdbcProvider.driver', 'com.mysql.jdbc.Driver');
## external membership database connection
INSERT INTO `ofproperty` VALUES ('jdbcProvider.connectionString', 'jdbc:mysql://youripaddress:3306/db_mainsite?user=root&password=root');
## auth
UPDATE `ofproperty` SET propValue='org.jivesoftware.openfire.auth.JDBCAuthProvider' WHERE NAME='provider.auth.className';
## search password
INSERT INTO `ofproperty` VALUES ('jdbcAuthProvider.passwordSQL', 'SELECT plainPassword FROM dzmembership WHERE id= ?');
## encrypted type:plain,md5,sha1,sha256,sha512
INSERT INTO `ofproperty` VALUES ('jdbcAuthProvider.passwordType', 'plain');
## displyed in admin console
UPDATE `ofproperty` SET propValue='org.jivesoftware.openfire.user.JDBCUserProvider' WHERE NAME='provider.user.className';
## uyser info in admin console
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.loadUserSQL', 'SELECT username AS NAME,concat(username,''_'',nickname) FROM dzmembership WHERE id=?');
## user amount
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.userCountSQL', 'SELECT COUNT(*) FROM dzmembership');
## all users
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.allUsersSQL', 'SELECT id FROM dzmembership');
## search
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.searchSQL', 'SELECT id FROM dzmembership WHERE');
## username displayed in console
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.usernameField', 'username');
## id displayed in console
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.nameField', 'id');
## email displayed in console
INSERT INTO `ofproperty` VALUES ('jdbcUserProvider.emailField', 'email');
##admin username
INSERT INTO `ofproperty` VALUES ('admin.authorizedJIDs', '13cb2932-e855-4c3e-8e54-a58e0135802d@ipaddress');
UPDATE ofproperty SET propValue='ipaddress' WHERE NAME='xmpp.domain'