Search in sources :

Example 1 with TextFileReader

use of com.mercedesbenz.sechub.commons.TextFileReader in project sechub by mercedes-benz.

the class SechubWebConfigProvider method getSecHubWebConfiguration.

public SecHubWebScanConfiguration getSecHubWebConfiguration(File secHubConfigFile) {
    TextFileReader fileReader = new TextFileReader();
    if (secHubConfigFile == null) {
        // can happen when an unauthenticated scan is started with only the target URL
        return new SecHubWebScanConfiguration();
    }
    String sechubConfigJson;
    SecHubScanConfiguration sechubConfig;
    try {
        sechubConfigJson = fileReader.loadTextFile(secHubConfigFile);
        sechubConfig = SecHubScanConfiguration.createFromJSON(sechubConfigJson);
    } catch (IOException e) {
        throw new MustExitRuntimeException("Was not able to read sechub config file: " + secHubConfigFile, e, MustExitCode.SECHUB_CONFIGURATION_INVALID);
    }
    return getSecHubWebConfiguration(sechubConfig);
}
Also used : SecHubWebScanConfiguration(com.mercedesbenz.sechub.commons.model.SecHubWebScanConfiguration) MustExitRuntimeException(com.mercedesbenz.sechub.owaspzapwrapper.cli.MustExitRuntimeException) IOException(java.io.IOException) SecHubScanConfiguration(com.mercedesbenz.sechub.commons.model.SecHubScanConfiguration) TextFileReader(com.mercedesbenz.sechub.commons.TextFileReader)

Aggregations

TextFileReader (com.mercedesbenz.sechub.commons.TextFileReader)1 SecHubScanConfiguration (com.mercedesbenz.sechub.commons.model.SecHubScanConfiguration)1 SecHubWebScanConfiguration (com.mercedesbenz.sechub.commons.model.SecHubWebScanConfiguration)1 MustExitRuntimeException (com.mercedesbenz.sechub.owaspzapwrapper.cli.MustExitRuntimeException)1 IOException (java.io.IOException)1