4

Hi i am having trouble integrating my exsisting OpenFire installtion with an already existing DB.

I have 2 database namely (for example purposes)

  1. db_mainsite
  2. db_openfire

Inside my db_mainsite i have a table called tbl_user where there lies 2 columns namely gw_userunique and gw_password (VARCHAR 255, however using SHA-1 hashing algo).

Both database lies within the same machine (server) thus having the same physical location.

In my conf/openfire.xml i have set the following lines

<jive>
  ...
  <jdbcProvider>
    <driver>com.mysql.jdbc.Driver</driver>
    <connectionString>jdbc:mysql://localhost/db_mainsite?user=username&amp;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>

Sadly, whenever i try to login using the username + password stored in db_mainsite it always fails.

I have restart OpenFire as well.

Can anyone tell me what is wrong?

Cheers,

1 Answer 1

0

no need to modify config file, just run script in your openfire database( validated in 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'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.