Is Windows Authentication supported on Confluence 4?
Asked by Brian Louks:

Is connecting to Sql Server using windows integrated authentication supported on Confluence 4.0.3?

Looks to me like it's not, but I wanted to verify. I'm trying to avoid storing passwords on disk


Answers:
author: JamieA
body: It depends on the database driver you use. I believe the bundled jTDS drivers do support windows integrated auth, but if not you could replace them with eg the DataDirect drivers if you have a licence for them, which definitely support that.

Just googled and found <http://stackoverflow.com/questions/167464/can-i-connect-to-sql-server-using-windows-authentication-from-java-ee-webapp>

I have a dim recollection that if the server is on unix then you may need something other than jTDS, but I don't even think that's true now.

comments: author: Nic Brough -Adaptavist-
body: Unix boxes happily use jTDS to hook up to MS-SQL databases. In my experience, jTDS drivers are a lot more stable and faster than Microsoft's own drivers. Even on Window servers, which was a bit of a surprise.


author: JamieA
body: Oh sure, I wasn't clear at all. I meant "on unix you might have to use something other than jTDS to do windows integrated auth", and perhaps only when the unix machine is not hooked up to the AD domain.


author: Nic Brough -Adaptavist-
body: Ah, I misunderstood. They work fine with AD in my experience (assuming you're on a reliable AD server, which became a problem where I first ran into it). I'm not sure how they handle outside AD beyond a basic username/password setup


author: Brian Louks
body: I should have been more clear myself, I run Windows and Active Directory.

The thing is, it doesn't seem like Confluence itself supports it. It doesn't let me get past the configuration screen without a username and password. I know JIRA had this problem as well, in 4.2.3, I was able to use jTDS drivers with integrated security no problem. In JIRA 4.4, it broke, complaining that a username / password was required. And the error message wasn't produced by the driver, it was produced by Atlassian code, which suggest to me that Atlassian stopped supporting integrated security even though the underlying driver does. So I'm suspecting that's the case here with Confluence as well- unless I want to modify their code, I probably need to use Sql accounts.


author: JamieA
body: OK, I get you. For in the initial setup use a username/password. All this does is write a file \<jira-home\>/dbconfig.xml. You can then shut jira down and modify this file yourself, and restart it. If you make a mistake jira won't start then just shut it down and have another go. It goes without saying to take a backup.


author: JamieA
body: You're talking about confluence so substitue confluence-home for jira-home, also the file might be called something different, like confluence.cfg, but you will recognise it.


author: Brian Louks
body: You're correct, it was confluence.cfg.xml in Confluence home. I did test updating the config file with JIRA 4.4.1, and it still didn't work (got an error from Atlassian code saying username was required). However, integrated security appears to be working with Confluence. I haven't been able to fully test yet because I have to go to the DBA team to create a temporary sql user to do the initial setup ... sigh ...

Thanks everyone for the help!


author: JamieA
body: With jira at any rate you can write the file first, then you don't get prompted with the initial database stuff. Might be the same for confluence.

Seeing as you have generously given me some points, could you now go the whole hog and mark my question as correct? ;-)


author: Brian Louks
body: I wasn't going to leave you hanging. Just waiting until I could do a full test - it worked! For anyone else reading this, the solution was to:

* use a sql account to set up the database connection
* edit \<confluence-home\>/confluence.cfg.xml, completely remove the username and password elements
* put ntlmauth.dll from the jTDS distrubtion into the \<confluence install\>/Confluence/bin directory.
* Set Confluence to run as an account that has access to the database
* Restart Confluence

But FYI, I still don't think JIRA works, like I said, it used to work back in 4.2.3, and it doesn't appear to work anymore in 4.4 (I think it breaks before it even gets down to the jTDS level). I opened an issue with atlassian at <https://jira.atlassian.com/browse/JRA-25791> for that issue.

Thanks to everyone again. I'd give out more points if I could :)