package at.gv.egiz.eidas.specific.connector.processes.tasks; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import at.gv.egiz.eaaf.core.api.gui.IGUIBuilderConfiguration; import at.gv.egiz.eaaf.core.api.gui.IGUIFormBuilder; import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; import at.gv.egiz.eaaf.core.exceptions.EAAFException; import at.gv.egiz.eaaf.core.exceptions.GUIBuildException; import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; import at.gv.egiz.eaaf.core.impl.idp.auth.modules.AbstractAuthServletTask; import at.gv.egiz.eidas.specific.connector.MSConnectorEventCodes; import at.gv.egiz.eidas.specific.connector.MSeIDASNodeConstants; import at.gv.egiz.eidas.specific.connector.gui.StaticGuiBuilderConfiguration; /** * @author tlenz * */ @Component("GenerateCountrySelectionFrameTask") public class GenerateCountrySelectionFrameTask extends AbstractAuthServletTask { private static final Logger log = LoggerFactory.getLogger(GenerateCountrySelectionFrameTask.class); @Autowired IGUIFormBuilder guiBuilder; @Autowired IConfiguration basicConfig; @Override public void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) throws TaskExecutionException { try { revisionsLogger.logEvent(pendingReq, MSConnectorEventCodes.STARTING_COUNTRY_SELECTION); IGUIBuilderConfiguration config = new StaticGuiBuilderConfiguration( basicConfig, pendingReq, MSeIDASNodeConstants.TEMPLATE_HTML_COUNTRYSELECTION, MSeIDASNodeConstants.ENDPOINT_COUNTRYSELECTION); guiBuilder.build(response, config, "BKU-Selection form"); } catch (GUIBuildException e) { log.warn("Can not build GUI:'BKU-Selection'. Msg:" + e.getMessage()); throw new TaskExecutionException(pendingReq, "Can not build GUI. Msg:" + e.getMessage(), new EAAFException("gui.00", new Object[]{e.getMessage()}, e)); } catch (Exception e) { log.warn("FinalizeAuthenticationTask has an internal error", e); throw new TaskExecutionException(pendingReq, e.getMessage(), e); } } }