diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclientjava/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclientjava/META-INF/MANIFEST.MF
index 9d389fae7..52d8cd9ec 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclientjava/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclientjava/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.provider.filetransfer.httpclientjava;singleton:=true
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.0.100.qualifier
Bundle-Vendor: %plugin.provider
Bundle-Localization: plugin
Automatic-Module-Name: org.eclipse.ecf.provider.filetransfer.httpclientjava
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclientjava/pom.xml b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclientjava/pom.xml
index d9b558e62..dc112c973 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclientjava/pom.xml
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclientjava/pom.xml
@@ -9,7 +9,7 @@
../../../
org.eclipse.ecf.provider.filetransfer.httpclientjava
- 2.0.0-SNAPSHOT
+ 2.0.100-SNAPSHOT
eclipse-plugin
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclientjava/src/org/eclipse/ecf/provider/filetransfer/httpclientjava/HttpClientFileSystemBrowser.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclientjava/src/org/eclipse/ecf/provider/filetransfer/httpclientjava/HttpClientFileSystemBrowser.java
index 83266197a..871a56cd9 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclientjava/src/org/eclipse/ecf/provider/filetransfer/httpclientjava/HttpClientFileSystemBrowser.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclientjava/src/org/eclipse/ecf/provider/filetransfer/httpclientjava/HttpClientFileSystemBrowser.java
@@ -25,12 +25,15 @@
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpRequest.BodyPublishers;
+import java.net.http.HttpRequest.Builder;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
+import java.nio.charset.StandardCharsets;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Duration;
+import java.util.Base64;
import java.util.List;
import java.util.Locale;
import java.util.OptionalLong;
@@ -247,6 +250,9 @@ protected void runRequest() throws Exception {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=249990
// fix the fix for bug 249990 with bug 410813
requestConfigBuilder.header(CACHE_CONTROL_HEADER, "max-age=" + maxAge);
+
+ // Add Basic Authentication to request config builder
+ setupBasicAuthentication(requestConfigBuilder);
HttpRequest request = requestConfigBuilder.build();
@@ -308,6 +314,13 @@ protected void runRequest() throws Exception {
}
}
+ private void setupBasicAuthentication(Builder requestConfigBuilder) {
+ if (username != null) {
+ byte[] credentials = Base64.getEncoder().encode((username + ":" + password).getBytes(StandardCharsets.UTF_8));
+ requestConfigBuilder.header("Authorization", "Basic " + new String(credentials, StandardCharsets.UTF_8));
+ }
+ }
+
private INTLMProxyHandler getNTLMProxyHandler(IHttpClientContext httpContext) {
Object value = httpContext.getAttribute(ECFHttpClientFactory.NTLM_PROXY_HANDLER_ATTR);
if (value instanceof INTLMProxyHandler) {
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclientjava/src/org/eclipse/ecf/provider/filetransfer/httpclientjava/HttpClientRetrieveFileTransfer.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclientjava/src/org/eclipse/ecf/provider/filetransfer/httpclientjava/HttpClientRetrieveFileTransfer.java
index fdc9ed6b5..301221c59 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclientjava/src/org/eclipse/ecf/provider/filetransfer/httpclientjava/HttpClientRetrieveFileTransfer.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclientjava/src/org/eclipse/ecf/provider/filetransfer/httpclientjava/HttpClientRetrieveFileTransfer.java
@@ -30,7 +30,9 @@
import java.net.http.HttpRequest.Builder;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
+import java.nio.charset.StandardCharsets;
import java.time.Duration;
+import java.util.Base64;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -304,6 +306,11 @@ protected void setRequestHeaderValues(Builder builder) throws InvalidFileRangeSp
// fix the fix for bug 249990 with bug 410813
builder.header(HttpClientFileSystemBrowser.CACHE_CONTROL_HEADER, "max-age=" + maxAge); //$NON-NLS-1$
setRequestHeaderValuesFromOptions(builder);
+ // Setup Basic Authentication
+ if (username != null) {
+ byte[] credentials = Base64.getEncoder().encode((username + ":" + password).getBytes(StandardCharsets.UTF_8));
+ requestConfigBuilder.header("Authorization", "Basic " + new String(credentials, StandardCharsets.UTF_8));
+ }
}
private void setRangeHeader(final IFileRangeSpecification rangeSpec, final long resumePosition, Builder builder)
diff --git a/releng/features/org.eclipse.ecf.filetransfer.httpclientjava.feature/feature.xml b/releng/features/org.eclipse.ecf.filetransfer.httpclientjava.feature/feature.xml
index 018eac8b4..b75657559 100644
--- a/releng/features/org.eclipse.ecf.filetransfer.httpclientjava.feature/feature.xml
+++ b/releng/features/org.eclipse.ecf.filetransfer.httpclientjava.feature/feature.xml
@@ -2,7 +2,7 @@
diff --git a/releng/features/org.eclipse.ecf.filetransfer.httpclientjava.feature/pom.xml b/releng/features/org.eclipse.ecf.filetransfer.httpclientjava.feature/pom.xml
index ae51ddf75..a11ff42cb 100644
--- a/releng/features/org.eclipse.ecf.filetransfer.httpclientjava.feature/pom.xml
+++ b/releng/features/org.eclipse.ecf.filetransfer.httpclientjava.feature/pom.xml
@@ -10,5 +10,5 @@
org.eclipse.ecf.filetransfer.httpclientjava.feature
eclipse-feature
- 2.0.0-SNAPSHOT
+ 2.0.100-SNAPSHOT