|
13 | 13 | import io.securecodebox.persistence.defectdojo.exception.TooManyResponsesException;
|
14 | 14 | import io.securecodebox.persistence.defectdojo.http.AuthHeaderFactory;
|
15 | 15 | import io.securecodebox.persistence.defectdojo.http.Foo;
|
| 16 | +import io.securecodebox.persistence.defectdojo.http.ProxyConfig; |
16 | 17 | import io.securecodebox.persistence.defectdojo.http.ProxyConfigFactory;
|
17 | 18 | import io.securecodebox.persistence.defectdojo.model.Engagement;
|
18 | 19 | import io.securecodebox.persistence.defectdojo.model.Model;
|
|
44 | 45 | abstract class GenericDefectDojoService<T extends Model> implements DefectDojoService<T> {
|
45 | 46 | private static final long DEFECT_DOJO_OBJET_LIMIT = 100L;
|
46 | 47 | private final ClientConfig clientConfig;
|
| 48 | + private final ProxyConfig proxyConfig; |
47 | 49 |
|
48 | 50 | protected ObjectMapper objectMapper;
|
49 | 51 | protected ObjectMapper searchStringMapper;
|
50 | 52 |
|
51 | 53 | @Getter // TODO: Remove this getter
|
52 | 54 | private final RestTemplate restTemplate;
|
53 | 55 |
|
| 56 | + /** |
| 57 | + * Convenience constructor which initializes {@link #proxyConfig} |
| 58 | + * |
| 59 | + * @param clientConfig not {@code null} |
| 60 | + */ |
| 61 | + public GenericDefectDojoService(ClientConfig clientConfig) { |
| 62 | + this(clientConfig, new ProxyConfigFactory().create()); |
| 63 | + } |
| 64 | + |
54 | 65 | /**
|
55 | 66 | * Dedicated constructor
|
56 | 67 | *
|
57 | 68 | * @param clientConfig not {@code null}
|
| 69 | + * @param proxyConfig not {@code null} |
58 | 70 | */
|
59 |
| - public GenericDefectDojoService(@NonNull ClientConfig clientConfig) { |
| 71 | + public GenericDefectDojoService(@NonNull ClientConfig clientConfig, @NonNull ProxyConfig proxyConfig) { |
60 | 72 | super();
|
61 | 73 | this.clientConfig = clientConfig;
|
| 74 | + this.proxyConfig = proxyConfig; |
62 | 75 |
|
63 | 76 | this.objectMapper = new ObjectMapper();
|
64 | 77 | this.objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
@@ -198,7 +211,7 @@ final URI createBaseUrl() {
|
198 | 211 | */
|
199 | 212 | private HttpHeaders getDefectDojoAuthorizationHeaders() {
|
200 | 213 | final var factory = new AuthHeaderFactory(clientConfig);
|
201 |
| - factory.setProxyConfig(new ProxyConfigFactory().create()); |
| 214 | + factory.setProxyConfig(proxyConfig); |
202 | 215 | return factory.generateAuthorizationHeaders();
|
203 | 216 | }
|
204 | 217 |
|
|
0 commit comments