Skip to content

Commit ea04873

Browse files
WeltraumschafManuelNeuer
authored andcommitted
#36 Extract guard method
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
1 parent 9dce806 commit ea04873

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ HttpHeaders createDefectDojoAuthorizationHeaders() {
6060
}
6161

6262
private RestTemplate createRestTemplate() {
63-
if (System.getProperty("http.proxyUser") != null && System.getProperty("http.proxyPassword") != null) {
63+
if (shouldConfigureProxySettings()) {
6464
// Configuring Proxy Authentication explicitly as it isn't done by default for spring rest templates :(
6565
final var credentials = new BasicCredentialsProvider();
6666
credentials.setCredentials(
@@ -83,6 +83,10 @@ private RestTemplate createRestTemplate() {
8383
}
8484
}
8585

86+
private static boolean shouldConfigureProxySettings() {
87+
return System.getProperty("http.proxyUser") != null && System.getProperty("http.proxyPassword") != null;
88+
}
89+
8690
/*
8791
* Before version 1.5.4. testName (in DefectDojo _test_type_) must be defectDojoScanName, afterward, you can have something else.
8892
*/

0 commit comments

Comments
 (0)