Skip to content

Commit 397d8cf

Browse files
committed
Test to see if passing proxy ath header explicitly can fix problem with http proxy auth
Signed-off-by: Jannik Hollenbach <jannik.hollenbach@iteratec.com>
1 parent e7be600 commit 397d8cf

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/main/java/io/securecodebox/persistence/defectdojo/service/GenericDefectDojoService.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
import java.net.URI;
3737
import java.net.URISyntaxException;
38+
import java.nio.charset.StandardCharsets;
3839
import java.util.*;
3940

4041
abstract public class GenericDefectDojoService<T extends DefectDojoModel> {
@@ -64,6 +65,15 @@ public GenericDefectDojoService(DefectDojoConfig config) {
6465
private HttpHeaders getDefectDojoAuthorizationHeaders() {
6566
HttpHeaders headers = new HttpHeaders();
6667
headers.set("Authorization", "Token " + this.defectDojoConfig.getApiKey());
68+
69+
String username = System.getProperty("http.proxyUser", "");
70+
String password = System.getProperty("http.proxyPassword", "");
71+
72+
if (!username.isEmpty() || !password.isEmpty()) {
73+
System.out.println("Setting Proxy Auth Header...");
74+
headers.set(HttpHeaders.PROXY_AUTHORIZATION, "Basic " + Base64.getEncoder().encodeToString((username + ':' + password).getBytes(StandardCharsets.UTF_8)));
75+
}
76+
6777
return headers;
6878
}
6979

0 commit comments

Comments
 (0)