diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2018-07-02 18:10:21 +0200 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2018-07-02 18:10:21 +0200 |
commit | 47ca9c6c93447788376ba53e394ed3116d5a3dcc (patch) | |
tree | 84589a13c36c0af1dd7777cba370427b98b739ef /eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/builder/reqattr/EAAFRequestedAttributeUnmarshaller.java | |
parent | 92cdbc5d83547b3c3326a2878f9e58a171ac13b3 (diff) | |
download | EAAF-Components-47ca9c6c93447788376ba53e394ed3116d5a3dcc.tar.gz EAAF-Components-47ca9c6c93447788376ba53e394ed3116d5a3dcc.tar.bz2 EAAF-Components-47ca9c6c93447788376ba53e394ed3116d5a3dcc.zip |
add requested attributes to PVP S-profile
Diffstat (limited to 'eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/builder/reqattr/EAAFRequestedAttributeUnmarshaller.java')
-rw-r--r-- | eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/builder/reqattr/EAAFRequestedAttributeUnmarshaller.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/builder/reqattr/EAAFRequestedAttributeUnmarshaller.java b/eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/builder/reqattr/EAAFRequestedAttributeUnmarshaller.java new file mode 100644 index 00000000..2754f145 --- /dev/null +++ b/eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/builder/reqattr/EAAFRequestedAttributeUnmarshaller.java @@ -0,0 +1,51 @@ +package at.gv.egiz.eaaf.modules.pvp2.impl.builder.reqattr; + +import javax.xml.namespace.QName; + +import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller; +import org.opensaml.xml.XMLObject; +import org.opensaml.xml.io.UnmarshallingException; +import org.opensaml.xml.util.XMLHelper; +import org.w3c.dom.Attr; + +import at.gv.egiz.eaaf.modules.pvp2.PVPConstants; +import at.gv.egiz.eaaf.modules.pvp2.api.reqattr.EAAFRequestedAttribute; + +public class EAAFRequestedAttributeUnmarshaller extends AbstractSAMLObjectUnmarshaller { + protected final void processChildElement(final XMLObject parentSAMLObject, final XMLObject childSAMLObject) throws UnmarshallingException { + final EAAFRequestedAttribute requestedAttr = (EAAFRequestedAttribute) parentSAMLObject; + final QName childQName = childSAMLObject.getElementQName(); + + if ("AttributeValue".equals(childQName.getLocalPart()) + && childQName.getNamespaceURI().equals(PVPConstants.EIDAS10_SAML_NS)) { + requestedAttr.getAttributeValues().add(childSAMLObject); + + } else + super.processChildElement(parentSAMLObject, childSAMLObject); + + } + + protected final void processAttribute(final XMLObject samlObject, final Attr attribute) throws UnmarshallingException { + final EAAFRequestedAttribute requestedAttr = (EAAFRequestedAttribute) samlObject; + if (attribute.getLocalName().equals(EAAFRequestedAttribute.NAME_ATTRIB_NAME)) { + requestedAttr.setName(attribute.getValue()); + + } else if (attribute.getLocalName().equals(EAAFRequestedAttribute.NAME_FORMAT_ATTR)) { + requestedAttr.setNameFormat(attribute.getValue()); + + } else if (attribute.getLocalName().equals(EAAFRequestedAttribute.FRIENDLY_NAME_ATT)) { + requestedAttr.setFriendlyName(attribute.getValue()); + + } else if (attribute.getLocalName().equals(EAAFRequestedAttribute.IS_REQUIRED_ATTR)) { + requestedAttr.setIsRequired(attribute.getValue()); + + } else { + final QName attribQName = XMLHelper.getNodeQName(attribute); + if (attribute.isId()) { + requestedAttr.getUnknownAttributes().registerID(attribQName); + } + requestedAttr.getUnknownAttributes().put(attribQName, + attribute.getValue()); + } + } +} |