public void writeMetaData(Writer writer) {
try {
ObjectFactory metaDataFactory = new ObjectFactory();
IndexedEndpointType acsRedirectEndpoint = metaDataFactory.createIndexedEndpointType();
acsRedirectEndpoint.setBinding(SamlConstants.HTTP_REDIRECT_BINDING);
acsRedirectEndpoint.setLocation(getServiceURL(SamlServiceType.SAML_ASSERTION_CONSUMER_SERVICE));
IndexedEndpointType acsPostEndpoint = metaDataFactory.createIndexedEndpointType();
acsPostEndpoint.setBinding(SamlConstants.HTTP_POST_BINDING);
acsPostEndpoint.setLocation(getServiceURL(SamlServiceType.SAML_ASSERTION_CONSUMER_SERVICE));
SPSSODescriptorType spSsoDescriptor = metaDataFactory.createSPSSODescriptorType();
spSsoDescriptor.getAssertionConsumerService().add(acsRedirectEndpoint);
spSsoDescriptor.getAssertionConsumerService().add(acsPostEndpoint);