Bug 566100 - Remove explicit dependency on JNA

Win32HttpClientConfigurationModifier.isWinAuthAvailable() does nothing
useful. It would only return false if com.sun.jna.platform.win32.Sspi
would not be available.

But this can never be the case, since we depend on
org.apache.httpcomponents.httpclient.win, which in turn depends on JNA
(non-optional).

The original code in
org.apache.http.impl.client.WinHttpClients.isWinAuthAvailable() is a
no-op for the same reason.

Change-Id: Ic88ec9770dbc5bc296701791348dbf5a0c3a8a8d
Signed-off-by: Sebastian Ratz <sebastian.ratz@sap.com>
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient45.win32/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient45/win32/Win32HttpClientConfigurationModifier.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient45.win32/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient45/win32/Win32HttpClientConfigurationModifier.java
index ff096ab..792ca73 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient45.win32/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient45/win32/Win32HttpClientConfigurationModifier.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient45.win32/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient45/win32/Win32HttpClientConfigurationModifier.java
@@ -12,7 +12,6 @@
  *****************************************************************************/
 package org.eclipse.ecf.internal.provider.filetransfer.httpclient45.win32;
 
-import com.sun.jna.platform.win32.Sspi;
 import java.util.Map;
 import org.apache.http.auth.AuthSchemeProvider;
 import org.apache.http.client.CredentialsProvider;
@@ -45,27 +44,10 @@
 
 	public static final String SERVICE_PRINCIPAL_NAME_PROPERTY = ID + "." + SERVICE_PRINCIPAL_NAME_ATTRIBUTE; //$NON-NLS-1$
 
-	private static Boolean winAuthAvailable;
-
 	private String servicePrincipalName;
 
-	public static boolean isWinAuthAvailable() {
-		if (winAuthAvailable == null) {
-			// from org.apache.http.impl.client.WinHttpClients.isWinAuthAvailable()
-			try {
-				winAuthAvailable = Sspi.MAX_TOKEN_SIZE > 0;
-			} catch (Exception ignore) { // Likely ClassNotFound
-				winAuthAvailable = false;
-			}
-		}
-		return winAuthAvailable;
-	}
-
 	@Override
 	public HttpClientBuilder modifyClient(HttpClientBuilder builder) {
-		if (!isWinAuthAvailable()) {
-			return builder;
-		}
 		HttpClientBuilder winBuilder = builder == null ? HttpClientBuilder.create() : builder;
 		Lookup<AuthSchemeProvider> authSchemeRegistry = createAuthSchemeRegistry();
 		return winBuilder.setDefaultAuthSchemeRegistry(authSchemeRegistry);
@@ -74,7 +56,7 @@
 	@Override
 	@SuppressWarnings("restriction")
 	public CredentialsProvider modifyCredentialsProvider(CredentialsProvider credentialsProvider) {
-		if (credentialsProvider == null || !isWinAuthAvailable() || credentialsProvider instanceof WindowsCredentialsProvider) {
+		if (credentialsProvider == null || credentialsProvider instanceof WindowsCredentialsProvider) {
 			return credentialsProvider;
 		}
 
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient45.win32/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient45/win32/Win32NTLMProxyHandler.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient45.win32/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient45/win32/Win32NTLMProxyHandler.java
index 18391c0..e2b059c 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient45.win32/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient45/win32/Win32NTLMProxyHandler.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient45.win32/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient45/win32/Win32NTLMProxyHandler.java
@@ -36,7 +36,7 @@
 	@Override
 	public void handleNTLMProxy(Proxy proxy, int code) throws IncomingFileTransferException {
 		DefaultNTLMProxyHandler.setSeenNTLM();
-		if (Win32HttpClientConfigurationModifier.isWinAuthAvailable() && (code != 407 || isExplicitAllowNTLMAuthentication())) {
+		if (code != 407 || isExplicitAllowNTLMAuthentication()) {
 			return;
 		}
 		super.handleNTLMProxy(proxy, code);
@@ -44,7 +44,7 @@
 
 	@Override
 	public void handleSPNEGOProxy(Proxy proxy, int code) throws BrowseFileTransferException {
-		if (Win32HttpClientConfigurationModifier.isWinAuthAvailable() && (code != 407 || isExplicitAllowNTLMAuthentication())) {
+		if (code != 407 || isExplicitAllowNTLMAuthentication()) {
 			return;
 		}
 		super.handleSPNEGOProxy(proxy, code);