Example #1
0
        public virtual bool TryReadEndpointReference(XmlDictionaryReader reader, out EndpointReference endpointReference)
        {
            if (!reader.IsStartElement(Elements.EndpointReference, Namespace))
            {
                return(Out.False(out endpointReference));
            }

            var endpoint = new EndpointReference();

            ReadEndpointReferenceAttributes(reader, endpoint);
            reader.ForEachChild(r => TryReadEndpointReferenceChild(r, endpoint));

            endpointReference = endpoint;
            return(true);
        }
        protected override bool TryReadRoleDescriptor(XmlDictionaryReader reader, out RoleDescriptor role)
        {
            if (!reader.IsStartElement(Saml2MetadataConstants.Elements.RoleDescriptor, Saml2MetadataConstants.Namespace))
            {
                return(Out.False(out role));
            }

            var d = null as RoleDescriptor;

            if (reader.TryReadFederationEndpointType(out var type))
            {
                if (type == FederationEndpointType.ApplicationService)
                {
                    d = new ApplicationServiceDescriptor();
                }
                if (type == FederationEndpointType.AttributeService)
                {
                    d = new AttributeServiceDescriptor();
                }
                if (type == FederationEndpointType.PseudonymService)
                {
                    d = new PseudonymServiceDescriptor();
                }
                if (type == FederationEndpointType.SecurityTokenService)
                {
                    d = new SecurityTokenServiceDescriptor();
                }
            }
            if (d == null)
            {
                d = new RoleDescriptor();
            }
            ReadRoleDescriptorAttributes(reader, d);

            reader.ForEachChild(r => TryReadRoleDescriptorChild(r, d), out var signature);
            d.Signature = signature;

            role = d;
            return(true);
        }