aboutsummaryrefslogtreecommitdiff
path: root/id/server/modules/moa-id-module-eIDAS/src
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2018-10-04 11:16:24 +0200
committerThomas Lenz <thomas.lenz@egiz.gv.at>2018-10-04 11:16:24 +0200
commitabae1d0a880178568e742c09779bd2a47394f1e4 (patch)
tree43dc4b454e3b60a5aa27bd5376d23299ae31384d /id/server/modules/moa-id-module-eIDAS/src
parentfd786b4402841508acef77e75bacd369efbbcf96 (diff)
downloadmoa-id-spss-abae1d0a880178568e742c09779bd2a47394f1e4.tar.gz
moa-id-spss-abae1d0a880178568e742c09779bd2a47394f1e4.tar.bz2
moa-id-spss-abae1d0a880178568e742c09779bd2a47394f1e4.zip
add some more basic untested code for eID4U.
- add auth.process selection - add eID4U attribute extraction
Diffstat (limited to 'id/server/modules/moa-id-module-eIDAS/src')
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/AustrianAuthWitheID4UAuthenticationModulImpl.java29
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/CollectAddtionalAttributesTask.java34
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/resources/eid4u.Authentication.process.xml2
3 files changed, 58 insertions, 7 deletions
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/AustrianAuthWitheID4UAuthenticationModulImpl.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/AustrianAuthWitheID4UAuthenticationModulImpl.java
index 3640d4d19..d1ad4b665 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/AustrianAuthWitheID4UAuthenticationModulImpl.java
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/AustrianAuthWitheID4UAuthenticationModulImpl.java
@@ -22,8 +22,18 @@
*/
package at.gv.egovernment.moa.id.auth.modules.eidas;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+import at.gv.egiz.eaaf.core.api.IRequest;
+import at.gv.egiz.eaaf.core.api.IRequestStorage;
+import at.gv.egiz.eaaf.core.api.data.EAAFConstants;
import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
import at.gv.egovernment.moa.id.auth.modules.internal.DefaultCitizenCardAuthModuleImpl;
+import at.gv.egovernment.moa.id.protocols.eidas.EIDASData;
+import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.MiscUtil;
/**
@@ -33,7 +43,10 @@ import at.gv.egovernment.moa.util.MiscUtil;
public class AustrianAuthWitheID4UAuthenticationModulImpl extends DefaultCitizenCardAuthModuleImpl {
private int priority = 1;
-
+
+ @Autowired private IRequestStorage requestStore;
+
+
@Override
public int getPriority() {
return priority;
@@ -53,14 +66,22 @@ public class AustrianAuthWitheID4UAuthenticationModulImpl extends DefaultCitizen
@Override
public String selectProcess(ExecutionContext context) {
String selectedProcessID = super.selectProcess(context);
-
if (MiscUtil.isNotEmpty(selectedProcessID)) {
- //TODO: check if it is an eID4U auth. use-case
+ String pendingReqId = (String)context.get(EAAFConstants.PROCESS_ENGINE_PENDINGREQUESTID);
+ if (StringUtils.isEmpty(pendingReqId))
+ Logger.warn("Process execution context contains NO 'pendingReqId'. Looks very suspect!");
+ else {
+ IRequest pendingReq = requestStore.getPendingRequest(pendingReqId);
+ if (pendingReq != null && pendingReq instanceof EIDASData) {
+ return "eID4UAttributCollectionAuthentication";
+
+ }
+ }
}
- return null;
+ return selectedProcessID;
}
/* (non-Javadoc)
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/CollectAddtionalAttributesTask.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/CollectAddtionalAttributesTask.java
index d0619d7f7..71b7b927e 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/CollectAddtionalAttributesTask.java
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/CollectAddtionalAttributesTask.java
@@ -8,7 +8,11 @@ import org.springframework.stereotype.Component;
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;
+import at.gv.egiz.eid4u.api.attributes.Definitions;
+import at.gv.egovernment.moa.id.protocols.eidas.EIDASData;
import at.gv.egovernment.moa.logging.Logger;
+import eu.eidas.auth.commons.attribute.ImmutableAttributeMap;
+import eu.eidas.auth.commons.attribute.ImmutableAttributeMap.Builder;
@Component("CollectAddtionalAttributesTask")
public class CollectAddtionalAttributesTask extends AbstractAuthServletTask {
@@ -17,9 +21,35 @@ public class CollectAddtionalAttributesTask extends AbstractAuthServletTask {
public void execute(ExecutionContext arg0, HttpServletRequest arg1, HttpServletResponse arg2)
throws TaskExecutionException {
try{
- Logger.debug("Starting eID4U attribute collection process ... ");
-
+ if (pendingReq instanceof EIDASData) {
+ EIDASData eidasReq = (EIDASData) pendingReq;
+ Logger.debug("Find eIDAS Auth. Req. Check if eID4U attributes are requested ...");
+ //select all eID4U attributes from requested attributes
+ Builder reqEid4uAttrListBuilder = ImmutableAttributeMap.builder();
+ ImmutableAttributeMap reqAttrList = eidasReq.getEidasRequestedAttributes();
+ for (String el : Definitions.EID4UATTRIBUTEELIST) {
+ if(reqAttrList.getAttributeValuesByNameUri(el) == null) {
+ Logger.debug("Find eID4U attr: " + el);
+ reqEid4uAttrListBuilder.put(reqAttrList.getDefinitionByNameUri(el));
+
+ }
+ }
+
+ //collect eID4U attributes, if some attributes are selected before
+ ImmutableAttributeMap reqEid4uAttrList = reqEid4uAttrListBuilder.build();
+ if (reqEid4uAttrList != null && reqEid4uAttrList.size() > 0) {
+ Logger.info("Starting eID4U attribute collection process ... ");
+ //TODO: implement collection process
+
+
+
+ } else
+ Logger.debug("No eID4U attributes found. Skip eID4U attribute collection");
+
+ } else
+ Logger.debug("No eIDAS Request found. Skip eID4U attribute collection");
+
} catch (Exception e) {
Logger.error("IdentityLink generation for foreign person FAILED.", e);
throw new TaskExecutionException(pendingReq, "IdentityLink generation for foreign person FAILED.", e);
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/resources/eid4u.Authentication.process.xml b/id/server/modules/moa-id-module-eIDAS/src/main/resources/eid4u.Authentication.process.xml
index fb6111d57..56af3955e 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/resources/eid4u.Authentication.process.xml
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/resources/eid4u.Authentication.process.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<pd:ProcessDefinition id="DefaultAuthentication" xmlns:pd="http://reference.e-government.gv.at/namespace/moa/process/definition/v1">
+<pd:ProcessDefinition id="eID4UAttributCollectionAuthentication" xmlns:pd="http://reference.e-government.gv.at/namespace/moa/process/definition/v1">
<!--
- National authentication with Austrian Citizen Card and mobile signature with our without mandate.