Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Tokens / SamlAction.cs / 1305376 / SamlAction.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IdentityModel.Tokens { using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IdentityModel.Tokens; using System.IdentityModel.Selectors; using System.Xml; using System.Xml.Serialization; using System.Runtime.Serialization; public class SamlAction { string ns; string action; bool isReadOnly = false; public SamlAction(string action) : this(action, null) { } public SamlAction(string action, string ns) { if (String.IsNullOrEmpty(action)) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("action", SR.GetString(SR.SAMLActionNameRequired)); this.action = action; this.ns = ns; } public SamlAction() { } public string Action { get {return this.action; } set { if (isReadOnly) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ObjectIsReadOnly))); if (String.IsNullOrEmpty(value)) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("value", SR.GetString(SR.SAMLActionNameRequired)); this.action = value; } } public string Namespace { get { return this.ns; } set { if (isReadOnly) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ObjectIsReadOnly))); this.ns = value; } } public bool IsReadOnly { get { return this.isReadOnly; } } public void MakeReadOnly() { this.isReadOnly = true; } void CheckObjectValidity() { if (String.IsNullOrEmpty(action)) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityTokenException(SR.GetString(SR.SAMLActionNameRequired))); } public virtual 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.Action, dictionary.Namespace)) { // The Namespace attribute is optional. this.ns = reader.GetAttribute(dictionary.ActionNamespaceAttribute, null); reader.MoveToContent(); this.action = reader.ReadString(); if (string.IsNullOrEmpty(this.action)) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityTokenException(SR.GetString(SR.SAMLActionNameRequiredOnRead))); reader.MoveToContent(); reader.ReadEndElement(); } } public virtual void WriteXml(XmlDictionaryWriter writer, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer) { CheckObjectValidity(); 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.Action, dictionary.Namespace); if (this.ns != null) { writer.WriteStartAttribute(dictionary.ActionNamespaceAttribute, null); writer.WriteString(this.ns); writer.WriteEndAttribute(); } writer.WriteString(this.action); 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.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IdentityModel.Tokens; using System.IdentityModel.Selectors; using System.Xml; using System.Xml.Serialization; using System.Runtime.Serialization; public class SamlAction { string ns; string action; bool isReadOnly = false; public SamlAction(string action) : this(action, null) { } public SamlAction(string action, string ns) { if (String.IsNullOrEmpty(action)) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("action", SR.GetString(SR.SAMLActionNameRequired)); this.action = action; this.ns = ns; } public SamlAction() { } public string Action { get {return this.action; } set { if (isReadOnly) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ObjectIsReadOnly))); if (String.IsNullOrEmpty(value)) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("value", SR.GetString(SR.SAMLActionNameRequired)); this.action = value; } } public string Namespace { get { return this.ns; } set { if (isReadOnly) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ObjectIsReadOnly))); this.ns = value; } } public bool IsReadOnly { get { return this.isReadOnly; } } public void MakeReadOnly() { this.isReadOnly = true; } void CheckObjectValidity() { if (String.IsNullOrEmpty(action)) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityTokenException(SR.GetString(SR.SAMLActionNameRequired))); } public virtual 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.Action, dictionary.Namespace)) { // The Namespace attribute is optional. this.ns = reader.GetAttribute(dictionary.ActionNamespaceAttribute, null); reader.MoveToContent(); this.action = reader.ReadString(); if (string.IsNullOrEmpty(this.action)) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityTokenException(SR.GetString(SR.SAMLActionNameRequiredOnRead))); reader.MoveToContent(); reader.ReadEndElement(); } } public virtual void WriteXml(XmlDictionaryWriter writer, SamlSerializer samlSerializer, SecurityTokenSerializer keyInfoSerializer) { CheckObjectValidity(); 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.Action, dictionary.Namespace); if (this.ns != null) { writer.WriteStartAttribute(dictionary.ActionNamespaceAttribute, null); writer.WriteString(this.ns); writer.WriteEndAttribute(); } writer.WriteString(this.action); 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
- WebPartHeaderCloseVerb.cs
- CallTemplateAction.cs
- BinHexEncoder.cs
- CorrelationTokenInvalidatedHandler.cs
- Scene3D.cs
- WindowsFormsEditorServiceHelper.cs
- FormatConvertedBitmap.cs
- WindowsPrincipal.cs
- DataGridViewCellCollection.cs
- DeviceOverridableAttribute.cs
- SecurityElement.cs
- RandomNumberGenerator.cs
- GenerateHelper.cs
- XmlSerializerNamespaces.cs
- ECDsa.cs
- TextElementEnumerator.cs
- RotateTransform3D.cs
- SqlCommandBuilder.cs
- QilDataSource.cs
- Group.cs
- IItemContainerGenerator.cs
- ColumnReorderedEventArgs.cs
- PointF.cs
- AppDomain.cs
- XPathEmptyIterator.cs
- ServicePointManager.cs
- Operator.cs
- JsonReaderWriterFactory.cs
- WhitespaceRuleLookup.cs
- TextElementEnumerator.cs
- BatchParser.cs
- FlagsAttribute.cs
- RC2CryptoServiceProvider.cs
- CodeMemberProperty.cs
- CreateUserWizardStep.cs
- DefaultParameterValueAttribute.cs
- TrustSection.cs
- XPathAncestorQuery.cs
- PolyBezierSegment.cs
- MimeMultiPart.cs
- MetadataResolver.cs
- SerializationAttributes.cs
- NavigatorInput.cs
- RIPEMD160.cs
- AudioLevelUpdatedEventArgs.cs
- CallbackValidatorAttribute.cs
- ChannelReliableSession.cs
- VerificationAttribute.cs
- RawStylusInput.cs
- VerticalAlignConverter.cs
- RenderContext.cs
- codemethodreferenceexpression.cs
- PresentationTraceSources.cs
- ReadOnlyNameValueCollection.cs
- XPathSingletonIterator.cs
- WebBrowser.cs
- Model3DGroup.cs
- AsyncResult.cs
- DeferredRunTextReference.cs
- DateTimeConstantAttribute.cs
- WebBrowserSiteBase.cs
- BitmapFrameEncode.cs
- DbMetaDataCollectionNames.cs
- Options.cs
- DnsPermission.cs
- NativeMethodsOther.cs
- PageThemeCodeDomTreeGenerator.cs
- DataSourceCacheDurationConverter.cs
- ExpressionBuilder.cs
- PatternMatcher.cs
- Delay.cs
- RegistryKey.cs
- QuinticEase.cs
- ColorConverter.cs
- SQLInt16.cs
- ProxyWebPart.cs
- DefaultHttpHandler.cs
- InfoCardCryptoHelper.cs
- SQLInt64.cs
- GradientBrush.cs
- DataSourceNameHandler.cs
- VirtualDirectoryMappingCollection.cs
- AncestorChangedEventArgs.cs
- WebControlAdapter.cs
- PaperSize.cs
- Rule.cs
- ToolboxControl.cs
- OdbcConnectionString.cs
- PerformanceCounterCategory.cs
- MonthChangedEventArgs.cs
- Clipboard.cs
- QilNode.cs
- TextParagraph.cs
- HttpGetProtocolReflector.cs
- baseshape.cs
- AmbientLight.cs
- DocumentSequence.cs
- Cell.cs
- ModifierKeysValueSerializer.cs
- CaretElement.cs