diff options
author | Sebastian Ratz | 2021-04-08 12:06:31 +0000 |
---|---|---|
committer | Scott Lewis | 2021-04-10 00:36:56 +0000 |
commit | 589731456f608a3e87e2e8152671637a33556ebc (patch) | |
tree | d2af4166c713686cd75cad04517819141749dc25 /providers/bundles | |
parent | 78f10341b6d0bf633dc42ce3960d21db6ee81618 (diff) | |
download | org.eclipse.ecf-589731456f608a3e87e2e8152671637a33556ebc.tar.gz org.eclipse.ecf-589731456f608a3e87e2e8152671637a33556ebc.tar.xz org.eclipse.ecf-589731456f608a3e87e2e8152671637a33556ebc.zip |
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>
Diffstat (limited to 'providers/bundles')
2 files changed, 3 insertions, 21 deletions
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 ff096abea..792ca7367 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 class Win32HttpClientConfigurationModifier extends HttpClientModifierAdap 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 @@ public class Win32HttpClientConfigurationModifier extends HttpClientModifierAdap @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 18391c079..e2b059c4d 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 @@ public class Win32NTLMProxyHandler extends DefaultNTLMProxyHandler { @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 @@ public class Win32NTLMProxyHandler extends DefaultNTLMProxyHandler { @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); |