Custom Authentication fail

Hi,

I apologizie for any english mistake i may make as I’m not a native english speaker

I set up an Openfire 3.9.3 server on my computer and I also wrote a small xmpp chat client in Java using Smack 4.0.6 .

Till now i used the embedded database and everything was working fine :

I could log in my server, chat using my own client between users, send files, etc…

But now I’d like to use my own database to authenticate and load users.

So I followed this guide : Openfire: Custom Database Integration Guide

I modified my openfire.xml file, and I verified my ofProperty table in my database was ok with the changes specified in the .xml file.

Everything seemed OK (correct queries/classnames/etc… in ofProperty).

But the authentication always fails when I try to log (using “plain” as passwordType) into my server :

With clients like Spark I get the following error message : “Invalid Username or Password”

With my own Java client, the call to :

connection.login(username, password, ressource);

ends up with :

Exception in thread "main" org.jivesoftware.smack.sasl.SASLErrorException: SASLError using PLAIN: not-authorized
  at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:348)
  at org.jivesoftware.smack.tcp.XMPPTCPConnection.login(XMPPTCPConnection.java:244)
  at XmppManager.performLogin(XmppManager.java:192) //My xmpp client (simple call to login() )
  at XmppTest.main(XmppTest.java:35) //My testing app

If I look inside my server’s log I find :

2015.02.23 16:49:32 org.jivesoftware.openfire.net.SASLAuthentication - User Login Failed. PLAIN authentication failed for: null

Using the Smack Debug Window I can see that my client sends :

<stream:stream to="MYSERVERNAME" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">
<auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">AGouZG9lAGouZG9l</auth>

I found out that AGouZG91AGouZG91 is p.taskp.task in base64. (p.task is my user’s username and also his password).

In my queries, user’s X username and password are the same for easier testing.

And receives :

<?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="tschoebel" id="df8c3b93" xml:lang="en" version="1.0"><stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth"/><register xmlns="http://jabber.org/features/iq-register"/></stream:features>
<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>

Can somebody please help me making my authentication work ?

Thx in advance,