protected virtual void WriteApplicationServiceDescriptorChildren(XmlDictionaryWriter writer, ApplicationServiceDescriptor applicationServiceDescriptor)
        {
            if (applicationServiceDescriptor == null)
            {
                return;
            }
            if (!applicationServiceDescriptor.ApplicationServiceEndpoint.Any())
            {
                throw XmlWriterExceptionHelper.CreateRequiredChildElementMissingException(Saml2MetadataConstants.Elements.RoleDescriptor, applicationServiceDescriptor.GetXmlTypeName());
            }

            WriteWebServiceDescriptorChildren(writer, applicationServiceDescriptor);

            foreach (var applicationServiceEndpoint in applicationServiceDescriptor.ApplicationServiceEndpoint)
            {
                WsAddressingSerializer.WriteEndpointReferenceCollection(writer, Prefix, Elements.ApplicationServiceEndpoint, Namespace, applicationServiceEndpoint);
            }

            foreach (var singleSignOutNotificationEndpoint in applicationServiceDescriptor.SingleSignOutNotificationEndpoint)
            {
                WsAddressingSerializer.WriteEndpointReferenceCollection(writer, Prefix, Elements.SingleSignOutNotificationEndpoint, Namespace, singleSignOutNotificationEndpoint);
            }

            foreach (var passiveRequestorEndpoint in applicationServiceDescriptor.PassiveRequestorEndpoint)
            {
                WsAddressingSerializer.WriteEndpointReferenceCollection(writer, Prefix, Elements.PassiveRequestorEndpoint, Namespace, passiveRequestorEndpoint);
            }
        }
Пример #2
0
        public virtual void WriteEndpointReference(XmlDictionaryWriter writer, EndpointReference endpointReference)
        {
            if (endpointReference == null)
            {
                return;
            }

            writer.WriteStartElement(Elements.EndpointReference, Namespace);
            if (!writer.TryWriteElementValue(Elements.Address, Namespace, endpointReference.Address))
            {
                throw XmlWriterExceptionHelper.CreateRequiredChildElementMissingException(Elements.EndpointReference, Elements.Address);
            }

            writer.WriteEndElement();
        }
Пример #3
0
        public virtual void WriteClaimType(XmlDictionaryWriter writer, ClaimType claimType)
        {
            if (claimType == null)
            {
                return;
            }

            writer.WriteStartElement(Elements.ClaimType, Namespace);
            if (!writer.TryWriteAttributeValue(Attributes.Uri, claimType.Uri))
            {
                throw XmlWriterExceptionHelper.CreateRequiredAttributeMissingException(Elements.ClaimType, Attributes.Uri);
            }
            _ = writer.TryWriteAttributeValue(Attributes.Optional, claimType.Optional);

            _ = writer.TryWriteElementValue(Elements.DisplayName, Namespace, claimType.DisplayName);
            _ = writer.TryWriteElementValue(Elements.Description, Namespace, claimType.Description);
            _ = writer.TryWriteElementValue(Elements.DisplayValue, Namespace, claimType.DisplayValue);

            _ = writer.TryWriteElementValue(Elements.Value, Namespace, claimType.Value);

            writer.WriteEndElement();
        }