Hi
i’m trying to use my own database to authenticate users.
This is my user database(the database name is “frisr”):
CREATE TABLE IF NOT EXISTS `salons` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`email` varchar(15) DEFAULT NULL,
`phone` int(11) DEFAULT NULL,
`connected` int(11) NOT NULL,
`username` varchar(100) DEFAULT NULL,
`password` varchar(200) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
And this is what i’ve inserted into the ofProperty:
--
-- Table structure for table `ofProperty`
-- CREATE TABLE IF NOT EXISTS `ofProperty` (
`name` varchar(100) NOT NULL,
`propValue` text NOT NULL,
PRIMARY KEY (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; --
-- Dumping data for table `ofProperty`
-- INSERT INTO `ofProperty` (`name`, `propValue`) VALUES
('passwordKey', 'XXXX'),
('xmpp.socket.ssl.active', 'true'),
('xmpp.domain', 'frisr.dk'),
('provider.admin.className', 'org.jivesoftware.openfire.admin.DefaultAdminProvider'),
('provider.lockout.className', 'org.jivesoftware.openfire.lockout.DefaultLockOutProvider'),
('provider.user.className', 'org.jivesoftware.openfire.user.DefaultUserProvider'),
('provider.auth.className', 'org.jivesoftware.openfire.auth.JDBCAuthProvider'),
('xmpp.auth.anonymous', 'true'),
('provider.group.className', 'org.jivesoftware.openfire.group.DefaultGroupProvider'),
('provider.vcard.className', 'org.jivesoftware.openfire.vcard.DefaultVCardProvider'),
('provider.securityAudit.className', 'org.jivesoftware.openfire.security.DefaultSecurityAuditProvider'),
('xmpp.session.conflict-limit', '0'),
('update.lastCheck', '1309985119064'),
('plugin.presence.public', 'true'),
('plugin.presence.unavailable.status', 'Unavailable'),
('register.inband', 'false'),
('register.password', 'false'),
('locale.timeZone', 'Europe/Berlin'),
('xmpp.offline.type', 'store_and_bounce'),
('xmpp.offline.quota', '1048576'),
('jdbcAuthProvider.passwordSQL', 'SELECT password FROM salons WHERE username=?'),
('jdbcProvider.connectionString', 'jdbc:mysql://localhost/frisr?username=USERNAME&password=PASSWORD'),
('jdbcProvider.driver', 'com.mysql.jdbc.Driver'),
('jdbcAuthProvider.passwordType', 'plain');
And this is how i edit my openfire.xml:
<port>9090</port>
<securePort>9091</securePort>
</adminConsole>
<locale>en</locale>
<!-- Network settings. By default, Openfire will bind to all network interfaces.
Alternatively, you can specify a specific network interfaces that the server
will listen on. For example, 127.0.0.1. This setting is generally only useful
on multi-homed servers. -->
<!--
<network>
<interface></interface>
</network>
-->
<connectionProvider>
<className>org.jivesoftware.database.DefaultConnectionProvider</className>
<!-- DefaultConnectionProvider</className> -->
</connectionProvider>
<database>
<defaultProvider>
<driver>com.mysql.jdbc.Driver</driver>
<serverURL>jdbc:mysql://localhost:3306/jabber</serverURL>
<username>jabber</username>
<password>mangePenge</password> <testSQL>select 1</testSQL>
<testBeforeUse>true</testBeforeUse>
<testAfterUse>true</testAfterUse>
<minConnections>5</minConnections>
<maxConnections>25</maxConnections>
<connectionTimeout>1.0</connectionTimeout>
</defaultProvider>
</database>
<setup>true</setup> <jdbcProvider>
<driver>com.mysql.jdbc.Driver</driver>
<connectionString>jdbc:mysql://localhost/frisr?user=USERNAME&password=PASSWORD</connectionString>
</jdbcProvider>
<provider>
<auth>
<className>org.jivesoftware.openfire.auth.JDBCAuthProvider</className>
</auth>
</provider>
<jdbcAuthProvider>
<passwordSQL>SELECT password FROM salons WHERE username=?</passwordSQL>
<passwordType>plain</passwordType>
</jdbcAuthProvider>
</jive>
So right now, if i restart openfire server it will remove what i’ve put into the openfire.xml file and i get this error when trying to log in to adminpanel of openfire:
Login failed: make sure your username and password are correct and that you’re an admin or moderator
thx, Daniel