aboutsummaryrefslogtreecommitdiff
path: root/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2019-02-19 11:30:59 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2019-02-19 11:30:59 +0100
commit3e1aba668f76677ecd3923b039e52b5bb5348d96 (patch)
treee039ff06930d85e6e17e02c1b8db4bd7e97bc886 /id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv
parent1cd7a8508a61feadcebad0426609d3b45f6db6ad (diff)
downloadmoa-id-spss-3e1aba668f76677ecd3923b039e52b5bb5348d96.tar.gz
moa-id-spss-3e1aba668f76677ecd3923b039e52b5bb5348d96.tar.bz2
moa-id-spss-3e1aba668f76677ecd3923b039e52b5bb5348d96.zip
update eID4u attribute collection and add a jUnit test for TUG->eID4u attribute mapping
Diffstat (limited to 'id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv')
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/eid4u/utils/AttributeScopeMapper.java239
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/CollectAddtionalAttributesTask.java30
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/ReceiveConsentForAddtionalAttributesTask.java77
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eIDASAttrRepresentativeNaturalPersonalIdentifier.java2
4 files changed, 296 insertions, 52 deletions
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/eid4u/utils/AttributeScopeMapper.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/eid4u/utils/AttributeScopeMapper.java
new file mode 100644
index 000000000..69cc131ff
--- /dev/null
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/eid4u/utils/AttributeScopeMapper.java
@@ -0,0 +1,239 @@
+package at.gv.egovernment.moa.id.auth.modules.eidas.eid4u.utils;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.commons.lang3.StringUtils;
+
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+
+import at.gv.egiz.eid4u.api.attributes.Definitions;
+import at.gv.egovernment.moaspss.logging.Logger;
+import eu.eidas.auth.commons.protocol.eidas.impl.PostalAddress;
+
+public class AttributeScopeMapper {
+
+ private static AttributeScopeMapper instance = null;
+
+ public static final String Scope_Delimiter = " ";
+
+ public static final String Citizenship = "ANY@tugraz.idm.attr.Citizenship";
+ public static final String CityOfBirth = "ANY@tugraz.idm.attr.CityOfBirth";
+ public static final String CountryOfBirth = "ANY@tugraz.idm.attr.CountryOfBirth";
+ public static final String CurrentDegreeName = "ANY@tugraz.idm.attr.CurrentDegreeName";
+ public static final String CurrentFieldOfStudy = "ANY@tugraz.idm.attr.CurrentFieldOfStudy";
+ public static final String CurrentLevelOfStudy = "ANY@tugraz.idm.attr.CurrentLevelOfStudy";
+ public static final String EmailStud = "ANY@tugraz.idm.attr.EmailStud";
+ public static final String Gender = "ANY@tugraz.idm.attr.Gender";
+ public static final String HomeInstitutionName = "ANY@tugraz.idm.attr.HomeInstitutionName";
+ public static final String HomeInstitutionCountry = "ANY@tugraz.idm.attr.HomeInstitutionCountry";
+
+ public static final String HomeInstitutionAddressCountryCode = "ANY@tugraz.idm.attr.HomeInstitutionAddressCountryCode";
+ public static final String HomeInstitutionAddressPostalCode = "ANY@tugraz.idm.attr.HomeInstitutionAddressPostalCode";
+ public static final String HomeInstitutionAddressStreet = "ANY@tugraz.idm.attr.HomeInstitutionAddressStreet";
+ public static final String HomeInstitutionAddressCity = "ANY@tugraz.idm.attr.HomeInstitutionAddressCity";
+
+ public static final String PermanentAddressCity = "ANY@tugraz.idm.attr.PermanentAddressCity";
+ public static final String PermanentAddressCountryCode = "ANY@tugraz.idm.attr.PermanentAddressCountryCode";
+ public static final String PermanentAddressPostalCode = "ANY@tugraz.idm.attr.PermanentAddressPostalCode";
+ public static final String PermanentAddressStreet = "ANY@tugraz.idm.attr.PermanentAddressStreet";
+
+ public static final String StudyAddressCity = "ANY@tugraz.idm.attr.StudyAddressCity";
+ public static final String StudyAddressCountryCode = "ANY@tugraz.idm.attr.StudyAddressCountryCode";
+ public static final String StudyAddressPostalCode = "ANY@tugraz.idm.attr.StudyAddressPostalCode";
+ public static final String StudyAddressStreet = "ANY@tugraz.idm.attr.StudyAddressStreet";
+
+ private static List<String> complexeScopes = new ArrayList<String>();
+
+ private static final Map<String, String> eIDASToScopes = Collections.unmodifiableMap(new HashMap<String,String>() {
+ private static final long serialVersionUID = 1L;
+ {
+ put(Definitions.CITIZENSHIP_NAME, Citizenship);
+ put(eu.eidas.auth.engine.core.eidas.spec.NaturalPersonSpec.Definitions.PLACE_OF_BIRTH.getNameUri().toString(),
+ CityOfBirth);
+ put(Definitions.COUNTRYOFBIRTH_NAME, CountryOfBirth);
+ put(Definitions.CURRENTDEGREE_NAME, CurrentDegreeName);
+ put(Definitions.FIELDOFSTUDY_NAME, CurrentFieldOfStudy);
+ put(Definitions.CURRENTLEVELOFSTUDY_NAME, CurrentLevelOfStudy);
+ put(Definitions.EMAIL_NAME, EmailStud);
+ put(eu.eidas.auth.engine.core.eidas.spec.NaturalPersonSpec.Definitions.GENDER.getNameUri().toString(),
+ Gender);
+ put(Definitions.HOMEINSTITUTIONNAME_NAME, HomeInstitutionName);
+ put(Definitions.HOMEINSTITUTIONCOUNTRY_NAME, HomeInstitutionCountry);
+
+ put(Definitions.HOMEINSTITUTIONADDRESS_NAME,
+ HomeInstitutionAddressCountryCode + Scope_Delimiter
+ + HomeInstitutionAddressPostalCode + Scope_Delimiter
+ + HomeInstitutionAddressStreet + Scope_Delimiter
+ + HomeInstitutionAddressCity);
+ put(eu.eidas.auth.engine.core.eidas.spec.NaturalPersonSpec.Definitions.CURRENT_ADDRESS.getNameUri().toString(),
+ PermanentAddressCity + Scope_Delimiter
+ + PermanentAddressCountryCode + Scope_Delimiter
+ + PermanentAddressPostalCode + Scope_Delimiter
+ + PermanentAddressStreet);
+ put(Definitions.TEMPORARYADDRESS_NAME,
+ StudyAddressCity + Scope_Delimiter
+ + StudyAddressCountryCode + Scope_Delimiter
+ + StudyAddressPostalCode + Scope_Delimiter
+ + StudyAddressStreet);
+
+ }
+ });
+
+ private static Map<String, String> scopesToeIDAS = Collections.unmodifiableMap(new HashMap<String,String>() {
+ private static final long serialVersionUID = 1L;
+ {
+ Iterator<Entry<String, String>> it = eIDASToScopes.entrySet().iterator();
+ while (it.hasNext()) {
+ Entry<String, String> el = it.next();
+ String[] value = el.getValue().split(Scope_Delimiter);
+ if (value.length == 1)
+ put(el.getValue(), el.getKey());
+
+ else {
+ for (String i : value) {
+ put(i, el.getKey());
+ complexeScopes.add(i);
+
+ }
+ }
+ }
+ }
+ });
+
+
+
+
+ public static AttributeScopeMapper getInstance() {
+ if (instance == null) {
+ instance = new AttributeScopeMapper();
+
+ }
+
+ return instance;
+ }
+
+ /**
+ * Map a eID4U attribute-name into a TUG Scope
+ *
+ * @param eID4UAttributeName eID4U attribute-name
+ * @return TUG Scope
+ */
+ public String getTUGScopesForAttribute(String eID4UAttributeName) {
+ if (eIDASToScopes.containsKey(eID4UAttributeName))
+ return eIDASToScopes.get(eID4UAttributeName);
+
+ else {
+ Logger.info("eID4U attribute '" + eID4UAttributeName + "' CAN NOT provides from TUG");
+ return StringUtils.EMPTY;
+
+ }
+
+ }
+
+ /**
+ * Map a TUG Scope into an eID4u attribute-name
+ *
+ * @param scope TUG scope
+ * @return eID4u attribute name
+ */
+ public String geteIDASAttrFromScope(String scope) {
+ return scopesToeIDAS.get(scope);
+
+ }
+
+ /**
+ * Check if an TUG scope is part of a complex eID4u attribute
+ *
+ * @param scope TUG scope
+ * @return true if scope is part of a complex attribute, otherwise false
+ */
+ public boolean isComplexeScope(String scope) {
+ return complexeScopes.contains(scope);
+
+ }
+
+ /**
+ * Convert the TUG Attribute-provider response into a Map<attributeName, attributeValue> of eID4U attributes
+ *
+ *
+ * @param jsonObject TUG AP response
+ * @return Map of eID4U attributes, but never null
+ */
+ public Map<String, Object> populateEid4uAttributesFromTugResponse(JsonObject jsonObject) {
+ Map<String, Object> result = new HashMap<String, Object>();
+ Map<String, String> complexAttr = new HashMap<String, String>();
+
+ Iterator<Entry<String, JsonElement>> it = jsonObject.entrySet().iterator();
+ while (it.hasNext()) {
+ Entry<String, JsonElement> el = it.next();
+ String key = el.getKey();
+
+ Logger.trace("Starting TUG scrope mapping for: " + key + " ... ");
+ String eIDASAttr = AttributeScopeMapper.getInstance().geteIDASAttrFromScope(key);
+ if (StringUtils.isNotEmpty(eIDASAttr)) {
+ if (!AttributeScopeMapper.getInstance().isComplexeScope(key)) {
+ Logger.debug("Map simple TUG scope: " + key + " to eIDAS attribute: " + eIDASAttr);
+ result.put(eIDASAttr, el.getValue().getAsString());
+
+ } else {
+ Logger.trace("Find complex TUG scope: " + key);
+ complexAttr.put(eIDASAttr, null);
+
+ }
+
+ } else
+ Logger.info("Can NOT map TUG scope: " + key + " to any eID4U attribute");
+
+ }
+
+ //TODO: can only Map address attributes
+ Iterator<String> complIt = complexAttr.keySet().iterator();
+ while(complIt.hasNext()) {
+ String attr = complIt.next();
+
+ eu.eidas.auth.commons.protocol.eidas.impl.PostalAddress.Builder address = PostalAddress.builder();
+ if (Definitions.HOMEINSTITUTIONADDRESS_NAME.equals(attr)) {
+ address.postCode(jsonObject.get(AttributeScopeMapper.HomeInstitutionAddressPostalCode).getAsString());
+ address.postName(jsonObject.get(AttributeScopeMapper.HomeInstitutionAddressCity).getAsString());
+ address.cvAddressArea(jsonObject.get(AttributeScopeMapper.HomeInstitutionAddressStreet).getAsString());
+ address.thoroughfare(jsonObject.get(AttributeScopeMapper.HomeInstitutionAddressStreet).getAsString());
+ result.put(attr, address.build());
+
+ } else if (Definitions.TEMPORARYADDRESS_NAME.equals(attr)) {
+ address.postCode(jsonObject.get(AttributeScopeMapper.StudyAddressPostalCode).getAsString());
+ address.postName(jsonObject.get(AttributeScopeMapper.StudyAddressCity).getAsString());
+ address.cvAddressArea(jsonObject.get(AttributeScopeMapper.StudyAddressStreet).getAsString());
+ address.thoroughfare(jsonObject.get(AttributeScopeMapper.StudyAddressStreet).getAsString());
+ result.put(attr, address.build());
+
+ } else if (eu.eidas.auth.engine.core.eidas.spec.NaturalPersonSpec.Definitions.CURRENT_ADDRESS.getNameUri().toString().equals(attr)) {
+ address.postCode(jsonObject.get(AttributeScopeMapper.PermanentAddressPostalCode).getAsString());
+ address.postName(jsonObject.get(AttributeScopeMapper.PermanentAddressCity).getAsString());
+ address.cvAddressArea(jsonObject.get(AttributeScopeMapper.PermanentAddressStreet).getAsString());
+ address.thoroughfare(jsonObject.get(AttributeScopeMapper.PermanentAddressStreet).getAsString());
+ result.put(attr, address.build());
+
+ } else {
+ Logger.warn("Complexe eID4U attribute: " + attr + " is NOT SUPPORTED yet!");
+
+ }
+
+ }
+
+ return result;
+
+ }
+
+
+ private AttributeScopeMapper() {
+
+ }
+
+}
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 9d9d44b34..a58bc4f8d 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
@@ -5,9 +5,12 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.google.common.collect.UnmodifiableIterator;
+
import at.gv.egiz.eaaf.core.api.idp.IAuthData;
import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
import at.gv.egiz.eaaf.core.api.storage.ITransactionStorage;
@@ -19,7 +22,8 @@ import at.gv.egiz.eid4u.api.attributes.Definitions;
import at.gv.egovernment.moa.id.auth.builder.AuthenticationDataBuilder;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSessionWrapper;
import at.gv.egovernment.moa.id.auth.modules.eidas.eID4UConstants;
-import at.gv.egovernment.moa.id.auth.modules.eidas.utils.SimpleEidasAttributeGenerator;
+import at.gv.egovernment.moa.id.auth.modules.eidas.eid4u.utils.AttributeScopeMapper;
+import at.gv.egovernment.moa.id.protocols.builder.attributes.SimpleStringAttributeGenerator;
import at.gv.egovernment.moa.id.protocols.eidas.EIDASData;
import at.gv.egovernment.moa.id.protocols.oauth20.OAuth20Constants;
import at.gv.egovernment.moa.id.protocols.oauth20.OAuth20SessionObject;
@@ -31,6 +35,7 @@ import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.MiscUtil;
import eu.eidas.auth.commons.attribute.ImmutableAttributeMap;
import eu.eidas.auth.commons.attribute.ImmutableAttributeMap.Builder;
+import eu.eidas.auth.commons.attribute.ImmutableAttributeMap.ImmutableAttributeEntry;
@Component("CollectAddtionalAttributesTask")
public class CollectAddtionalAttributesTask extends AbstractAuthServletTask {
@@ -75,8 +80,7 @@ public class CollectAddtionalAttributesTask extends AbstractAuthServletTask {
if (MiscUtil.isEmpty(scopes)) {
//generate scope from attributes
- //TODO extract 'scopes' from requested attributes
- Logger.warn("Dynamic 'scope' generation is currently NOT supported");
+ scopes = mapReqAttributesIntoScopes(reqEid4uAttrList);
}
@@ -139,7 +143,7 @@ public class CollectAddtionalAttributesTask extends AbstractAuthServletTask {
new BPKAttributeBuilder().build(
fakeOpenIDReq.getServiceProviderConfiguration(),
authData,
- new SimpleEidasAttributeGenerator()));
+ new SimpleStringAttributeGenerator()));
requestStoreage.storePendingRequest(pendingReq);
} else
@@ -156,4 +160,22 @@ public class CollectAddtionalAttributesTask extends AbstractAuthServletTask {
}
+ private String mapReqAttributesIntoScopes(ImmutableAttributeMap reqEid4uAttrList) {
+ String result = StringUtils.EMPTY;
+ UnmodifiableIterator<ImmutableAttributeEntry<?>> it = reqEid4uAttrList.entrySet().iterator();
+ while (it.hasNext()) {
+ ImmutableAttributeEntry<?> el = it.next();
+ String scope = AttributeScopeMapper.getInstance().getTUGScopesForAttribute(
+ el.getKey().getNameUri().toString());
+
+ if (result.isEmpty())
+ result = scope;
+ else
+ result += " " + scope;
+
+ }
+
+ return result;
+ }
+
}
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/ReceiveConsentForAddtionalAttributesTask.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/ReceiveConsentForAddtionalAttributesTask.java
index 3f1e999ca..e878f8ab1 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/ReceiveConsentForAddtionalAttributesTask.java
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/auth/modules/eidas/tasks/ReceiveConsentForAddtionalAttributesTask.java
@@ -3,11 +3,14 @@ package at.gv.egovernment.moa.id.auth.modules.eidas.tasks;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
+import java.util.Map;
+import java.util.Map.Entry;
import javax.net.ssl.SSLSocketFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.io.IOUtils;
import org.apache.http.Header;
import org.apache.http.HttpHeaders;
import org.apache.http.HttpResponse;
@@ -26,10 +29,9 @@ import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
import at.gv.egiz.eaaf.core.exceptions.EAAFStorageException;
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.egiz.eid4u.api.attributes.natural.IdType;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSessionWrapper;
import at.gv.egovernment.moa.id.auth.modules.eidas.eID4UConstants;
+import at.gv.egovernment.moa.id.auth.modules.eidas.eid4u.utils.AttributeScopeMapper;
import at.gv.egovernment.moa.id.auth.modules.eidas.exceptions.eID4UAPException;
import at.gv.egovernment.moa.id.commons.api.AuthConfiguration;
import at.gv.egovernment.moa.id.commons.utils.HttpClientWithProxySupport;
@@ -39,11 +41,11 @@ import at.gv.egovernment.moa.id.util.CookieUtils;
import at.gv.egovernment.moa.id.util.SSLUtils;
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.MiscUtil;
-import eu.eidas.auth.commons.protocol.eidas.impl.PostalAddress;
@Component("ReceiveConsentForAddtionalAttributesTask")
public class ReceiveConsentForAddtionalAttributesTask extends AbstractAuthServletTask {
+ private static final int HashMap = 0;
@Autowired private AuthConfiguration moaAuthConfig;
@Override
@@ -128,12 +130,14 @@ public class ReceiveConsentForAddtionalAttributesTask extends AbstractAuthServle
if (Logger.isTraceEnabled()) {
for (Header el : httpResultToken.getAllHeaders())
- Logger.trace("Headername:" + el.getName() + " Value:" + el.getValue());
+ Logger.trace("Resp. Headername:" + el.getName() + " Value:" + el.getValue());
}
if (httpResultToken.getStatusLine().getStatusCode() != 200) {
Logger.info("eID4U AP TokenService anwser with StatusCode:" + httpResultToken.getStatusLine().getStatusCode()
+ " eID4U AP process stopping ... ");
+ if (httpResultToken.getEntity().getContent() != null)
+ Logger.trace("StatusMessage: " + IOUtils.toString(httpResultToken.getEntity().getContent(), "UTF-8"));
throw new eID4UAPException("eID4U AP TokenService return statusCode: " + httpResultToken.getStatusLine().getStatusCode(), null);
}
@@ -166,6 +170,11 @@ public class ReceiveConsentForAddtionalAttributesTask extends AbstractAuthServle
"X-PVP-BPK",
pendingReq.getRawData(eID4UConstants.PROCESS_CONTEXT_USERS_BPK_EID4U_ATTRPROVIDER, String.class));
+ if (Logger.isTraceEnabled()) {
+ for (Header el : httpGetData.getAllHeaders())
+ Logger.trace("Req. Headername:" + el.getName() + " Value:" + el.getValue());
+ }
+
//request Attribute Provider
HttpResponse httpResultData = httpClient.execute(httpGetData);
@@ -175,12 +184,15 @@ public class ReceiveConsentForAddtionalAttributesTask extends AbstractAuthServle
if (Logger.isTraceEnabled()) {
for (Header el : httpResultData.getAllHeaders())
- Logger.trace("Headername:" + el.getName() + " Value:" + el.getValue());
+ Logger.trace("Resp. Headername:" + el.getName() + " Value:" + el.getValue());
}
if (httpResultData.getStatusLine().getStatusCode() != 200) {
Logger.info("eID4U Attr.Provider Service anwser with StatusCode:" + httpResultData.getStatusLine().getStatusCode()
+ " eID4U AP process stopping ... ");
+ if (httpResultData.getEntity().getContent() != null)
+ Logger.trace("StatusMessage: " + IOUtils.toString(httpResultData.getEntity().getContent(), "UTF-8"));
+
throw new eID4UAPException("eID4U Attr.Provider Service return statusCode: " + httpResultData.getStatusLine().getStatusCode(), null);
}
@@ -191,11 +203,13 @@ public class ReceiveConsentForAddtionalAttributesTask extends AbstractAuthServle
new InputStreamReader(httpResultData.getEntity().getContent()));
Logger.trace("FullAttrSet: " + fullAttrSet.toString());
+ //populate eID4U attributes
+ populateEid4uAttributes(fullAttrSet.getAsJsonObject());
- //TODO: implement collection process
- populateEid4uDummyAttributes(fullAttrSet.getAsJsonObject());
-
-
+ //store pendingRequest
+ requestStoreage.storePendingRequest(pendingReq);
+
+
} else
Logger.debug("No eIDAS Request found. Skip eID4U attribute collection");
@@ -206,48 +220,17 @@ public class ReceiveConsentForAddtionalAttributesTask extends AbstractAuthServle
}
}
-
- private void populateEid4uDummyAttributes(JsonObject jsonObject) {
+
+ private void populateEid4uAttributes(JsonObject jsonObject) throws EAAFStorageException {
try {
- eu.eidas.auth.commons.protocol.eidas.impl.PostalAddress.Builder dummyAddr = PostalAddress.builder();
- dummyAddr.postCode("8020");
- dummyAddr.postName("Graz");
- dummyAddr.addressId("25");
- dummyAddr.cvAddressArea("Mustergasse");
- dummyAddr.locatorDesignator("25");
- dummyAddr.thoroughfare("Mustergasse");
-
AuthenticationSessionWrapper session = pendingReq.getSessionData(AuthenticationSessionWrapper.class);
- session.setGenericDataToSession(Definitions.IDTYPE_NAME, IdType.PASSPORT);
- session.setGenericDataToSession(Definitions.IDNUMBER_NAME, "P0571414");
-// session.setGenericDataToSession(Definitions.IDISSUER_NAME, "Magistrat Nirgendwo");
-// session.setGenericDataToSession(Definitions.IDEXPIREDATE_NAME, "2020-01-01");
-// //session.setGenericDataToSession(Definitions.EHICID_NAME, "80010000012345678990");
-// session.setGenericDataToSession(Definitions.NATIONALITY_NAME, "AT");
-// session.setGenericDataToSession(Definitions.CITIZENSHIP_FRIENDLYNAME, "AT");
-// session.setGenericDataToSession(Definitions.MARITALSTATE_NAME, MaritalState.SINGLE);
-// session.setGenericDataToSession(Definitions.COUNTRYOFBIRTH_NAME, "AT");
- session.setGenericDataToSession(Definitions.EMAIL_NAME, jsonObject.get("email").getAsString());
-// session.setGenericDataToSession(Definitions.PHONE_NAME, "+43666111222444");
-// session.setGenericDataToSession(Definitions.TEMPORARYADDRESS_NAME, dummyAddr.build());
- //session.setGenericDataToSession(Definitions.TAXIDENTIFICATIONNUMBER_NAME, "AT/1213454654718");
-// session.setGenericDataToSession(Definitions.HOMEINSTITUTIONNAME_NAME, "Graz Technical University");
-// session.setGenericDataToSession(Definitions.HOMEINSTITUTIONIDENTIFIER_NAME, "A GRAZ02");
-// session.setGenericDataToSession(Definitions.HOMEINSTITUTIONCOUNTRY_NAME, "AT");
-// session.setGenericDataToSession(Definitions.HOMEINSTITUTIONADDRESS_NAME, dummyAddr.build());
-// session.setGenericDataToSession(Definitions.CURRENTLEVELOFSTUDY_NAME, "7");
-// session.setGenericDataToSession(Definitions.FIELDOFSTUDY_NAME, "52");
- //session.setGenericDataToSession(Definitions.CURRENTDEGREE_NAME, "MsC");
-// session.setGenericDataToSession(Definitions.DEGREE_NAME, "6");
-// session.setGenericDataToSession(Definitions.DEGREEAWARDINGINSTITUTION_NAME, "Graz Technical University");
-// session.setGenericDataToSession(Definitions.GRADUATIONYEAR_NAME, "2016");
-// session.setGenericDataToSession(Definitions.DEGREECOUNTRY_NAME, "AT");
-
- //TODO: not all attributes are populated with dummy values
+ Map<String, Object> eID4UAttributes = AttributeScopeMapper.getInstance().populateEid4uAttributesFromTugResponse(jsonObject);
+ for (Entry<String, Object> el : eID4UAttributes.entrySet())
+ session.setGenericDataToSession(el.getKey(), el.getValue());
} catch (EAAFStorageException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ Logger.warn("Can NOT inject authentication data into user object.", e);
+ throw e;
}
}
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eIDASAttrRepresentativeNaturalPersonalIdentifier.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eIDASAttrRepresentativeNaturalPersonalIdentifier.java
index f7e135bae..14ba239a1 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eIDASAttrRepresentativeNaturalPersonalIdentifier.java
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eIDASAttrRepresentativeNaturalPersonalIdentifier.java
@@ -61,7 +61,7 @@ public class eIDASAttrRepresentativeNaturalPersonalIdentifier extends MandateNat
throws AttributeBuilderException {
try {
- Pair<String, String> calcResult = internalBPKGenerator(oaParam, authData);
+ Pair<String, String> calcResult = getBpkForSp(oaParam, authData);
if (calcResult != null) {
String personalID = calcResult.getFirst();
String type = calcResult.getSecond();