public void write(SPSSODescriptorType spSSODescriptor) throws ProcessingException { StaxUtil.writeStartElement( writer, METADATA_PREFIX, JBossSAMLConstants.SP_SSO_DESCRIPTOR.get(), METADATA_NSURI.get()); StaxUtil.writeAttribute( writer, new QName(JBossSAMLConstants.PROTOCOL_SUPPORT_ENUMERATION.get()), spSSODescriptor.getProtocolSupportEnumeration().get(0)); // Write the attributes Boolean authnSigned = spSSODescriptor.isAuthnRequestsSigned(); if (authnSigned != null) { StaxUtil.writeAttribute( writer, new QName(JBossSAMLConstants.WANT_AUTHN_REQUESTS_SIGNED.get()), authnSigned.toString()); } Boolean wantAssertionsSigned = spSSODescriptor.isWantAssertionsSigned(); if (wantAssertionsSigned != null) { StaxUtil.writeAttribute( writer, new QName(JBossSAMLConstants.WANT_ASSERTIONS_SIGNED.get()), wantAssertionsSigned.toString()); } // Get the key descriptors List<KeyDescriptorType> keyDescriptors = spSSODescriptor.getKeyDescriptor(); for (KeyDescriptorType keyDescriptor : keyDescriptors) { writeKeyDescriptor(keyDescriptor); } List<EndpointType> sloServices = spSSODescriptor.getSingleLogoutService(); for (EndpointType endpoint : sloServices) { writeSingleLogoutService(endpoint); } List<IndexedEndpointType> artifactResolutions = spSSODescriptor.getArtifactResolutionService(); for (IndexedEndpointType artifactResolution : artifactResolutions) { writeArtifactResolutionService(artifactResolution); } List<String> nameIDFormats = spSSODescriptor.getNameIDFormat(); for (String nameIDFormat : nameIDFormats) { writeNameIDFormat(nameIDFormat); } List<IndexedEndpointType> assertionConsumers = spSSODescriptor.getAssertionConsumerService(); for (IndexedEndpointType assertionConsumer : assertionConsumers) { writeAssertionConsumerService(assertionConsumer); } List<AttributeConsumingServiceType> attributeConsumers = spSSODescriptor.getAttributeConsumingService(); for (AttributeConsumingServiceType attributeConsumer : attributeConsumers) { writeAttributeConsumingService(attributeConsumer); } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
public void write(IDPSSODescriptorType idpSSODescriptor) throws ProcessingException { if (idpSSODescriptor == null) throw new ProcessingException(logger.nullArgumentError("IDPSSODescriptorType")); StaxUtil.writeStartElement( writer, METADATA_PREFIX, JBossSAMLConstants.IDP_SSO_DESCRIPTOR.get(), METADATA_NSURI.get()); Boolean wantsAuthnRequestsSigned = idpSSODescriptor.isWantAuthnRequestsSigned(); if (wantsAuthnRequestsSigned != null) { StaxUtil.writeAttribute( writer, new QName(JBossSAMLConstants.WANT_AUTHN_REQUESTS_SIGNED.get()), wantsAuthnRequestsSigned.toString()); } writeProtocolSupportEnumeration(idpSSODescriptor.getProtocolSupportEnumeration()); List<IndexedEndpointType> artifactResolutionServices = idpSSODescriptor.getArtifactResolutionService(); for (IndexedEndpointType indexedEndpoint : artifactResolutionServices) { writeArtifactResolutionService(indexedEndpoint); } List<EndpointType> sloServices = idpSSODescriptor.getSingleLogoutService(); for (EndpointType endpoint : sloServices) { writeSingleLogoutService(endpoint); } List<EndpointType> ssoServices = idpSSODescriptor.getSingleSignOnService(); for (EndpointType endpoint : ssoServices) { writeSingleSignOnService(endpoint); } List<String> nameIDFormats = idpSSODescriptor.getNameIDFormat(); for (String nameIDFormat : nameIDFormats) { writeNameIDFormat(nameIDFormat); } List<AttributeType> attributes = idpSSODescriptor.getAttribute(); for (AttributeType attribType : attributes) { write(attribType); } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }