JDBCAuthProvider problems

Hi guys, im from a company in Cape Town, South Africa called Link: Breakdesign and have been investigatig using wildfire for the last week…

As far as I undertstand it, JDBCAuthProvider can let you validate users off a DB other than the one used by wildfire usually…the instructions in a thread i read on here and in the documentation basically suggested editing your wildfire.xml file and adding some nodes with SQL statements and such…

now initially I wanted to use hybridAuthProvider so i could try and authenticate against the existing wildfire database on a mysql server and also against a custom table of users that we have…ive edited myswildfire.xml which ill paste below this…but when i connect to my server with spark and try to use one of the user names and passwords in our database it refuses to authenticate and just returns ''Invalid user name or password ‘’.

Any help you guys could give me would be greatly appreciated:)

Jon

Wildfire.xml:


ok as an update to this problem ive ironed out some sql errors in those queries…ive turned on logging in mysql and when i try to log in via admin or spark i can see the user ive specified in that log file logging…but no queries to validate the user after that? why? am i just being incredibly dense here?

Breakdesign,

I actually made some significant improvements to the JDBC providers for the 3.0.1 release (coming out later today). I even included documentation.

So, I’'d recommend checking out the docs and code in 3.0.1 as a good first step and then we can debug from there.

Regards,

Matt

hi matt:) thank you so much for your help…that documenation is very helpful…however…ummwhen i follwo the steps as prescribed and start the server it throws the following errors…

2006.07.14 11:04:52 [org.jivesoftware.util.JiveGlobals.loadSetupProperties(JiveGlobals.java:752)

]

java.io.IOException: Error on line 81 of document : The reference to entity “password” must end with the ‘’;’’ delimiter. Nested exception: The reference to entity “password” must end with the ‘’;’’ delimiter.

at org.jivesoftware.util.XMLProperties.buildDoc(XMLProperties.java:435)

at org.jivesoftware.util.XMLProperties.

new error output on login page:

ava.lang.UnsupportedOperationException

at org.jivesoftware.wildfire.auth.JDBCAuthProvider.getPassword(JDBCAuthProvider.ja va:165)

at org.jivesoftware.wildfire.auth.JDBCAuthProvider.authenticate(JDBCAuthProvider.j ava:103)

at org.jivesoftware.wildfire.auth.AuthFactory.authenticate(AuthFactory.java:127)

at org.jivesoftware.wildfire.admin.login_jsp._jspService(login_jsp.java:134)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)

at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:830)

at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:39)

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:821)

at org.jivesoftware.util.LocaleFilter.doFilter(LocaleFilter.java:65)

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:821)

at org.jivesoftware.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingF ilter.java:41)

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:821)

at org.jivesoftware.admin.PluginFilter.doFilter(PluginFilter.java:69)

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:821)

at org.jivesoftware.admin.AuthCheckFilter.doFilter(AuthCheckFilter.java:98)

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:821)

at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler. java:471)

at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)

at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)

at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.ja va:633)

at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)

at org.mortbay.http.HttpServer.service(HttpServer.java:909)

at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)

at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:982)

at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)

at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)

at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)

at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)

incidentally…looking in the logs of the mysql server—using neither of connection strings does the user appear to connect…

if you could help me with this i’'d be so grateful

yours sincerely

Jon

Alright it is erroring at this line of code first—line 165 in JDBCAuthProvider.java

if (!supportsPasswordRetrieval()) {

throw new UnsupportedOperationException();

}

so i look at supportsPasswordRetrieval() and it ooks like this…

public boolean supportsPasswordRetrieval() {

return (passwordSQL != null && passwordType == PasswordType.plain);

}

and if i look for the first time that passwordSQL is set it is set so:

passwordSQL = JiveGlobals.getXMLProperty(“jdbcAuthProvider.passwordSQL”);

my xml layout for those nodes looks like so:

so it looks like passwordSQL is null and hence the exception in the last post is thrown…but why would the xml parser not parse that particular node…or am i just being really dumb :):)???

