Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Tokens / SamlAction.cs / 1 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlBinaryReader.cs
- DefaultMemberAttribute.cs
- DataContext.cs
- FixedSOMElement.cs
- SQLMembershipProvider.cs
- JournalEntryListConverter.cs
- XhtmlConformanceSection.cs
- DataRowChangeEvent.cs
- TCEAdapterGenerator.cs
- activationcontext.cs
- MeasureData.cs
- DocumentViewerBase.cs
- MenuAdapter.cs
- TypeSystemHelpers.cs
- SafeFileMappingHandle.cs
- Message.cs
- HttpChannelHelper.cs
- Scripts.cs
- HttpRuntimeSection.cs
- XhtmlBasicLiteralTextAdapter.cs
- CodeMethodInvokeExpression.cs
- GridViewUpdateEventArgs.cs
- ColorContext.cs
- DataSourceViewSchemaConverter.cs
- Wildcard.cs
- InstalledFontCollection.cs
- ColorConvertedBitmap.cs
- AttributeData.cs
- CodeThrowExceptionStatement.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- HtmlEmptyTagControlBuilder.cs
- ISAPIApplicationHost.cs
- Composition.cs
- Exceptions.cs
- Latin1Encoding.cs
- RTLAwareMessageBox.cs
- Pkcs7Recipient.cs
- LocationInfo.cs
- TypeConverterHelper.cs
- ResourceAttributes.cs
- TableStyle.cs
- SimpleFieldTemplateUserControl.cs
- DataViewListener.cs
- AstTree.cs
- ListDataHelper.cs
- VectorConverter.cs
- Propagator.JoinPropagator.cs
- DbFunctionCommandTree.cs
- FileLogRecordStream.cs
- DefaultBindingPropertyAttribute.cs
- StrokeNodeEnumerator.cs
- PartDesigner.cs
- MatrixIndependentAnimationStorage.cs
- PageEventArgs.cs
- TableRow.cs
- PrintEvent.cs
- MemberAccessException.cs
- TableRowCollection.cs
- TypeName.cs
- SQLInt64Storage.cs
- WhitespaceRuleLookup.cs
- GuidConverter.cs
- PropertyChangedEventArgs.cs
- XsltContext.cs
- StringSorter.cs
- ClientSettings.cs
- AuthenticationException.cs
- FrameworkReadOnlyPropertyMetadata.cs
- CommandBindingCollection.cs
- ReaderContextStackData.cs
- QilReplaceVisitor.cs
- RsaSecurityToken.cs
- Blend.cs
- TextRunCacheImp.cs
- MouseOverProperty.cs
- EditorZone.cs
- PlaceHolder.cs
- ClientTarget.cs
- DataGridViewHitTestInfo.cs
- DataServiceExpressionVisitor.cs
- HtmlUtf8RawTextWriter.cs
- BindingGroup.cs
- SelectorAutomationPeer.cs
- BaseCAMarshaler.cs
- XmlQueryTypeFactory.cs
- CreateUserWizardDesigner.cs
- DataReceivedEventArgs.cs
- FileDetails.cs
- FileDialogCustomPlacesCollection.cs
- SpellerStatusTable.cs
- DeferredSelectedIndexReference.cs
- BamlWriter.cs
- AttributedMetaModel.cs
- Int16Storage.cs
- ConfigurationLocation.cs
- SiteMembershipCondition.cs
- HtmlTableCell.cs
- DataGridViewTextBoxCell.cs
- SamlAction.cs
- ToolStripDropDownMenu.cs