use of com.checkmarx.sdk.config.AstConfig in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class AstScanner method getScanConfig.
/**
* Convert scanParams to an object that is used by underlying logic in Common Client.
*/
@Override
protected RestClientConfig getScanConfig(ScanParams scanParams) {
RestClientConfig restClientConfig = new RestClientConfig();
restClientConfig.setProjectName(scanParams.getProjectName());
AstConfig astConfig = getAstSpecificConfig();
setSourceLocation(scanParams, restClientConfig, astConfig);
restClientConfig.setAstConfig(astConfig);
return restClientConfig;
}
use of com.checkmarx.sdk.config.AstConfig in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class AstTest method getScanConfig.
private RestClientConfig getScanConfig() throws MalformedURLException {
AstConfig astConfig = AstConfig.builder().apiUrl(astProperties.getApiUrl()).webAppUrl(astProperties.getWebAppUrl()).clientSecret(astProperties.getClientSecret()).clientId("CxFlow").sourceLocationType(SourceLocationType.REMOTE_REPOSITORY).build();
RemoteRepositoryInfo repoInfo = new RemoteRepositoryInfo();
URL repoUrl = new URL(githubProperties.getUrl());
repoInfo.setUrl(repoUrl);
astConfig.setRemoteRepositoryInfo(repoInfo);
astConfig.setResultsPageSize(10);
astConfig.setPresetName("Checkmarx Default");
RestClientConfig config = new RestClientConfig();
config.setAstConfig(astConfig);
config.setProjectName("sdkAstProject");
config.setProgressInterval(5);
return config;
}
use of com.checkmarx.sdk.config.AstConfig in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class AstClientHelper method initiateScan.
@Override
public ResultsBase initiateScan() {
log.info("----------------------------------- Initiating {} Scan:------------------------------------", getScannerDisplayName());
ASTResults astResults = new ASTResults();
scanId = null;
AstConfig astConfig = config.getAstConfig();
try {
SourceLocationType locationType = astConfig.getSourceLocationType();
HttpResponse response;
String projectId = determineProjectId(config.getProjectName());
if (locationType == SourceLocationType.REMOTE_REPOSITORY) {
response = submitSourcesFromRemoteRepo(projectId, astConfig);
} else {
response = submitAllSourcesFromLocalDir(projectId, astConfig);
}
scanId = extractScanIdFrom(response);
astResults.setScanId(scanId);
} catch (Exception e) {
log.error(e.getMessage());
setState(State.FAILED);
astResults.setException(new ScannerRuntimeException("Error creating scan.", e));
}
return astResults;
}
Aggregations