protected virtual void WriteWebServiceDescriptorAttributes(XmlWriter writer, WebServiceDescriptor descriptor) { if (writer == null) { throw new ArgumentNullException(nameof(writer)); } if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } WriteRoleDescriptorAttributes(writer, descriptor); writer.WriteAttributeIfPresent(Saml2MetadataConstants.Attributes.ServiceDisplayName, null, descriptor.ServiceDisplayName); writer.WriteAttributeIfPresent(Saml2MetadataConstants.Attributes.ServiceDescription, null, descriptor.ServiceDescription); WriteCustomAttributes(writer, descriptor); }
protected virtual void WriteWebServiceDescriptorElements(XmlWriter writer, WebServiceDescriptor descriptor) { if (writer == null) { throw new ArgumentNullException(nameof(writer)); } if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } WriteRoleDescriptorElements(writer, descriptor); if (descriptor.TokenTypesOffered.Count > 0) { writer.WriteStartElement(FederationMetadataConstants.Elements.TokenTypesOffered, FederationMetadataConstants.Namespace); foreach (var tokenType in descriptor.TokenTypesOffered) { writer.WriteStartElement(WSFederationMetadataConstants.Elements.TokenType, WSFederationMetadataConstants.Namespace); if (!tokenType.IsAbsoluteUri) { throw new MetadataSerializationException("Token type is not absolute URI"); } writer.WriteAttributeString(WSFederationMetadataConstants.Attributes.Uri, tokenType.AbsoluteUri); writer.WriteEndElement(); } writer.WriteEndElement(); } if (descriptor.ClaimTypesOffered.Count > 0) { writer.WriteStartElement(FederationMetadataConstants.Elements.ClaimTypesOffered, FederationMetadataConstants.Namespace); foreach (var claim in descriptor.ClaimTypesOffered) { WriteDisplayClaim(writer, claim); } writer.WriteEndElement(); } if (descriptor.ClaimTypesRequested.Count > 0) { writer.WriteStartElement(FederationMetadataConstants.Elements.ClaimTypesRequested, FederationMetadataConstants.Namespace); foreach (var claim in descriptor.ClaimTypesRequested) { WriteDisplayClaim(writer, claim); } writer.WriteEndElement(); } if (descriptor.TargetScopes.Count > 0) { writer.WriteStartElement(FederationMetadataConstants.Elements.TargetScopes, FederationMetadataConstants.Namespace); foreach (var address in descriptor.TargetScopes) { WriteEndpointReference(writer, address); } writer.WriteEndElement(); } WriteCustomElements(writer, descriptor); }