Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Tokens / SamlDoNotCacheCondition.cs / 1305376 / SamlDoNotCacheCondition.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IdentityModel.Tokens { using System.Xml; using System.IdentityModel.Selectors; public class SamlDoNotCacheCondition : SamlCondition { bool isReadOnly = false; public SamlDoNotCacheCondition() { } public override bool IsReadOnly { get { return this.isReadOnly; } } public override void MakeReadOnly() { this.isReadOnly = true; } 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(); } public override void WriteXml(XmlDictionaryWriter writer, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer) { if (writer == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("writer")); if (samlSerializer == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("samlSerializer")); #pragma warning suppress 56506 // samlSerializer.DictionaryManager is never null. SamlDictionary dictionary = samlSerializer.DictionaryManager.SamlDictionary; writer.WriteStartElement(dictionary.PreferredPrefix.Value, dictionary.DoNotCacheCondition, dictionary.Namespace); writer.WriteEndElement(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IdentityModel.Tokens { using System.Xml; using System.IdentityModel.Selectors; public class SamlDoNotCacheCondition : SamlCondition { bool isReadOnly = false; public SamlDoNotCacheCondition() { } public override bool IsReadOnly { get { return this.isReadOnly; } } public override void MakeReadOnly() { this.isReadOnly = true; } 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(); } public override void WriteXml(XmlDictionaryWriter writer, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer) { if (writer == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("writer")); if (samlSerializer == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("samlSerializer")); #pragma warning suppress 56506 // samlSerializer.DictionaryManager is never null. SamlDictionary dictionary = samlSerializer.DictionaryManager.SamlDictionary; writer.WriteStartElement(dictionary.PreferredPrefix.Value, dictionary.DoNotCacheCondition, dictionary.Namespace); writer.WriteEndElement(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- GiveFeedbackEvent.cs
- AttachInfo.cs
- SafeTimerHandle.cs
- PropertyValueUIItem.cs
- RunClient.cs
- UnhandledExceptionEventArgs.cs
- SimpleNameService.cs
- XmlHierarchyData.cs
- Geometry.cs
- ListManagerBindingsCollection.cs
- XmlTextAttribute.cs
- NCryptSafeHandles.cs
- DbTransaction.cs
- XpsSerializerWriter.cs
- ObservableCollectionDefaultValueFactory.cs
- LayoutEvent.cs
- HttpListenerContext.cs
- ConfigurationValue.cs
- DataBinding.cs
- StylusEventArgs.cs
- DataSourceDesigner.cs
- Merger.cs
- DataConnectionHelper.cs
- WebScriptMetadataMessage.cs
- SeekableMessageNavigator.cs
- Logging.cs
- FileLogRecordHeader.cs
- LazyTextWriterCreator.cs
- ResourceReferenceKeyNotFoundException.cs
- TreeViewBindingsEditor.cs
- TextRunTypographyProperties.cs
- SecurityException.cs
- ToolStripSystemRenderer.cs
- SoapEnumAttribute.cs
- TriggerCollection.cs
- ElementHostAutomationPeer.cs
- Utilities.cs
- SkinBuilder.cs
- DbDataRecord.cs
- TextViewBase.cs
- CallSite.cs
- ViewBase.cs
- Content.cs
- ConfigsHelper.cs
- HtmlInputPassword.cs
- TextDecoration.cs
- ToolboxComponentsCreatingEventArgs.cs
- DependencyObjectProvider.cs
- DetailsViewInsertedEventArgs.cs
- MessageContractExporter.cs
- RIPEMD160.cs
- ByteAnimationBase.cs
- MsmqNonTransactedPoisonHandler.cs
- ClientRolePrincipal.cs
- GrabHandleGlyph.cs
- RoutedUICommand.cs
- SafeNativeMethods.cs
- PreviewPrintController.cs
- TextEditorContextMenu.cs
- TableTextElementCollectionInternal.cs
- SharedRuntimeState.cs
- GrammarBuilder.cs
- Site.cs
- GenericTypeParameterBuilder.cs
- NumberFunctions.cs
- Camera.cs
- WebPartCloseVerb.cs
- AsyncStreamReader.cs
- DesignTimeTemplateParser.cs
- SuppressMergeCheckAttribute.cs
- _NegoStream.cs
- TreeViewImageKeyConverter.cs
- SessionStateModule.cs
- Scene3D.cs
- Rect3D.cs
- SQLInt16.cs
- SingleSelectRootGridEntry.cs
- WebZoneDesigner.cs
- SerializationInfoEnumerator.cs
- PngBitmapEncoder.cs
- XmlElement.cs
- VersionPair.cs
- SqlBuilder.cs
- HitTestParameters.cs
- Rfc2898DeriveBytes.cs
- XPathBinder.cs
- HashHelper.cs
- RegexReplacement.cs
- Decimal.cs
- DataServiceQueryProvider.cs
- Vector.cs
- Message.cs
- SignatureDescription.cs
- DataStorage.cs
- EmptyStringExpandableObjectConverter.cs
- StringReader.cs
- RequestResizeEvent.cs
- PermissionAttributes.cs
- HexParser.cs
- ActivationServices.cs