Waffle for Java desktop application

Mar 7, 2012 at 12:19 PM


Maybe you can help me with some details about Waffle.

I have a Java desktop application done with JavaFX and I need to do the windows authentication. Looking on Internet about this I have found frameworks and APIs only for web applications. Do you know if Waffle would be appropriate for this? I'm asking because all the samples that I found are for web applications.

Thank you,


Mar 7, 2012 at 12:31 PM

Waffle can probably help. But can you please define what you mean by windows authentication on the desktop? What is the user going to do?

Mar 7, 2012 at 12:37 PM

By windows authentication, I mean that the user shall be automatically logged in with his windows account because he needs to access some files from the share net domain.

Mar 7, 2012 at 12:44 PM

If it's a desktop application the user is already automatically logged in.

Are you trying to ask for other credentials? If so, you can use JNA for that directly (waffle is built on JNA). You ask the user for credentials and then impersonate him before you open the file share. For an example look at https://github.com/twall/jna/blob/master/contrib/platform/test/com/sun/jna/platform/win32/Advapi32Test.java, search testImpersonateUser.

Mar 14, 2012 at 12:26 PM

The desktop application connects to a share net (an intranet portal) and from there it downloads a file. Currently the application asks for the user credentials (which are the windows credentials) and uses these credentials to connect to the share net. The customer would like not to introduce anymore the credentials and to do an automatic authentication. I know that is not possible to retrieve the windows password, but I was wondering if this framework could somehow help me to authenticate to the share net with the windows credentials.

Mar 14, 2012 at 4:37 PM

Why are you asking for those credentials if the user is already logged in? Just call WNetAddConnection (http://msdn.microsoft.com/en-us/library/aa385410(v=vs.85).aspx) via JNA. If the user has sufficient permissions to the drive, you're done.

Mar 14, 2012 at 5:02 PM

I'm using Java ...

Mar 14, 2012 at 5:08 PM

And what's the problem? It's a process like any other, it runs under your user's credentials.

Mar 15, 2012 at 9:08 AM

http://msdn.microsoft.com/en-us/library/aa385410(v=vs.85).aspx is Microsoft. How could I call WNetAddConnection from Java?

Mar 15, 2012 at 3:34 PM

Please ignore my previous question. I'm a beginner in using JNA, now i understood it's functionality. I'll try this way.

Thank you.