ReadElementContentAsUniqueId() public method

public ReadElementContentAsUniqueId ( ) : System.Xml.UniqueId
return System.Xml.UniqueId
        public static MakeConnectionMessageInfo Create(XmlDictionaryReader reader)
        {
            MakeConnectionMessageInfo makeConnectionInfo = new MakeConnectionMessageInfo();

            if (reader.IsStartElement(MakeConnectionConstants.MakeConnectionMessage.Name, MakeConnectionConstants.Namespace))
            {
                reader.ReadStartElement();
                reader.MoveToContent();

                while (reader.IsStartElement())
                {
                    if (reader.IsStartElement(MakeConnectionConstants.MakeConnectionMessage.AddressElement, MakeConnectionConstants.Namespace))
                    {
                        if (!string.IsNullOrEmpty(makeConnectionInfo.Address))
                        {
                            makeConnectionInfo.MultipleAddressHeaders = true;
                            reader.Skip();
                        }
                        else
                        {
                            makeConnectionInfo.Address = reader.ReadElementContentAsString();
                        }
                    }
                    else if (reader.IsStartElement(MakeConnectionConstants.MakeConnectionMessage.IdentifierElement, MakeConnectionConstants.Namespace))
                    {
                        if (makeConnectionInfo.Identifier != null)
                        {
                            makeConnectionInfo.MultipleIdentifierHeaders = true;
                            reader.Skip();
                        }
                        else
                        {
                            makeConnectionInfo.Identifier = reader.ReadElementContentAsUniqueId();
                        }
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(makeConnectionInfo.UnknownSelection))
                        {
                            makeConnectionInfo.UnknownSelection = reader.LocalName;
                        }

                        reader.Skip();
                    }
                }

                reader.ReadEndElement();
            }

            return makeConnectionInfo;
        }
 protected override UniqueId ReadGeneration(XmlDictionaryReader reader)
 {
     return reader.ReadElementContentAsUniqueId();
 }
示例#3
0
        public static void ReadHeaderValue(XmlDictionaryReader reader, AddressingVersion version, out Uri relationshipType, out UniqueId messageId)
        {
            AddressingDictionary addressingDictionary = XD.AddressingDictionary;

            // The RelationshipType attribute has no namespace.
            relationshipType = ReplyRelationshipType;
            /*
            string relation = reader.GetAttribute(addressingDictionary.RelationshipType, addressingDictionary.Empty);
            if (relation == null)
            {
                relationshipType = ReplyRelationshipType;
            }
            else
            {
                relationshipType = new Uri(relation);
            }
            */
            Fx.Assert(reader.IsStartElement(addressingDictionary.RelatesTo, version.DictionaryNamespace), "");
            messageId = reader.ReadElementContentAsUniqueId();
        }
示例#4
0
 public static UniqueId ReadHeaderValue(XmlDictionaryReader reader, AddressingVersion version)
 {
     Fx.Assert(reader.IsStartElement(XD.AddressingDictionary.MessageId, version.DictionaryNamespace), "");
     return reader.ReadElementContentAsUniqueId();
 }
 public static void ReadHeaderValue(XmlDictionaryReader reader, AddressingVersion version, out Uri relationshipType, out System.Xml.UniqueId messageId)
 {
     AddressingDictionary addressingDictionary = XD.AddressingDictionary;
     relationshipType = ReplyRelationshipType;
     messageId = reader.ReadElementContentAsUniqueId();
 }
            public override SecurityToken ReadTokenCore(XmlDictionaryReader reader, SecurityTokenResolver tokenResolver)
            {
                UniqueId contextId = null;
                byte[] encodedCookie = null;
                UniqueId generation = null;
                bool isCookieMode = false;

                Fx.Assert(reader.NodeType == XmlNodeType.Element, "");

                // check if there is an id
                string id = reader.GetAttribute(XD.UtilityDictionary.IdAttribute, XD.UtilityDictionary.Namespace);

                SecurityContextSecurityToken sct = null;

                // There needs to be at least a contextId in here.
                reader.ReadFullStartElement();
                reader.MoveToStartElement(parent.SerializerDictionary.Identifier, parent.SerializerDictionary.Namespace);
                contextId = reader.ReadElementContentAsUniqueId();
                if (CanReadGeneration(reader))
                {
                    generation = ReadGeneration(reader);
                }
                if (reader.IsStartElement(parent.SerializerDictionary.Cookie, XD.DotNetSecurityDictionary.Namespace))
                {
                    isCookieMode = true;
                    ISecurityContextSecurityTokenCache sctCache;
                    sct = TryResolveSecurityContextToken(contextId, generation, id, tokenResolver, out sctCache);
                    if (sct == null)
                    {
                        encodedCookie = reader.ReadElementContentAsBase64();
                        if (encodedCookie != null)
                        {
                            sct = cookieSerializer.CreateSecurityContextFromCookie(encodedCookie, contextId, generation, id, reader.Quotas);
                            if (sctCache != null)
                            {
                                sctCache.AddContext(sct);
                            }
                        }
                    }
                    else
                    {
                        reader.Skip();
                    }
                }
                reader.ReadEndElement();

                if (contextId == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.GetString(SR.NoSecurityContextIdentifier)));
                }

                if (sct == null && !isCookieMode)
                {
                    ISecurityContextSecurityTokenCache sctCache;
                    sct = TryResolveSecurityContextToken(contextId, generation, id, tokenResolver, out sctCache);
                }
                if (sct == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new SecurityContextTokenValidationException(SR.GetString(SR.SecurityContextNotRegistered, contextId, generation)));
                }
                return sct;
            }
 public static UniqueId ReadHeaderValue(XmlDictionaryReader reader, AddressingVersion version)
 {
     return reader.ReadElementContentAsUniqueId();
 }