diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2018-10-03 12:28:20 +0200 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2018-10-03 12:28:20 +0200 |
commit | 99ad40ac333c737165e3d7110642048da27a1c41 (patch) | |
tree | d28a75cc9b837eedf5220da4f3a03283ee401b71 /id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/HomeInstituteAddressAttrBuilder.java | |
parent | a814729177647c5c28a57a4ab0d6948137224624 (diff) | |
download | moa-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/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/HomeInstituteAddressAttrBuilder.java')
-rw-r--r-- | id/server/modules/moa-id-module-eIDAS/src/main/java/at/gv/egovernment/moa/id/protocols/eidas/attributes/builder/eid4u/HomeInstituteAddressAttrBuilder.java | 18 |
1 files changed, 12 insertions, 6 deletions
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"); } |