public IsStartElement ( System localName, System namespaceUri ) : bool | ||
localName | System | |
namespaceUri | System | |
리턴 | bool |
public virtual SamlStatement LoadStatement(XmlDictionaryReader reader, SecurityTokenSerializer keyInfoSerializer, SecurityTokenResolver outOfBandTokenResolver) { if (reader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader"); } if (reader.IsStartElement(this.DictionaryManager.SamlDictionary.AuthenticationStatement, this.DictionaryManager.SamlDictionary.Namespace)) { SamlAuthenticationStatement statement = new SamlAuthenticationStatement(); statement.ReadXml(reader, this, keyInfoSerializer, outOfBandTokenResolver); return statement; } if (reader.IsStartElement(this.DictionaryManager.SamlDictionary.AttributeStatement, this.DictionaryManager.SamlDictionary.Namespace)) { SamlAttributeStatement statement2 = new SamlAttributeStatement(); statement2.ReadXml(reader, this, keyInfoSerializer, outOfBandTokenResolver); return statement2; } if (!reader.IsStartElement(this.DictionaryManager.SamlDictionary.AuthorizationDecisionStatement, this.DictionaryManager.SamlDictionary.Namespace)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(System.IdentityModel.SR.GetString("SAMLUnableToLoadUnknownElement", new object[] { reader.LocalName }))); } SamlAuthorizationDecisionStatement statement3 = new SamlAuthorizationDecisionStatement(); statement3.ReadXml(reader, this, keyInfoSerializer, outOfBandTokenResolver); return statement3; }
public static CloseSequenceInfo Create(XmlDictionaryReader reader) { if (reader == null) { Fx.Assert("Argument reader cannot be null."); } CloseSequenceInfo closeSequenceInfo = new CloseSequenceInfo(); XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(ReliableMessagingVersion.WSReliableMessaging11); Wsrm11Dictionary wsrm11Dictionary = DXD.Wsrm11Dictionary; reader.ReadStartElement(wsrm11Dictionary.CloseSequence, wsrmNs); reader.ReadStartElement(XD.WsrmFeb2005Dictionary.Identifier, wsrmNs); closeSequenceInfo.Identifier = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); if (reader.IsStartElement(wsrm11Dictionary.LastMsgNumber, wsrmNs)) { reader.ReadStartElement(); closeSequenceInfo.LastMsgNumber = WsrmUtilities.ReadSequenceNumber(reader, false); reader.ReadEndElement(); } while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); return closeSequenceInfo; }
static PollingDuplexSession ReadHeaderValue(XmlDictionaryReader reader) { string str = null; string str2 = null; if (reader.IsStartElement("Duplex", "http://schemas.microsoft.com/2008/04/netduplex")) { reader.ReadStartElement(); reader.MoveToContent(); while (reader.IsStartElement()) { if (reader.IsStartElement("SessionId", "http://schemas.microsoft.com/2008/04/netduplex")) { if (!string.IsNullOrEmpty(str2)) { throw new InvalidOperationException("Multiple sessionId elements in a duplex header."); } str2 = reader.ReadElementContentAsString(); if (string.IsNullOrEmpty(str2)) { throw new InvalidOperationException("Invalid sessionId element content in a duplex header."); } } else { if (reader.IsStartElement("Address", "http://schemas.microsoft.com/2008/04/netduplex")) { if (!string.IsNullOrEmpty(str)) { throw new InvalidOperationException("Multiple address elements in a duplex header."); } str = reader.ReadElementContentAsString(); if (string.IsNullOrEmpty(str)) { throw new InvalidOperationException("Invalid address element in a duplex header."); } continue; } if (reader.IsStartElement("CloseSession", "http://schemas.microsoft.com/2008/04/netduplex")) { reader.Skip(); continue; } reader.Skip(); } } reader.ReadEndElement(); } if (str == null) { throw new InvalidOperationException("Missing address in a duplex header."); } if (str2 == null) { throw new InvalidOperationException("Missing sessionId in a duplex header."); } return new PollingDuplexSession(str, str2); }
public override bool IsStartObject(XmlDictionaryReader reader) { if (reader == null) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("reader")); } reader.MoveToElement(); if (this.rootName != null) { return reader.IsStartElement(this.rootName, this.rootNamespace); } return reader.IsStartElement(); }
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; }
public static void Deserialize(XmlDictionaryReader reader, out IList<DirectoryControl> controls, bool mustBePresent, bool fullChecks) { string str = null; string str1 = null; bool flag; byte[] numArray = null; controls = new List<DirectoryControl>(); if (mustBePresent || reader.IsStartElement("controls", "http://schemas.microsoft.com/2008/1/ActiveDirectory")) { reader.ReadFullStartElement("controls", "http://schemas.microsoft.com/2008/1/ActiveDirectory"); while (reader.IsStartElement("control", "http://schemas.microsoft.com/2008/1/ActiveDirectory")) { string attribute = reader.GetAttribute("type"); string attribute1 = reader.GetAttribute("criticality"); reader.Read(); if (!reader.IsStartElement("controlValue", "http://schemas.microsoft.com/2008/1/ActiveDirectory")) { numArray = null; } else { string attribute2 = reader.GetAttribute("type", "http://www.w3.org/2001/XMLSchema-instance"); if (attribute2 != null) { XmlUtility.SplitPrefix(attribute2, out str, out str1); numArray = reader.ReadElementContentAsBase64(); } else { throw new ArgumentException(); } } if (!string.Equals("true", attribute1)) { flag = false; } else { flag = true; } DirectoryControl directoryControl = new DirectoryControl(attribute, numArray, flag, true); controls.Add(directoryControl); reader.Read(); } return; } else { return; } }
protected override void ReadAdditionalElements(XmlDictionaryReader reader) { if (reader.IsStartElement(System.ServiceModel.Security.ReferenceList.ElementName, EncryptedType.NamespaceUri)) { this.referenceList = new System.ServiceModel.Security.ReferenceList(); this.referenceList.ReadFrom(reader); } if (reader.IsStartElement(CarriedKeyElementName, EncryptedType.NamespaceUri)) { reader.ReadStartElement(CarriedKeyElementName, EncryptedType.NamespaceUri); this.carriedKeyName = reader.ReadString(); reader.ReadEndElement(); } }
/// <summary> /// Read the policy node /// </summary> /// <param name="rdr">XmlDictionaryReader for the policy Xml</param> /// <param name="subject">ClaimsPrincipal subject</param> /// <returns>A LINQ expression created from the policy</returns> private Expression<Func<ClaimsPrincipal, bool>> ReadNode(XmlDictionaryReader rdr, ParameterExpression subject) { Expression<Func<ClaimsPrincipal, bool>> policyExpression; if (!rdr.IsStartElement()) { throw new InvalidOperationException("Invalid Policy format."); } switch (rdr.Name) { case "and": policyExpression = ReadAnd(rdr, subject); break; case "or": policyExpression = ReadOr(rdr, subject); break; case "claim": policyExpression = ReadClaim(rdr); break; default: policyExpression = DefaultPolicy; break; } return policyExpression; }
public override void ReadXml(XmlDictionaryReader reader, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer, SecurityTokenResolver outOfBandTokenResolver) { if (reader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("reader")); } if (samlSerializer == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("samlSerializer")); } SamlDictionary samlDictionary = samlSerializer.DictionaryManager.SamlDictionary; if (!reader.IsStartElement(samlDictionary.DoNotCacheCondition, samlDictionary.Namespace)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityTokenException(System.IdentityModel.SR.GetString("SAMLBadSchema", new object[] { samlDictionary.DoNotCacheCondition.Value }))); } if (reader.IsEmptyElement) { reader.MoveToContent(); reader.Read(); } else { reader.MoveToContent(); reader.Read(); reader.ReadEndElement(); } }
public override void ReadXml(XmlDictionaryReader reader, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer, SecurityTokenResolver outOfBandTokenResolver) { if (reader == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("reader")); if (samlSerializer == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("samlSerializer")); #pragma warning suppress 56506 // samlSerializer.DictionaryManager is never null. SamlDictionary dictionary = samlSerializer.DictionaryManager.SamlDictionary; if (!reader.IsStartElement(dictionary.DoNotCacheCondition, dictionary.Namespace)) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityTokenException(SR.GetString(SR.SAMLBadSchema, dictionary.DoNotCacheCondition.Value))); // saml:DoNotCacheCondition is a empty element. So just issue a read for // the empty element. if (reader.IsEmptyElement) { reader.MoveToContent(); reader.Read(); return; } reader.MoveToContent(); reader.Read(); reader.ReadEndElement(); }
protected static void VerifyStartBody(XmlDictionaryReader reader, EnvelopeVersion version) { if (!reader.IsStartElement(XD.MessageDictionary.Body, version.DictionaryNamespace)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CommunicationException(System.ServiceModel.SR.GetString("MessageBodyMissing"))); } }
public void ReadXml( XmlDictionaryReader reader ) { if ( reader == null ) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( "reader" ); } reader.MoveToContent(); if ( !reader.IsStartElement( XmlEncryptionConstants.Elements.EncryptionMethod, XmlEncryptionConstants.Namespace ) ) { return; } _algorithm = reader.GetAttribute( XmlEncryptionConstants.Attributes.Algorithm, null ); if ( !reader.IsEmptyElement ) { // // Trace unread missing element // string xml = reader.ReadOuterXml(); if ( DiagnosticUtility.ShouldTraceWarning ) { TraceUtility.TraceString( System.Diagnostics.TraceEventType.Warning, SR.GetString( SR.ID8024, reader.Name, reader.NamespaceURI, xml ) ); } } else { // // Read to the next element // reader.Read(); } }
/// <summary> /// Read the policy as a LINQ expression /// </summary> /// <param name="rdr">XmlDictionaryReader for the policy Xml</param> /// <returns></returns> public Expression<Func<ClaimsPrincipal, bool>> ReadPolicy(XmlDictionaryReader rdr) { if (rdr.Name != "policy") { throw new InvalidOperationException("Invalid policy document"); } rdr.Read(); if (!rdr.IsStartElement()) { rdr.ReadEndElement(); // There are no claims inside this policy which means allow access to the page. return AllowAccessForDefaultPagePolicy; } // // Instantiate a parameter for the ClaimsPrincipal so it can be evaluated against // each claim constraint. // ParameterExpression subject = Expression.Parameter(typeof(ClaimsPrincipal), "subject"); Expression<Func<ClaimsPrincipal, bool>> result = ReadNode(rdr, subject); rdr.ReadEndElement(); return result; }
public void ReadXml( XmlDictionaryReader reader ) { if ( reader == null ) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( "reader" ); } reader.MoveToContent(); if ( !reader.IsStartElement( XmlEncryptionConstants.Elements.CipherData, XmlEncryptionConstants.Namespace ) ) { throw DiagnosticUtility.ThrowHelperXml( reader, SR.GetString( SR.ID4188 ) ); } reader.ReadStartElement( XmlEncryptionConstants.Elements.CipherData, XmlEncryptionConstants.Namespace ); reader.ReadStartElement( XmlEncryptionConstants.Elements.CipherValue, XmlEncryptionConstants.Namespace ); _cipherText = reader.ReadContentAsBase64(); _iv = null; // <CipherValue> reader.MoveToContent(); reader.ReadEndElement(); // <CipherData> reader.MoveToContent(); reader.ReadEndElement(); }
internal X509CertificateEndpointIdentity(XmlDictionaryReader reader) { if (reader == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader"); reader.MoveToContent(); if (reader.IsEmptyElement) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.Format(SR.UnexpectedEmptyElementExpectingClaim, XD.AddressingDictionary.X509v3Certificate.Value, XD.AddressingDictionary.IdentityExtensionNamespace.Value))); reader.ReadStartElement(XD.XmlSignatureDictionary.X509Data, XD.XmlSignatureDictionary.Namespace); while (reader.IsStartElement(XD.XmlSignatureDictionary.X509Certificate, XD.XmlSignatureDictionary.Namespace)) { reader.MoveToContent(); X509Certificate2 certificate = new X509Certificate2(Convert.FromBase64String(reader.ReadContentAsString())); if (certificateCollection.Count == 0) { // This is the first certificate. We assume this as the primary // certificate and initialize the base class. Initialize(new Claim(ClaimTypes.Thumbprint, certificate.GetCertHash(), Rights.PossessProperty)); } certificateCollection.Add(certificate); } reader.ReadEndElement(); if (certificateCollection.Count == 0) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.Format(SR.UnexpectedEmptyElementExpectingClaim, XD.AddressingDictionary.X509v3Certificate.Value, XD.AddressingDictionary.IdentityExtensionNamespace.Value))); }
public static TerminateSequenceResponseInfo Create(XmlDictionaryReader reader) { if (reader == null) { Fx.Assert("Argument reader cannot be null."); } TerminateSequenceResponseInfo terminateSequenceInfo = new TerminateSequenceResponseInfo(); XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(ReliableMessagingVersion.WSReliableMessaging11); reader.ReadStartElement(DXD.Wsrm11Dictionary.TerminateSequenceResponse, wsrmNs); reader.ReadStartElement(XD.WsrmFeb2005Dictionary.Identifier, wsrmNs); terminateSequenceInfo.Identifier = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); return terminateSequenceInfo; }
public void ReadFrom(XmlDictionaryReader reader, long maxBufferSize) { this.ValidateReadState(); reader.MoveToStartElement(this.OpeningElementName, NamespaceUri); this.encoding = reader.GetAttribute(EncodingAttribute, null); this.id = reader.GetAttribute(System.ServiceModel.XD.XmlEncryptionDictionary.Id, null) ?? System.ServiceModel.Security.SecurityUniqueId.Create().Value; this.wsuId = reader.GetAttribute(System.ServiceModel.XD.XmlEncryptionDictionary.Id, System.ServiceModel.XD.UtilityDictionary.Namespace) ?? System.ServiceModel.Security.SecurityUniqueId.Create().Value; this.mimeType = reader.GetAttribute(MimeTypeAttribute, null); this.type = reader.GetAttribute(TypeAttribute, null); this.ReadAdditionalAttributes(reader); reader.Read(); if (reader.IsStartElement(EncryptionMethodElement.ElementName, NamespaceUri)) { this.encryptionMethod.ReadFrom(reader); } if (this.tokenSerializer.CanReadKeyIdentifier(reader)) { this.KeyIdentifier = this.tokenSerializer.ReadKeyIdentifier(reader); } reader.ReadStartElement(CipherDataElementName, NamespaceUri); reader.ReadStartElement(CipherValueElementName, NamespaceUri); if (maxBufferSize == 0L) { this.ReadCipherData(reader); } else { this.ReadCipherData(reader, maxBufferSize); } reader.ReadEndElement(); reader.ReadEndElement(); this.ReadAdditionalElements(reader); reader.ReadEndElement(); this.State = EncryptionState.Read; }
public virtual void ReadXml( XmlDictionaryReader reader ) { if ( reader == null ) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( "reader" ); } reader.MoveToContent(); if ( reader.IsStartElement( XD.XmlSignatureDictionary.KeyInfo.Value, XD.XmlSignatureDictionary.Namespace.Value ) ) { // <KeyInfo> reader.ReadStartElement(); while ( reader.IsStartElement() ) { // <RetrievalMethod> if ( reader.IsStartElement( XmlSignatureConstants.Elements.RetrievalMethod, XD.XmlSignatureDictionary.Namespace.Value ) ) { string method = reader.GetAttribute( XD.XmlSignatureDictionary.URI.Value ); if ( !string.IsNullOrEmpty( method ) ) { _retrieval = method; } reader.Skip(); } // check if internal serializer can handle clause else if ( _keyInfoSerializer.CanReadKeyIdentifierClause( reader ) ) { _ski.Add( _keyInfoSerializer.ReadKeyIdentifierClause( reader ) ); } // trace we skipped over an element else if ( reader.IsStartElement() ) { string xml = reader.ReadOuterXml(); if ( DiagnosticUtility.ShouldTraceWarning ) { TraceUtility.TraceString( System.Diagnostics.TraceEventType.Warning, SR.GetString( SR.ID8023, reader.Name, reader.NamespaceURI, xml ) ); } } reader.MoveToContent(); } reader.MoveToContent(); reader.ReadEndElement(); } }
public override SecurityKeyIdentifierClause ReadKeyIdentifierClauseCore(XmlDictionaryReader reader) { string encryptionMethod = null; string carriedKeyName = null; SecurityKeyIdentifier encryptingKeyIdentifier = null; byte[] encryptedKey = null; reader.ReadStartElement(XD.XmlEncryptionDictionary.EncryptedKey, NamespaceUri); if (reader.IsStartElement(XD.XmlEncryptionDictionary.EncryptionMethod, NamespaceUri)) { encryptionMethod = reader.GetAttribute(XD.XmlEncryptionDictionary.AlgorithmAttribute, null); bool isEmptyElement = reader.IsEmptyElement; reader.ReadStartElement(); if (!isEmptyElement) { while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); } } if (this.securityTokenSerializer.CanReadKeyIdentifier(reader)) { encryptingKeyIdentifier = this.securityTokenSerializer.ReadKeyIdentifier(reader); } reader.ReadStartElement(XD.XmlEncryptionDictionary.CipherData, NamespaceUri); reader.ReadStartElement(XD.XmlEncryptionDictionary.CipherValue, NamespaceUri); encryptedKey = reader.ReadContentAsBase64(); reader.ReadEndElement(); reader.ReadEndElement(); if (reader.IsStartElement(XD.XmlEncryptionDictionary.CarriedKeyName, NamespaceUri)) { reader.ReadStartElement(); carriedKeyName = reader.ReadString(); reader.ReadEndElement(); } reader.ReadEndElement(); return new EncryptedKeyIdentifierClause(encryptedKey, encryptionMethod, encryptingKeyIdentifier, carriedKeyName); }
public override bool IsStartObject(XmlDictionaryReader reader) { if (reader == null) { throw new ArgumentNullException("reader"); } reader.MoveToElement(); return reader.IsStartElement(); }
public virtual SamlCondition LoadCondition(XmlDictionaryReader reader, SecurityTokenSerializer keyInfoSerializer, SecurityTokenResolver outOfBandTokenResolver) { if (reader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader"); } if (reader.IsStartElement(this.DictionaryManager.SamlDictionary.AudienceRestrictionCondition, this.DictionaryManager.SamlDictionary.Namespace)) { SamlAudienceRestrictionCondition condition = new SamlAudienceRestrictionCondition(); condition.ReadXml(reader, this, keyInfoSerializer, outOfBandTokenResolver); return condition; } if (!reader.IsStartElement(this.DictionaryManager.SamlDictionary.DoNotCacheCondition, this.DictionaryManager.SamlDictionary.Namespace)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(System.IdentityModel.SR.GetString("SAMLUnableToLoadUnknownElement", new object[] { reader.LocalName }))); } SamlDoNotCacheCondition condition2 = new SamlDoNotCacheCondition(); condition2.ReadXml(reader, this, keyInfoSerializer, outOfBandTokenResolver); return condition2; }
internal static bool IsJsonLocalName(XmlDictionaryReader reader, string elementName) { if (reader.IsStartElement(JsonGlobals.itemDictionaryString, JsonGlobals.itemDictionaryString)) { if (reader.MoveToAttribute(JsonGlobals.itemString)) { return (reader.Value == elementName); } } return false; }
public static string DeserializeEunmerationContext(XmlDictionaryReader reader) { if (!reader.IsStartElement("EnumerationContext", "http://schemas.xmlsoap.org/ws/2004/09/enumeration")) { return null; } else { return reader.ReadElementString("EnumerationContext", "http://schemas.xmlsoap.org/ws/2004/09/enumeration"); } }
public static WsrmAckRequestedInfo ReadHeader(ReliableMessagingVersion reliableMessagingVersion, XmlDictionaryReader reader, MessageHeaderInfo header) { WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(reliableMessagingVersion); reader.ReadStartElement(); reader.ReadStartElement(dictionary.Identifier, namespaceUri); UniqueId sequenceID = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); if ((reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005) && reader.IsStartElement(dictionary.MessageNumber, namespaceUri)) { reader.ReadStartElement(); WsrmUtilities.ReadSequenceNumber(reader, true); reader.ReadEndElement(); } while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); return new WsrmAckRequestedInfo(sequenceID, header); }
/// <summary> /// 解析Message的头 /// </summary> /// <param name="reader"></param> /// <returns></returns> public static ExceptionSoapHeader FromReader(XmlDictionaryReader reader) { ExceptionSoapHeader header = new ExceptionSoapHeader(); while (!reader.EOF) { reader.Read(); if (reader.Name == "type" && reader.IsStartElement()) header.ExceptionType = (SoapExceptionType)Enum.Parse(typeof(SoapExceptionType), reader.ReadElementContentAsString()); else if (reader.Name == "message" && reader.IsStartElement()) header.Message = reader.ReadElementContentAsString(); else if (reader.Name == "stack" && reader.IsStartElement()) header.Stack = reader.ReadElementContentAsString(); else if (reader.Name == "appversion" && reader.IsStartElement()) header.AppVersion = reader.ReadElementContentAsString(); else continue; } return header; }
public InvalidAcknowledgementFault(FaultCode code, FaultReason reason, XmlDictionaryReader detailReader, ReliableMessagingVersion reliableMessagingVersion) : base(code, "InvalidAcknowledgement", reason, true, false) { UniqueId id; bool flag; WsrmAcknowledgmentInfo.ReadAck(reliableMessagingVersion, detailReader, out id, out this.ranges, out flag); base.SequenceID = id; while (detailReader.IsStartElement()) { detailReader.Skip(); } detailReader.ReadEndElement(); }
public static CloseSequenceInfo Create(XmlDictionaryReader reader) { CloseSequenceInfo info = new CloseSequenceInfo(); XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(ReliableMessagingVersion.WSReliableMessaging11); Wsrm11Dictionary dictionary = DXD.Wsrm11Dictionary; reader.ReadStartElement(dictionary.CloseSequence, namespaceUri); reader.ReadStartElement(XD.WsrmFeb2005Dictionary.Identifier, namespaceUri); info.Identifier = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); if (reader.IsStartElement(dictionary.LastMsgNumber, namespaceUri)) { reader.ReadStartElement(); info.LastMsgNumber = WsrmUtilities.ReadSequenceNumber(reader, false); reader.ReadEndElement(); } while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); return info; }
public static CreateSequenceResponseInfo Create(AddressingVersion addressingVersion, ReliableMessagingVersion reliableMessagingVersion, XmlDictionaryReader reader) { CreateSequenceResponseInfo info = new CreateSequenceResponseInfo(); WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(reliableMessagingVersion); reader.ReadStartElement(dictionary.CreateSequenceResponse, namespaceUri); reader.ReadStartElement(dictionary.Identifier, namespaceUri); info.Identifier = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); if (reader.IsStartElement(dictionary.Expires, namespaceUri)) { reader.ReadElementContentAsTimeSpan(); } if ((reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) && reader.IsStartElement(DXD.Wsrm11Dictionary.IncompleteSequenceBehavior, namespaceUri)) { string str2 = reader.ReadElementContentAsString(); if (((str2 != "DiscardEntireSequence") && (str2 != "DiscardFollowingFirstGap")) && (str2 != "NoDiscard")) { string message = System.ServiceModel.SR.GetString("CSResponseWithInvalidIncompleteSequenceBehavior"); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(message)); } } if (reader.IsStartElement(dictionary.Accept, namespaceUri)) { reader.ReadStartElement(); info.AcceptAcksTo = EndpointAddress.ReadFrom(addressingVersion, reader, dictionary.AcksTo, namespaceUri); while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); } while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); return info; }
public virtual void ReadXml(XmlDictionaryReader reader) { if (reader == null) { throw DiagnosticUtil.ExceptionUtil.ThrowHelperArgumentNull("reader"); } reader.MoveToContent(); if (reader.IsStartElement("KeyInfo", "http://www.w3.org/2000/09/xmldsig#")) { reader.ReadStartElement(); while (reader.IsStartElement()) { if (reader.IsStartElement("RetrievalMethod", "http://www.w3.org/2000/09/xmldsig#")) { string attribute = reader.GetAttribute("URI"); if (!string.IsNullOrEmpty(attribute)) { this._retrieval = attribute; } reader.Skip(); } else if (this._keyInfoSerializer.CanReadKeyIdentifierClause(reader)) { this._ski.Add(this._keyInfoSerializer.ReadKeyIdentifierClause(reader)); } else if (reader.IsStartElement()) { string str2 = reader.ReadOuterXml(); //if (DiagnosticUtil.TraceUtil.ShouldTrace(TraceEventType.Warning)) //{ // DiagnosticUtil.TraceUtil.TraceString(TraceEventType.Warning, SR.GetString("ID8023", new object[] { reader.Name, reader.NamespaceURI, str2 }), new object[0]); //} } reader.MoveToContent(); } reader.MoveToContent(); reader.ReadEndElement(); } }
internal X509CertificateEndpointIdentity(XmlDictionaryReader reader) { this.certificateCollection = new X509Certificate2Collection(); if (reader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader"); } reader.MoveToContent(); if (reader.IsEmptyElement) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(System.ServiceModel.SR.GetString("UnexpectedEmptyElementExpectingClaim", new object[] { XD.AddressingDictionary.X509v3Certificate.Value, XD.AddressingDictionary.IdentityExtensionNamespace.Value }))); } reader.ReadStartElement(XD.XmlSignatureDictionary.X509Data, XD.XmlSignatureDictionary.Namespace); while (reader.IsStartElement(XD.XmlSignatureDictionary.X509Certificate, XD.XmlSignatureDictionary.Namespace)) { X509Certificate2 certificate = new X509Certificate2(Convert.FromBase64String(reader.ReadElementString())); if (this.certificateCollection.Count == 0) { base.Initialize(new Claim(ClaimTypes.Thumbprint, certificate.GetCertHash(), Rights.PossessProperty)); } this.certificateCollection.Add(certificate); } reader.ReadEndElement(); if (this.certificateCollection.Count == 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(System.ServiceModel.SR.GetString("UnexpectedEmptyElementExpectingClaim", new object[] { XD.AddressingDictionary.X509v3Certificate.Value, XD.AddressingDictionary.IdentityExtensionNamespace.Value }))); } }