package at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.eid4u; import org.apache.commons.lang3.StringUtils; import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator; 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.egovernment.moa.id.protocols.eidas.attributes.builder.IeIDASAttribute; import at.gv.egovernment.moa.id.protocols.eidas.attributes.builder.eIDASMetadata; @eIDASMetadata public class MaritalstateAttrBuilder implements IeIDASAttribute { @Override public ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator g) throws AttributeBuilderException { //TODO allow eID4U attribute values String idType= authData.getGenericData(getName(), String.class); if (StringUtils.isNotEmpty(idType)) return g.buildStringAttribute(Definitions.MARITALSTATE_FRIENDLYNAME, getName(), idType); else throw new AttributeBuilderException("Attribute '" + getName() + "' is not available"); } @Override public ATT buildEmpty(IAttributeGenerator g) { return g.buildEmptyAttribute(Definitions.MARITALSTATE_FRIENDLYNAME, getName()); } @Override public String getName() { return Definitions.EHICID_NAME; } }