use of com.mercedesbenz.sechub.owaspzapwrapper.scan.UnauthenticatedScan in project sechub by mercedes-benz.
the class OwaspZapScanResolver method resolveScanImplementation.
public OwaspZapScan resolveScanImplementation(OwaspZapScanConfiguration scanConfig, ClientApi clientApi) {
LOG.info("Resolve scan implementation.");
OwaspZapScan scan;
AuthenticationType authenticationType = scanConfig.getAuthenticationType();
if (authenticationType == null) {
throw new MustExitRuntimeException("No matching scan type could be found.", MustExitCode.AUTHENTICATIONTYPE_CONFIGURATION_INVALID);
}
switch(authenticationType) {
case UNAUTHENTICATED:
scan = new UnauthenticatedScan(clientApi, scanConfig);
LOG.info("Using unauthenticated scan");
break;
case HTTP_BASIC_AUTHENTICATION:
scan = new HTTPBasicAuthScan(clientApi, scanConfig);
LOG.info("Using http basic authentication scan");
break;
default:
throw new MustExitRuntimeException("No matching scan type could be found.", MustExitCode.AUTHENTICATIONTYPE_CONFIGURATION_INVALID);
}
return scan;
}
use of com.mercedesbenz.sechub.owaspzapwrapper.scan.UnauthenticatedScan in project sechub by mercedes-benz.
the class OwaspZapScanResolverTest method unauthenticated_scan_is_resolved_correctly.
@Test
void unauthenticated_scan_is_resolved_correctly() {
/* prepare */
OwaspZapScanConfiguration scanConfig = mock(OwaspZapScanConfiguration.class);
when(scanConfig.getAuthenticationType()).thenReturn(AuthenticationType.UNAUTHENTICATED);
ClientApi clientApi = mock(ClientApi.class);
/* execute */
OwaspZapScan scan = resolverToTest.resolveScanImplementation(scanConfig, clientApi);
/* test */
assertTrue(scan instanceof UnauthenticatedScan);
}
Aggregations