pgjdbc/pgjdbc — pull request #212 by ringerc (2014-11-13 01:09:59+00:00)
Title: Add native SSPI authentication support on Windows using JNA via Waffle

PgJDBC previously used Kerberos/GSSAPI via JSSE to try to authenticate to a SSPI server. This required registry changes and lots of JSSE system properties if you wanted to try to authenticate using existing Windows client single-sign-on credentials. It only worked on some Windows versions and required different options for almost every Windows version.

Instead, use the client's SSPI API via JNA to delegate the work to Windows.

PgJDBC is built with Waffle support on all platforms, but it's only usable on Windows. Other platforms can continue to use the existing Kerberos approach to authenticating against SSPI endpoints, as can Windows if Waffle isn't present. The new parameter `gsslib` (see `doc/doc.xml`) lets you control this.

If you try to use SSPI where it's not supported or without Waffle on your classpath you get an informative PSQLException.

The existing maven-ant-tasks integration is enhanced significantly, so it's now used to download the dependencies for building against Waffle and to put them in `lib/` for IDE users.

Additionally, as part of those changes the code now generates the `pom.xml` on the fly, rather than using a templated POM. This allows the POM to include PgJDBC's dependencies without manual editing.

This still needs some more testing - with/without Waffle present, with Waffle present but JNA missing, on Windows/non-windows - but it's largely ready to go.