package at.gv.egovernment.moa.id.auth.modules.eidas.tasks; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; 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 { @Override public void execute(ExecutionContext arg0, HttpServletRequest arg1, HttpServletResponse arg2) throws TaskExecutionException { try{ 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); } } }