Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Selectors / SecurityTokenSerializer.cs / 1 / SecurityTokenSerializer.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IdentityModel.Selectors { using System.Xml; using System.IdentityModel.Tokens; ////// SecurityTokenSerializer is responsible for writing and reading SecurityKeyIdentifiers, SecurityKeyIdentifierClauses and SecurityTokens. /// In order to read SecurityTokens the SecurityTokenSerializer may need to resolve token references using the SecurityTokenResolvers that get passed in. /// The SecurityTokenSerializer is stateless /// Exceptions: XmlException, SecurityTokenException, NotSupportedException, InvalidOperationException, ArgumentException /// public abstract class SecurityTokenSerializer { // public methods public bool CanReadToken(XmlReader reader) { if (reader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader"); } return CanReadTokenCore(reader); ; } public bool CanWriteToken(SecurityToken token) { if (token == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("token"); } return CanWriteTokenCore(token); ; } public bool CanReadKeyIdentifier(XmlReader reader) { if (reader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader"); } return CanReadKeyIdentifierCore(reader); ; } public bool CanWriteKeyIdentifier(SecurityKeyIdentifier keyIdentifier) { if (keyIdentifier == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("keyIdentifier"); } return CanWriteKeyIdentifierCore(keyIdentifier); ; } public bool CanReadKeyIdentifierClause(XmlReader reader) { if (reader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader"); } return CanReadKeyIdentifierClauseCore(reader); ; } public bool CanWriteKeyIdentifierClause(SecurityKeyIdentifierClause keyIdentifierClause) { if (keyIdentifierClause == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("keyIdentifierClause"); } return CanWriteKeyIdentifierClauseCore(keyIdentifierClause); ; } public SecurityToken ReadToken(XmlReader reader, SecurityTokenResolver tokenResolver) { if (reader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader"); } return ReadTokenCore(reader, tokenResolver); } public void WriteToken(XmlWriter writer, SecurityToken token) { if (writer == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writer"); } if (token == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("token"); } WriteTokenCore(writer, token); } public SecurityKeyIdentifier ReadKeyIdentifier(XmlReader reader) { if (reader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader"); } return ReadKeyIdentifierCore(reader); } public void WriteKeyIdentifier(XmlWriter writer, SecurityKeyIdentifier keyIdentifier) { if (writer == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writer"); } if (keyIdentifier == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("keyIdentifier"); } WriteKeyIdentifierCore(writer, keyIdentifier); } public SecurityKeyIdentifierClause ReadKeyIdentifierClause(XmlReader reader) { if (reader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reader"); } return ReadKeyIdentifierClauseCore(reader); } public void WriteKeyIdentifierClause(XmlWriter writer, SecurityKeyIdentifierClause keyIdentifierClause) { if (writer == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writer"); } if (keyIdentifierClause == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("keyIdentifierClause"); } WriteKeyIdentifierClauseCore(writer, keyIdentifierClause); } // protected abstract methods protected abstract bool CanReadTokenCore(XmlReader reader); protected abstract bool CanWriteTokenCore(SecurityToken token); protected abstract bool CanReadKeyIdentifierCore(XmlReader reader); protected abstract bool CanWriteKeyIdentifierCore(SecurityKeyIdentifier keyIdentifier); protected abstract bool CanReadKeyIdentifierClauseCore(XmlReader reader); protected abstract bool CanWriteKeyIdentifierClauseCore(SecurityKeyIdentifierClause keyIdentifierClause); protected abstract SecurityToken ReadTokenCore(XmlReader reader, SecurityTokenResolver tokenResolver); protected abstract void WriteTokenCore(XmlWriter writer, SecurityToken token); protected abstract SecurityKeyIdentifier ReadKeyIdentifierCore(XmlReader reader); protected abstract void WriteKeyIdentifierCore(XmlWriter writer, SecurityKeyIdentifier keyIdentifier); protected abstract SecurityKeyIdentifierClause ReadKeyIdentifierClauseCore(XmlReader reader); protected abstract void WriteKeyIdentifierClauseCore(XmlWriter writer, SecurityKeyIdentifierClause keyIdentifierClause); } } // 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
- SequentialUshortCollection.cs
- RelationshipEndMember.cs
- ErrorWrapper.cs
- DataQuery.cs
- HtmlHead.cs
- NotImplementedException.cs
- SoapAttributes.cs
- Oci.cs
- ThreadStartException.cs
- ComponentResourceKey.cs
- UnmanagedMarshal.cs
- Psha1DerivedKeyGenerator.cs
- InputManager.cs
- CharEnumerator.cs
- ToolStripItemTextRenderEventArgs.cs
- Int16Storage.cs
- TrustManager.cs
- ToolStripRendererSwitcher.cs
- DbConnectionPoolGroup.cs
- ControlCollection.cs
- EditorBrowsableAttribute.cs
- PassportIdentity.cs
- Logging.cs
- RelatedPropertyManager.cs
- DataGridViewCellStyleChangedEventArgs.cs
- RuntimeResourceSet.cs
- TcpAppDomainProtocolHandler.cs
- PermissionSet.cs
- DetailsViewDeletedEventArgs.cs
- TableNameAttribute.cs
- UserPreferenceChangedEventArgs.cs
- SHA256.cs
- InkCanvasSelection.cs
- InkCanvasAutomationPeer.cs
- MimeReturn.cs
- NetDataContractSerializer.cs
- MultiDataTrigger.cs
- HttpFileCollectionBase.cs
- XamlRtfConverter.cs
- XmlParserContext.cs
- TextTabProperties.cs
- SoapSchemaMember.cs
- AsymmetricKeyExchangeDeformatter.cs
- CheckBoxField.cs
- WsatConfiguration.cs
- SessionEndingEventArgs.cs
- VisualBrush.cs
- CqlBlock.cs
- SequenceDesigner.cs
- SecurityException.cs
- UriParserTemplates.cs
- BatchParser.cs
- XomlCompilerParameters.cs
- WindowsIdentity.cs
- XmlBinaryReaderSession.cs
- ProtocolViolationException.cs
- XmlNodeChangedEventManager.cs
- AspNetSynchronizationContext.cs
- UnsafeNativeMethods.cs
- RelatedPropertyManager.cs
- RawTextInputReport.cs
- Point.cs
- WebPartChrome.cs
- InternalConfigRoot.cs
- ParameterEditorUserControl.cs
- RepeaterCommandEventArgs.cs
- KnownTypes.cs
- TransformerConfigurationWizardBase.cs
- SchemaReference.cs
- LookupNode.cs
- VarInfo.cs
- Vector3DConverter.cs
- RotateTransform.cs
- FigureParagraph.cs
- ConfigurationManagerHelperFactory.cs
- ScanQueryOperator.cs
- QualificationDataAttribute.cs
- ValueType.cs
- StrokeCollectionConverter.cs
- XsdDataContractImporter.cs
- HttpRequest.cs
- RepeaterItemCollection.cs
- Triplet.cs
- InputReport.cs
- MsmqTransportSecurity.cs
- IsolatedStorageFile.cs
- WindowsPen.cs
- DirectionalLight.cs
- SpeechUI.cs
- ServiceNotStartedException.cs
- DeploymentSection.cs
- AssemblyUtil.cs
- Token.cs
- SystemUdpStatistics.cs
- CodeValidator.cs
- XmlLangPropertyAttribute.cs
- Splitter.cs
- FixedSOMTableCell.cs
- StandardToolWindows.cs
- DesignerHelpers.cs