Search in sources :

Example 1 with Page

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();
}
Also used : Action(com.mercedesbenz.sechub.commons.model.login.Action) FormScriptLoginPageBuilder(com.mercedesbenz.sechub.adapter.AbstractWebScanAdapterConfigBuilder.LoginBuilder.FormScriptLoginBuilder.FormScriptLoginPageBuilder) List(java.util.List) Page(com.mercedesbenz.sechub.commons.model.login.Page)

Aggregations

FormScriptLoginPageBuilder (com.mercedesbenz.sechub.adapter.AbstractWebScanAdapterConfigBuilder.LoginBuilder.FormScriptLoginBuilder.FormScriptLoginPageBuilder)1 Action (com.mercedesbenz.sechub.commons.model.login.Action)1 Page (com.mercedesbenz.sechub.commons.model.login.Page)1 List (java.util.List)1