aboutsummaryrefslogtreecommitdiff
path: root/connector/src/main/java/at
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2018-07-02 18:11:51 +0200
committerThomas Lenz <thomas.lenz@egiz.gv.at>2018-07-02 18:11:51 +0200
commit60c09e4d552828ec1521ed7ad0ca2a3fd3492e3a (patch)
tree29548cfb5281c3098038c683f80808d7536168d2 /connector/src/main/java/at
parentae550884f5467f6ff6df23100686bc54e100d2d4 (diff)
downloadNational_eIDAS_Gateway-60c09e4d552828ec1521ed7ad0ca2a3fd3492e3a.tar.gz
National_eIDAS_Gateway-60c09e4d552828ec1521ed7ad0ca2a3fd3492e3a.tar.bz2
National_eIDAS_Gateway-60c09e4d552828ec1521ed7ad0ca2a3fd3492e3a.zip
add country selection
Diffstat (limited to 'connector/src/main/java/at')
-rw-r--r--connector/src/main/java/at/gv/egiz/eidas/specific/connector/controller/ProcessEngineSignalController.java29
-rw-r--r--connector/src/main/java/at/gv/egiz/eidas/specific/connector/processes/CountrySelectionProcessImpl.java42
-rw-r--r--connector/src/main/java/at/gv/egiz/eidas/specific/connector/processes/tasks/EvaluateCountrySelectionTask.java53
-rw-r--r--connector/src/main/java/at/gv/egiz/eidas/specific/connector/processes/tasks/GenerateCountrySelectionFrameTask.java62
4 files changed, 186 insertions, 0 deletions
diff --git a/connector/src/main/java/at/gv/egiz/eidas/specific/connector/controller/ProcessEngineSignalController.java b/connector/src/main/java/at/gv/egiz/eidas/specific/connector/controller/ProcessEngineSignalController.java
new file mode 100644
index 00000000..070e8c1c
--- /dev/null
+++ b/connector/src/main/java/at/gv/egiz/eidas/specific/connector/controller/ProcessEngineSignalController.java
@@ -0,0 +1,29 @@
+package at.gv.egiz.eidas.specific.connector.controller;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import at.gv.egiz.eaaf.core.impl.idp.controller.AbstractProcessEngineSignalController;
+import at.gv.egiz.eidas.specific.connector.MSeIDASNodeConstants;
+
+/**
+ * @author tlenz
+ *
+ */
+@Controller
+public class ProcessEngineSignalController extends AbstractProcessEngineSignalController {
+
+ @RequestMapping(value = {MSeIDASNodeConstants.ENDPOINT_COUNTRYSELECTION
+ },
+ method = {RequestMethod.POST, RequestMethod.GET})
+ public void performGenericAuthenticationProcess(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ signalProcessManagement(req, resp);
+
+ }
+}
diff --git a/connector/src/main/java/at/gv/egiz/eidas/specific/connector/processes/CountrySelectionProcessImpl.java b/connector/src/main/java/at/gv/egiz/eidas/specific/connector/processes/CountrySelectionProcessImpl.java
new file mode 100644
index 00000000..ac99f29d
--- /dev/null
+++ b/connector/src/main/java/at/gv/egiz/eidas/specific/connector/processes/CountrySelectionProcessImpl.java
@@ -0,0 +1,42 @@
+package at.gv.egiz.eidas.specific.connector.processes;
+
+import org.apache.commons.lang3.StringUtils;
+
+import at.gv.egiz.eaaf.core.api.idp.auth.modules.AuthModule;
+import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
+import at.gv.egiz.eidas.specific.connector.MSeIDASNodeConstants;
+
+/**
+ * @author tlenz
+ *
+ */
+public class CountrySelectionProcessImpl implements AuthModule {
+
+ @Override
+ public int getPriority() {
+ return 0;
+
+ }
+
+ @Override
+ public String selectProcess(ExecutionContext context) {
+ Object selectedCountryObj = context.get(MSeIDASNodeConstants.REQ_PARAM_SELECTED_COUNTRY);
+ if (selectedCountryObj != null && selectedCountryObj instanceof String) {
+ String selectedCountry = (String) selectedCountryObj;
+ if (StringUtils.isNotEmpty(selectedCountry))
+ return null;
+
+ }
+
+ return "CountrySelectionProcess";
+
+
+ }
+
+ @Override
+ public String[] getProcessDefinitions() {
+ return new String[] { "classpath:processes/CountrySelection.process.xml" };
+
+ }
+
+}
diff --git a/connector/src/main/java/at/gv/egiz/eidas/specific/connector/processes/tasks/EvaluateCountrySelectionTask.java b/connector/src/main/java/at/gv/egiz/eidas/specific/connector/processes/tasks/EvaluateCountrySelectionTask.java
new file mode 100644
index 00000000..1a8e1f6e
--- /dev/null
+++ b/connector/src/main/java/at/gv/egiz/eidas/specific/connector/processes/tasks/EvaluateCountrySelectionTask.java
@@ -0,0 +1,53 @@
+package at.gv.egiz.eidas.specific.connector.processes.tasks;
+
+import java.util.Enumeration;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import at.gv.egiz.eaaf.core.api.data.EAAFConstants;
+import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
+import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
+import at.gv.egiz.eaaf.core.impl.idp.auth.modules.AbstractAuthServletTask;
+
+/**
+ * @author tlenz
+ *
+ */
+@Component("EvaluateCountrySelectionTask")
+public class EvaluateCountrySelectionTask extends AbstractAuthServletTask {
+ private static final Logger log = LoggerFactory.getLogger(EvaluateCountrySelectionTask.class);
+
+
+ @Override
+ public void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response)
+ throws TaskExecutionException {
+ try {
+ // set parameter execution context
+ Enumeration<String> reqParamNames = request.getParameterNames();
+ while(reqParamNames.hasMoreElements()) {
+ String paramName = reqParamNames.nextElement();
+ if (StringUtils.isNotEmpty(paramName) &&
+ !EAAFConstants.PROCESS_ENGINE_PENDINGREQUESTID.equalsIgnoreCase(paramName))
+ executionContext.put(paramName,
+ StringEscapeUtils.escapeHtml(request.getParameter(paramName)));
+
+ }
+
+
+ log.info("Country selection finished. Starting auth. process for country ... ");
+
+ } catch (Exception e) {
+ log.warn("EvaluateBKUSelectionTask has an internal error", e);
+ throw new TaskExecutionException(pendingReq, e.getMessage(), e);
+
+ }
+ }
+
+}
diff --git a/connector/src/main/java/at/gv/egiz/eidas/specific/connector/processes/tasks/GenerateCountrySelectionFrameTask.java b/connector/src/main/java/at/gv/egiz/eidas/specific/connector/processes/tasks/GenerateCountrySelectionFrameTask.java
new file mode 100644
index 00000000..86895729
--- /dev/null
+++ b/connector/src/main/java/at/gv/egiz/eidas/specific/connector/processes/tasks/GenerateCountrySelectionFrameTask.java
@@ -0,0 +1,62 @@
+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.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, -1);
+
+ 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("builder.09", new Object[]{e.getMessage()},
+ "Can not build GUI:'BKU-Selection'. Msg:" + e.getMessage(), e));
+
+ } catch (Exception e) {
+ log.warn("FinalizeAuthenticationTask has an internal error", e);
+ throw new TaskExecutionException(pendingReq, e.getMessage(), e);
+
+ }
+
+ }
+
+}