void writeIdentityProvider(XMLExtendedStreamWriter writer, ModelNode model) throws XMLStreamException { if (!model.isDefined()) { return; } for (Property idp : model.asPropertyList()) { writer.writeStartElement(Constants.XML.IDENTITY_PROVIDER); writer.writeAttribute(Constants.XML.ENTITY_ID, idp.getName()); ModelNode idpAttributes = idp.getValue(); for (SimpleAttributeDefinition attr : IdentityProviderDefinition.ATTRIBUTES) { attr.getAttributeMarshaller().marshallAsAttribute(attr, idpAttributes, false, writer); } writeSingleSignOn(writer, idpAttributes.get(Constants.Model.SINGLE_SIGN_ON)); writeSingleLogout(writer, idpAttributes.get(Constants.Model.SINGLE_LOGOUT)); writeKeys(writer, idpAttributes.get(Constants.Model.KEY)); } writer.writeEndElement(); }
void writeSps(final XMLExtendedStreamWriter writer, final ModelNode model) throws XMLStreamException { if (!model.isDefined()) { return; } for (Property sp : model.get(Constants.Model.SERVICE_PROVIDER).asPropertyList()) { writer.writeStartElement(Constants.XML.SERVICE_PROVIDER); writer.writeAttribute(Constants.XML.ENTITY_ID, sp.getName()); ModelNode spAttributes = sp.getValue(); for (SimpleAttributeDefinition attr : ServiceProviderDefinition.ATTRIBUTES) { attr.getAttributeMarshaller().marshallAsAttribute(attr, spAttributes, false, writer); } writeKeys(writer, spAttributes.get(Constants.Model.KEY)); writePrincipalNameMapping(writer, spAttributes); writeRoleIdentifiers(writer, spAttributes); writeIdentityProvider(writer, spAttributes.get(Constants.Model.IDENTITY_PROVIDER)); writer.writeEndElement(); } }