Sorry I rejected this by accident

From: Dave Cramer <davecramer(at)gmail(dot)com>
To: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Sorry I rejected this by accident
Date: 2016-08-08 13:52:00
Message-ID: CADK3HH+E00gf=eekb+mKdMmHa4FtoM==aeQ2pfNw1Ssh5RA2Vg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

From: Kok King Eng <des(dot)kkeng(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Cc:
Date: Mon, 8 Aug 2016 21:42:38 +0800
Subject: SSPI Authentication Exception
Hi,
I'm encountering exception when connecting postgres with SSPI
authentication. Here's my development enviroment:
1. Postgresql 9.5 (Centos 7.2)
2. Active Directory (Windows Server 2012 R2)
3. Windows 10 Pro as development workstation
5. JKD 1.8.0.92
4. JDBC version: 9.4.1209
5. waffle-jna version: 1.8.1
6. I've also tried different jdbc version from 1200 to 1208 along with
different waffle-jna version (1.5 - 1.8.1), except getting a
NoSuchMethodError (java.lang.NoSuchMethodError: waffle.windows.auth.impl.
WindowsSecurityContextImpl.setCredentialsHandle(Lcom/sun/
jna/platform/win32/Sspi$CredHandle;)V) due to version compatibility issue,
I keep getting the exception below attached.

I can to connect to database server with pgadmin without supplying
password, so I assume my db server and environment is properly configured.
My java client works also when gsspi is used with both username & password
supplied.
In debug mode, I modified the return value from
org.postgresql.sspi.SSPIClient.makeSPN()
from POSTGRES/pgdb-main.mydomainname.local:5432 to
POSTGRES/pgdb-main.mydomainname.local
(eliminate port no), I managed to connect my database without error!
and my jdbc connection string is: jdbc:postgresql://pgdb-main.
mydomainname.local/dbname?gsslib=sspi

Since the method org.postgresql.sspi.SSPIClient.makeSPN() involves three
parties (postgres jdbc, waffle-jna and windows api), I'm not too sure which
exact party I should report to, will you please give a hint if postgres
jdbc is not the cause?

and finally, here comes the exception:

org.postgresql.util.PSQLException: Could not initialize SSPI security
context
at org.postgresql.sspi.SSPIClient.startSSPI(SSPIClient.java:176)
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(
ConnectionFactoryImpl.java:612)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(
ConnectionFactoryImpl.java:223)
at org.postgresql.core.ConnectionFactory.openConnection(
ConnectionFactory.java:67)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:212)
at org.postgresql.Driver.makeConnection(Driver.java:407)
at org.postgresql.Driver.connect(Driver.java:275)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at com.des.Americano.main(Americano.java:37)
Caused by: com.sun.jna.platform.win32.Win32Exception: The specified target
is unknown or unreachable
at waffle.windows.auth.impl.WindowsSecurityContextImpl.initialize(
WindowsSecurityContextImpl.java:158)
at org.postgresql.sspi.SSPIClient.startSSPI(SSPIClient.java:174)
... 9 more

Thank you & Have a good day!

Regards,
desperado
Dave Cramer

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kok King Eng 2016-08-09 17:13:48 SSPI Authentication Exception
Previous Message Guillaume Cottenceau 2016-08-05 13:53:36 Re: v2 protocol: is it still used?