aboutsummaryrefslogtreecommitdiff
path: root/id/server/modules/moa-id-module-eIDAS/src/main/java
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2018-10-03 12:28:20 +0200
committerThomas Lenz <thomas.lenz@egiz.gv.at>2018-10-03 12:28:20 +0200
commit99ad40ac333c737165e3d7110642048da27a1c41 (patch)
treed28a75cc9b837eedf5220da4f3a03283ee401b71 /id/server/modules/moa-id-module-eIDAS/src/main/java
parenta814729177647c5c28a57a4ab0d6948137224624 (diff)
downloadmoa-id-spss-99ad40ac333c737165e3d7110642048da27a1c41.tar.gz
moa-id-spss-99ad40ac333c737165e3d7110642048da27a1c41.tar.bz2
moa-id-spss-99ad40ac333c737165e3d7110642048da27a1c41.zip
update eID4U attribute builder in MOA-ID to support complexe attributes
Diffstat (limited to 'id/server/modules/moa-id-module-eIDAS/src/main/java')
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/CurrentPhotoAttrBuilder.java18
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/HomeInstituteAddressAttrBuilder.java18
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/IdTypeAttrBuilder.java17
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/LanguageCertificatesAttrBuilder.java19
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/LanguageProficiencyAttrBuilder.java20
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/MaritalstateAttrBuilder.java18
-rw-r--r--id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/TemporaryAddressAttrBuilder.java19
7 files changed, 88 insertions, 41 deletions
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/CurrentPhotoAttrBuilder.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/CurrentPhotoAttrBuilder.java
index 2702b9e06..4b8e6ec29 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/CurrentPhotoAttrBuilder.java
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/CurrentPhotoAttrBuilder.java
@@ -7,6 +7,7 @@ import at.gv.egiz.eaaf.core.api.idp.IAuthData;
import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration;
import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException;
import at.gv.egiz.eid4u.api.attributes.Definitions;
+import at.gv.egiz.eid4u.impl.attributes.xjc.eid4u.generic.Document;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.IeIDASAttribute;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.eIDASMetadata;
@@ -17,14 +18,19 @@ public class CurrentPhotoAttrBuilder implements IeIDASAttribute {
public <ATT> ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator<ATT> g)
throws AttributeBuilderException {
- //TODO: requires update
+ Object docObj= authData.getGenericData(getName(), Object.class);
- String idType= authData.getGenericData(getName(), String.class);
- if (StringUtils.isNotEmpty(idType))
- return g.buildStringAttribute(Definitions.CURRENTPHOTO_FRIENDLYNAME, getName(), idType);
+ if (docObj instanceof Document) {
+ return g.buildStringAttribute(Definitions.CURRENTPHOTO_FRIENDLYNAME, getName(), ((Document)docObj).toString());
+
+
+ } else if (docObj instanceof String) {
+ if (StringUtils.isNotEmpty((String)docObj))
+ return g.buildStringAttribute(Definitions.CURRENTPHOTO_FRIENDLYNAME, getName(), (String)docObj);
- else
- throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
+ }
+
+ throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
}
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/HomeInstituteAddressAttrBuilder.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/HomeInstituteAddressAttrBuilder.java
index f6fe1d668..b5e240759 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/HomeInstituteAddressAttrBuilder.java
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/HomeInstituteAddressAttrBuilder.java
@@ -9,6 +9,7 @@ import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException;
import at.gv.egiz.eid4u.api.attributes.Definitions;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.IeIDASAttribute;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.eIDASMetadata;
+import eu.eidas.auth.commons.protocol.eidas.impl.PostalAddress;
@eIDASMetadata
public class HomeInstituteAddressAttrBuilder implements IeIDASAttribute {
@@ -17,14 +18,19 @@ public class HomeInstituteAddressAttrBuilder implements IeIDASAttribute {
public <ATT> ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator<ATT> g)
throws AttributeBuilderException {
- //TODO: need update for complex attributes
+ Object obj= authData.getGenericData(getName(), Object.class);
- String idType= authData.getGenericData(getName(), String.class);
- if (StringUtils.isNotEmpty(idType))
- return g.buildStringAttribute(Definitions.HOMEINSTITUTIONADDRESS_FRIENDLYNAME, getName(), idType);
+ if (obj instanceof PostalAddress) {
+ return g.buildStringAttribute(Definitions.HOMEINSTITUTIONADDRESS_FRIENDLYNAME, getName(), ((PostalAddress)obj).toString());
+
+
+ } else if (obj instanceof String) {
+ if (StringUtils.isNotEmpty((String)obj))
+ return g.buildStringAttribute(Definitions.HOMEINSTITUTIONADDRESS_FRIENDLYNAME, getName(), (String) obj);
- else
- throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
+ }
+
+ throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
}
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/IdTypeAttrBuilder.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/IdTypeAttrBuilder.java
index 5077c09a2..e2aff59e9 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/IdTypeAttrBuilder.java
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/IdTypeAttrBuilder.java
@@ -7,6 +7,7 @@ import at.gv.egiz.eaaf.core.api.idp.IAuthData;
import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration;
import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException;
import at.gv.egiz.eid4u.api.attributes.Definitions;
+import at.gv.egiz.eid4u.api.attributes.natural.IdType;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.IeIDASAttribute;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.eIDASMetadata;
@@ -17,12 +18,18 @@ public class IdTypeAttrBuilder implements IeIDASAttribute {
public <ATT> ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator<ATT> g)
throws AttributeBuilderException {
- String idType= authData.getGenericData(getName(), String.class);
- if (StringUtils.isNotEmpty(idType))
- return g.buildStringAttribute(Definitions.IDTYPE_FRIENDLYNAME, getName(), idType);
+ Object idTypeObj= authData.getGenericData(getName(), Object.class);
- else
- throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
+ if (idTypeObj instanceof IdType)
+ return g.buildStringAttribute(Definitions.IDTYPE_FRIENDLYNAME, getName(), ((IdType)idTypeObj).getValue());
+
+ else if (idTypeObj instanceof String) {
+ String idType = (String)idTypeObj;
+ if (StringUtils.isNotEmpty(idType))
+ return g.buildStringAttribute(Definitions.IDTYPE_FRIENDLYNAME, getName(), idType);
+ }
+
+ throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
}
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/LanguageCertificatesAttrBuilder.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/LanguageCertificatesAttrBuilder.java
index 6ddab4ece..4c88a54c1 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/LanguageCertificatesAttrBuilder.java
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/LanguageCertificatesAttrBuilder.java
@@ -7,6 +7,8 @@ import at.gv.egiz.eaaf.core.api.idp.IAuthData;
import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration;
import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException;
import at.gv.egiz.eid4u.api.attributes.Definitions;
+import at.gv.egiz.eid4u.impl.attributes.xjc.eid4u.CertificatesType;
+import at.gv.egiz.eid4u.impl.attributes.xjc.eid4u.generic.Document;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.IeIDASAttribute;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.eIDASMetadata;
@@ -17,14 +19,19 @@ public class LanguageCertificatesAttrBuilder implements IeIDASAttribute {
public <ATT> ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator<ATT> g)
throws AttributeBuilderException {
- //TODO: requires update for complexe attributes
+ Object certObj= authData.getGenericData(getName(), Object.class);
- String idType= authData.getGenericData(getName(), String.class);
- if (StringUtils.isNotEmpty(idType))
- return g.buildStringAttribute(Definitions.LANGUAGECERTIFICATES_FRIENDLYNAME, getName(), idType);
+ if (certObj instanceof CertificatesType) {
+ return g.buildStringAttribute(Definitions.LANGUAGECERTIFICATES_FRIENDLYNAME, getName(), ((CertificatesType)certObj).toString());
+
+
+ } else if (certObj instanceof String) {
+ if (StringUtils.isNotEmpty((String)certObj))
+ return g.buildStringAttribute(Definitions.LANGUAGECERTIFICATES_FRIENDLYNAME, getName(), (String) certObj);
- else
- throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
+ }
+
+ throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
}
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/LanguageProficiencyAttrBuilder.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/LanguageProficiencyAttrBuilder.java
index 8010543eb..b3c30a8a2 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/LanguageProficiencyAttrBuilder.java
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/LanguageProficiencyAttrBuilder.java
@@ -7,6 +7,8 @@ import at.gv.egiz.eaaf.core.api.idp.IAuthData;
import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration;
import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException;
import at.gv.egiz.eid4u.api.attributes.Definitions;
+import at.gv.egiz.eid4u.impl.attributes.xjc.eid4u.CertificatesType;
+import at.gv.egiz.eid4u.impl.attributes.xjc.eid4u.LanguageLevelType;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.IeIDASAttribute;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.eIDASMetadata;
@@ -17,14 +19,20 @@ public class LanguageProficiencyAttrBuilder implements IeIDASAttribute {
public <ATT> ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator<ATT> g)
throws AttributeBuilderException {
- //TODO: requires update for complexe attributes
+ Object certObj= authData.getGenericData(getName(), Object.class);
- String idType= authData.getGenericData(getName(), String.class);
- if (StringUtils.isNotEmpty(idType))
- return g.buildStringAttribute(Definitions.LANGUAGEPROFICIENCY_FRIENDLYNAME, getName(), idType);
+ if (certObj instanceof LanguageLevelType) {
+ return g.buildStringAttribute(Definitions.LANGUAGEPROFICIENCY_FRIENDLYNAME, getName(), ((LanguageLevelType)certObj).toString());
+
+
+ } else if (certObj instanceof String) {
+ if (StringUtils.isNotEmpty((String)certObj))
+
+ return g.buildStringAttribute(Definitions.LANGUAGEPROFICIENCY_FRIENDLYNAME, getName(), (String) certObj);
- else
- throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
+ }
+
+ throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
}
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/MaritalstateAttrBuilder.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/MaritalstateAttrBuilder.java
index 838d75b38..98410a606 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/MaritalstateAttrBuilder.java
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/MaritalstateAttrBuilder.java
@@ -7,6 +7,7 @@ import at.gv.egiz.eaaf.core.api.idp.IAuthData;
import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration;
import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException;
import at.gv.egiz.eid4u.api.attributes.Definitions;
+import at.gv.egiz.eid4u.api.attributes.natural.MaritalState;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.IeIDASAttribute;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.eIDASMetadata;
@@ -16,15 +17,20 @@ public class MaritalstateAttrBuilder implements IeIDASAttribute {
@Override
public <ATT> ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator<ATT> g)
throws AttributeBuilderException {
+
+ Object valueObj = authData.getGenericData(getName(), Object.class);
- //TODO allow eID4U attribute values
+ if (valueObj instanceof MaritalState)
+ return g.buildStringAttribute(Definitions.MARITALSTATE_FRIENDLYNAME, getName(), ((MaritalState)valueObj).getValue());
- String idType= authData.getGenericData(getName(), String.class);
- if (StringUtils.isNotEmpty(idType))
- return g.buildStringAttribute(Definitions.MARITALSTATE_FRIENDLYNAME, getName(), idType);
+ else if (valueObj instanceof String) {
+ String value = (String)valueObj;
+ if (StringUtils.isNotEmpty(value));
+ return g.buildStringAttribute(Definitions.MARITALSTATE_FRIENDLYNAME, getName(), value);
- else
- throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
+ }
+
+ throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
}
diff --git a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/TemporaryAddressAttrBuilder.java b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/TemporaryAddressAttrBuilder.java
index 5fa0673bd..32131e325 100644
--- a/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/TemporaryAddressAttrBuilder.java
+++ b/id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/TemporaryAddressAttrBuilder.java
@@ -7,8 +7,10 @@ import at.gv.egiz.eaaf.core.api.idp.IAuthData;
import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration;
import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException;
import at.gv.egiz.eid4u.api.attributes.Definitions;
+import at.gv.egiz.eid4u.impl.attributes.xjc.eid4u.generic.Document;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.IeIDASAttribute;
import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.eIDASMetadata;
+import eu.eidas.auth.commons.protocol.eidas.impl.PostalAddress;
@eIDASMetadata
public class TemporaryAddressAttrBuilder implements IeIDASAttribute {
@@ -17,14 +19,19 @@ public class TemporaryAddressAttrBuilder implements IeIDASAttribute {
public <ATT> ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator<ATT> g)
throws AttributeBuilderException {
- //TODO: requires WORK!!!!!
+ Object obj= authData.getGenericData(getName(), Object.class);
- String idType= authData.getGenericData(getName(), String.class);
- if (StringUtils.isNotEmpty(idType))
- return g.buildStringAttribute(Definitions.TEMPORARYADDRESS_FRIENDLYNAME, getName(), idType);
+ if (obj instanceof PostalAddress) {
+ return g.buildStringAttribute(Definitions.TEMPORARYADDRESS_FRIENDLYNAME, getName(), ((PostalAddress)obj).toString());
+
+
+ } else if (obj instanceof String) {
+ if (StringUtils.isNotEmpty((String)obj))
+ return g.buildStringAttribute(Definitions.TEMPORARYADDRESS_FRIENDLYNAME, getName(), (String) obj);
- else
- throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
+ }
+
+ throw new AttributeBuilderException("Attribute '" + getName() + "' is not available");
}