The problem is actually in your connection string setting. The “&” character has special meaning in XML, which is why the XML parser is getting confused by “&password”. Two choices:

  1. Make it a CDATA section.

  2. Escape the “&” by making it “&”, so it would be “&password”.

#2 is a pretty easy option. Let me know if that works. I’'ll also update the documentation to warn people about this case.

Regards,

Matt

Hi Matt

umm changed the connection string to contain a CDATA section…thus escaping the &…

but still the exception as below…

Exception:

java.lang.UnsupportedOperationException

at org.jivesoftware.wildfire.auth.JDBCAuthProvider.getPassword(JDBCAuthProvider.ja va:165)

at org.jivesoftware.wildfire.auth.JDBCAuthProvider.authenticate(JDBCAuthProvider.j ava:103)

umm hmmm…:slight_smile:

Umm…also tried makin the whole connection string a CDATA section such as so…

but still the same exception as above…

Jon

Jon,

Any more detail on the UnsupportedOperation error? Are you still seeing the XML parsing exception?

Regards,

Matt

hi matt

no the xml parsing error is gone…the server laucjes without displaying any errors…when i launch the admin page it comes up fine…but when i try to log in this is what is see in the browser window(with any combination of all those different connection strings above and others…specifying the port number…leaving it out…using ip address instead of localhost…but without failure the following debug message pops up…and its not as a result of firewalls or anything like that…dropped mine to test…and the same exception…feeling a bit stumped here to tell you the truth:)…um the exception appears as below:)

Exception:

java.lang.UnsupportedOperationException

at org.jivesoftware.wildfire.auth.JDBCAuthProvider.getPassword(JDBCAuthProvider.ja va:165)

at org.jivesoftware.wildfire.auth.JDBCAuthProvider.authenticate(JDBCAuthProvider.j ava:103)

at org.jivesoftware.wildfire.auth.AuthFactory.authenticate(AuthFactory.java:127)

at org.jivesoftware.wildfire.admin.login_jsp._jspService(login_jsp.java:134)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)

at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:830)

at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:39)

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:821)

at org.jivesoftware.util.LocaleFilter.doFilter(LocaleFilter.java:65)

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:821)

at org.jivesoftware.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingF ilter.java:41)

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:821)

at org.jivesoftware.admin.PluginFilter.doFilter(PluginFilter.java:69)

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:821)

at org.jivesoftware.admin.AuthCheckFilter.doFilter(AuthCheckFilter.java:98)

My xml config file in entirety appears as so (myabe ive got something out of place that is causing this exception).

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:821)

at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler. java:471)

at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)

at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)

at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.ja va:633)

at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)

at org.mortbay.http.HttpServer.service(HttpServer.java:909)

at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)

at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:982)

at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)

at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)

at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)

at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)

I’'ll try to get to the bottom of this tomorrow using the same settings that you have.

Regards,

Matt

Thanks so much matt. have to say your guys taking the time and having the patience to work through these problems really is great…so thank you very very much for helping me with these issues:)

regards

Jon

Jon,

Just to confirm – are you using Wildfire 3.0.1 at this point?

Regards,

Matt

yes…wildfire 3.0.1 :)…

Wildfire 3.0.1

Admin console listening at:

http://192.168.1.102:9090

https://192.168.1.102:9091

Jon

Message was edited by: Breakdesign

I was having the same problem, and looking through the source I noticed that JDBCAuthProvider attempts to use the XML settings jdbcProvider.jdbcDriver.className rather than jdbcProvider.driver and jdbcProvider.jdbcConnString rather than jdbcProvider.connectionString. This is contrary to the documentation at http://www.jivesoftware.org/builds/wildfire/docs/latest/documentation/db-integra tion-guide.html so maybe that needs to be updated.

Noah,

Ack, you’'re correct! The JDBCAuthProvider and JDBCUserProvider were using the wrong property names. I filed this as JM-786 and checked in a fix. The next nightly build will include this change.

Regards,

Matt

Thanks so much guys…sorry i wasnt up to figuring out the problem myself:)thanks again…

this has made my week:)