SSPI Authentication Exception

Поиск
Список
Период
Сортировка
От Kok King Eng
Тема SSPI Authentication Exception
Дата
Msg-id CAFHs8pZVq++mPwV_m_ONXr4nXTvPAmGgemTFj7DnRQEDCKdgsw@mail.gmail.com
обсуждение исходный текст
Список pgsql-jdbc
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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Sorry I rejected this by accident
Следующее
От: Kok King Eng
Дата:
Сообщение: SSPI Authentication Exception