use of com.mercedesbenz.sechub.commons.model.login.Page in project sechub by mercedes-benz.
the class WebConfigBuilderStrategy method configureScriptAuth.
/* ------------------------ */
/* +---- FORM:SCRIPT -----+ */
/* ------------------------ */
@SuppressWarnings("rawtypes")
private <C extends AbstractWebScanAdapterConfig, B extends AbstractWebScanAdapterConfigBuilder<B, C>> void configureScriptAuth(B configBuilder, URL loginUrl, Script script) {
AbstractWebScanAdapterConfigBuilder<B, C>.LoginBuilder.FormScriptLoginBuilder scriptBuilder = configBuilder.login().url(loginUrl).form().script();
Optional<List<Page>> optPages = script.getPages();
if (!optPages.isPresent()) {
return;
}
List<Page> pages = optPages.get();
for (Page page : pages) {
FormScriptLoginPageBuilder pageBuilder = scriptBuilder.addPage();
Optional<List<Action>> optActions = page.getActions();
if (optActions.isPresent()) {
List<Action> actions = optActions.get();
for (Action action : actions) {
/* @formatter:off */
pageBuilder.addAction(action.getType()).select(action.getSelector().orElse(null)).enterValue(action.getValue().orElse(null)).description(action.getDescription().orElse(null)).unit(action.getUnit().orElse(null)).endStep();
/* @formatter:on */
}
pageBuilder.doEndPage();
}
}
scriptBuilder.endLogin();
}
Aggregations