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; }
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); }
public virtual SamlCondition LoadCondition(XmlDictionaryReader reader, SecurityTokenSerializer keyInfoSerializer, SecurityTokenResolver outOfBandTokenResolver) { if (reader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader"); } if (reader.IsStartElement(DictionaryManager.SamlDictionary.AudienceRestrictionCondition, DictionaryManager.SamlDictionary.Namespace)) { SamlAudienceRestrictionCondition audienceRestriction = new SamlAudienceRestrictionCondition(); audienceRestriction.ReadXml(reader, this, keyInfoSerializer, outOfBandTokenResolver); return(audienceRestriction); } else if (reader.IsStartElement(DictionaryManager.SamlDictionary.DoNotCacheCondition, DictionaryManager.SamlDictionary.Namespace)) { SamlDoNotCacheCondition doNotCacheCondition = new SamlDoNotCacheCondition(); doNotCacheCondition.ReadXml(reader, this, keyInfoSerializer, outOfBandTokenResolver); return(doNotCacheCondition); } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.GetString(SR.SAMLUnableToLoadUnknownElement, reader.LocalName))); } }
/// <summary> /// Serialize SamlDoNotCacheCondition to a XmlWriter. /// </summary> /// <param name="writer">XmlWriter to serialize the SamlDoNotCacheCondition.</param> /// <param name="condition">SamlDoNotCacheCondition to serialize.</param> /// <exception cref="ArgumentNullException">The parameter 'writer' or 'condition' is null.</exception> protected virtual void WriteDoNotCacheCondition(XmlWriter writer, SamlDoNotCacheCondition condition) { if (writer == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writer"); } if (condition == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("condition"); } writer.WriteStartElement(SamlConstants.Prefix, SamlConstants.ElementNames.DoNotCacheCondition, SamlConstants.Namespace); writer.WriteEndElement(); }
/// <summary> /// Read saml:DoNotCacheCondition from the given XmlReader. /// </summary> /// <param name="reader">XmlReader positioned at a saml:DoNotCacheCondition element.</param> /// <returns>SamlDoNotCacheCondition</returns> /// <exception cref="ArgumentNullException">The inpur parameter 'reader' is null.</exception> /// <exception cref="XmlException">The XmlReader is not positioned at saml:DoNotCacheCondition.</exception> protected virtual SamlDoNotCacheCondition ReadDoNotCacheCondition(XmlReader reader) { if (reader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader"); } if (!reader.IsStartElement(SamlConstants.ElementNames.DoNotCacheCondition, SamlConstants.Namespace)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.GetString(SR.ID4082, SamlConstants.ElementNames.DoNotCacheCondition, SamlConstants.Namespace, reader.LocalName, reader.NamespaceURI))); } SamlDoNotCacheCondition doNotCacheCondition = new SamlDoNotCacheCondition(); // saml:DoNotCacheCondition is a empty element. So just issue a read for // the empty element. if (reader.IsEmptyElement) { reader.MoveToContent(); reader.Read(); return doNotCacheCondition; } reader.MoveToContent(); reader.ReadStartElement(); reader.ReadEndElement(); return doNotCacheCondition; }
public virtual SamlCondition LoadCondition(XmlDictionaryReader reader, SecurityTokenSerializer keyInfoSerializer, SecurityTokenResolver outOfBandTokenResolver) { if (reader == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader"); if (reader.IsStartElement(DictionaryManager.SamlDictionary.AudienceRestrictionCondition, DictionaryManager.SamlDictionary.Namespace)) { SamlAudienceRestrictionCondition audienceRestriction = new SamlAudienceRestrictionCondition(); audienceRestriction.ReadXml(reader, this, keyInfoSerializer, outOfBandTokenResolver); return audienceRestriction; } else if (reader.IsStartElement(DictionaryManager.SamlDictionary.DoNotCacheCondition, DictionaryManager.SamlDictionary.Namespace)) { SamlDoNotCacheCondition doNotCacheCondition = new SamlDoNotCacheCondition(); doNotCacheCondition.ReadXml(reader, this, keyInfoSerializer, outOfBandTokenResolver); return doNotCacheCondition; } else throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.GetString(SR.SAMLUnableToLoadUnknownElement, reader.LocalName))); }