diff --git a/sechub-webui/src/main/java/com/mercedesbenz/sechub/webui/CredentialService.java b/sechub-webui/src/main/java/com/mercedesbenz/sechub/webui/configuration/CredentialService.java similarity index 94% rename from sechub-webui/src/main/java/com/mercedesbenz/sechub/webui/CredentialService.java rename to sechub-webui/src/main/java/com/mercedesbenz/sechub/webui/configuration/CredentialService.java index bd7c69158e..657a9c03a5 100644 --- a/sechub-webui/src/main/java/com/mercedesbenz/sechub/webui/CredentialService.java +++ b/sechub-webui/src/main/java/com/mercedesbenz/sechub/webui/configuration/CredentialService.java @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -package com.mercedesbenz.sechub.webui; +package com.mercedesbenz.sechub.webui.configuration; import javax.annotation.PostConstruct; import javax.crypto.SealedObject; diff --git a/sechub-webui/src/main/java/com/mercedesbenz/sechub/webui/configuration/SecHubAccessService.java b/sechub-webui/src/main/java/com/mercedesbenz/sechub/webui/configuration/SecHubAccessService.java new file mode 100644 index 0000000000..c7d376ed0c --- /dev/null +++ b/sechub-webui/src/main/java/com/mercedesbenz/sechub/webui/configuration/SecHubAccessService.java @@ -0,0 +1,37 @@ +package com.mercedesbenz.sechub.webui.configuration; + +import java.net.URI; + +import javax.annotation.PostConstruct; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import com.mercedesbenz.sechub.api.MockedSecHubClient; +import com.mercedesbenz.sechub.api.SecHubClient; + +@Service +public class SecHubAccessService { + @Value("${sechub.server-url}") + private String secHubServerUrl; + + @Value("${sechub.trust-all-certificates}") + private boolean trustAllCertificates; + + private SecHubClient client; + + @PostConstruct + void setupSecHubClient() { + URI serverUri = URI.create(secHubServerUrl); + + this.client = MockedSecHubClient.from(serverUri, "mocked", "verySecretTrustMe", trustAllCertificates); + } + + public SecHubClient getSecHubClient() { + return this.client; + } + + public URI getSecHubServerUri() { + return this.client.getServerUri(); + } +}