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
- AssertFilter.cs
- PropertyEmitter.cs
- EditorZone.cs
- DetailsView.cs
- AsymmetricCryptoHandle.cs
- SerializationFieldInfo.cs
- UpdateException.cs
- Pkcs9Attribute.cs
- NameValuePermission.cs
- Tracking.cs
- WebScriptMetadataMessageEncodingBindingElement.cs
- ContextProperty.cs
- CodeAttributeArgumentCollection.cs
- DataGridViewAccessibleObject.cs
- FileDetails.cs
- DataSourceControlBuilder.cs
- XmlSchemaComplexContentRestriction.cs
- WebPartMinimizeVerb.cs
- Button.cs
- ReferencedCollectionType.cs
- LinqDataSourceContextEventArgs.cs
- ScriptingJsonSerializationSection.cs
- ADMembershipProvider.cs
- DisposableCollectionWrapper.cs
- COM2IProvidePropertyBuilderHandler.cs
- PropertyDescriptorGridEntry.cs
- FixedTextContainer.cs
- IOException.cs
- XappLauncher.cs
- RightsManagementResourceHelper.cs
- LoadedOrUnloadedOperation.cs
- DataContractJsonSerializer.cs
- CodeAttributeDeclarationCollection.cs
- PowerModeChangedEventArgs.cs
- PlatformNotSupportedException.cs
- CodeDefaultValueExpression.cs
- DependencyPropertyKey.cs
- ScriptReferenceBase.cs
- SystemIPAddressInformation.cs
- CancellationTokenSource.cs
- SiteIdentityPermission.cs
- ScrollViewer.cs
- HelpKeywordAttribute.cs
- ControlParameter.cs
- Timer.cs
- ImportCatalogPart.cs
- MobileControlsSectionHelper.cs
- SmtpNetworkElement.cs
- AppDomainShutdownMonitor.cs
- CommandBinding.cs
- SqlTriggerAttribute.cs
- IDQuery.cs
- ContextQuery.cs
- SymDocumentType.cs
- XmlParserContext.cs
- FileSystemWatcher.cs
- TypedReference.cs
- TextElementCollectionHelper.cs
- FontWeightConverter.cs
- ImageIndexEditor.cs
- CompositeScriptReferenceEventArgs.cs
- SQLChars.cs
- OverloadGroupAttribute.cs
- dbdatarecord.cs
- EntityDataSourceSelectedEventArgs.cs
- OleDbDataReader.cs
- UnionCqlBlock.cs
- DbDeleteCommandTree.cs
- Constants.cs
- CheckoutException.cs
- BufferedStream.cs
- SynchronizedDispatch.cs
- TreeNodeBindingCollection.cs
- DrawingContextDrawingContextWalker.cs
- ComboBox.cs
- InstanceDescriptor.cs
- HttpModuleAction.cs
- SystemIPGlobalProperties.cs
- VoiceInfo.cs
- BaseEntityWrapper.cs
- WebAdminConfigurationHelper.cs
- StringPropertyBuilder.cs
- DocumentSequenceHighlightLayer.cs
- CryptoProvider.cs
- UxThemeWrapper.cs
- HttpCookieCollection.cs
- BitmapSourceSafeMILHandle.cs
- Timer.cs
- ApplicationSecurityInfo.cs
- UserNamePasswordValidator.cs
- ReferentialConstraint.cs
- SQLBytes.cs
- DataBindingHandlerAttribute.cs
- exports.cs
- CharEntityEncoderFallback.cs
- NonBatchDirectoryCompiler.cs
- InputBinder.cs
- TableColumn.cs
- oledbmetadatacollectionnames.cs
- TouchPoint.cs