sspi connection throws NoSuchMethodError: com.such.jna.platform.win32.Sspi$SecBufferDesc with Waffle 2.3.0 - Mailing list pgsql-jdbc

From LE MENTEC, SANDRINE
Subject sspi connection throws NoSuchMethodError: com.such.jna.platform.win32.Sspi$SecBufferDesc with Waffle 2.3.0
Date
Msg-id DB3PR0202MB3386DC5800999DB16A273AECD04C9@DB3PR0202MB3386.eurprd02.prod.outlook.com
Whole thread Raw
Responses Re: sspi connection throws NoSuchMethodError: com.such.jna.platform.win32.Sspi$SecBufferDesc with Waffle 2.3.0
List pgsql-jdbc

Dear community,

 

I am currently trying to set up a project with sspi authentication on a windows server. I use the jdbc postgresql-42.2.18.jar with a postgres 12.5.

I have downloaded the waffles libraries as recommanded here : https://jdbc.postgresql.org/documentation/94/connect.html and added them to the classpath project.

 

I have tried this part of code in a Test :

 

String url = ʺjdbc:postgresql://<serveradress>:<portnumber>/<databasename>?gsslib=sspiʺ;

Connection conn = DriverManager.getConnection(url);

 

The code throws the following exception :

NoSuchMethodError: com.such.jna.platform.win32.Sspi$SecBufferDesc at org.postgresql.sspi.SSPIClient.continueSSPI(SSPIClient.java :204).

 

When I looked the pgjdbc github of the SSPIClient class (https://github.com/pgjdbc/pgjdbc/blob/master/pgjdbc/src/main/java/org/postgresql/sspi/SSPIClient.java), I have noticed that the following constructor is used : SecBufferDesc(Sspi.SECBUFFER_TOKEN, receivedToken).

 

The SecBufferDesc class comes from the jna.platform librairy 5.0.0 (com.sun.jna.platform.win32.Sspi.SecBufferDesc) provided by the waffle librairies 2.3.0.

 

Looking at the SecBufferDesc class inside the jna.platform 5.0.0, there is only one constructor (SecBufferDesc()). There is no constructor SecBufferDesc(int type, int tokenSize)anymore.

 

Doing a little research, the problem seems to be known by the waffle community (https://github.com/Waffle/waffle/issues/838).

 

It seems that it is not possible to use the last Waffle version (2.3.0) to do sspi authentication with the pgjdbc because of that.

 

Do you know witch version of the Waffle libraries I should use to enable SSPI authentication with the pgjdbc ? Do you think I should report this issue as a bug on the pgjdbc github ?

 

Thanks for your help,

Regards,

____________________________________________________________________

Sandrine Le Mentec

Software Engineer | CSD

 

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: [pgjdbc/pgjdbc] 018954: cherry-pick PR #2092 PgDatabaseMetaData.getTables(...
Next
From: Jorge Solórzano
Date:
Subject: Re: sspi connection throws NoSuchMethodError: com.such.jna.platform.win32.Sspi$SecBufferDesc with Waffle 2.3.0