Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / TransactionBridge / Microsoft / Transactions / Wsat / Messaging / SupportingTokenListenerFactory.cs / 1 / SupportingTokenListenerFactory.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- // Defines the SupportingTokenListenerFactory, which contributes a SupportingTokenListener using System; using System.Diagnostics; using System.ServiceModel; using System.ServiceModel.Channels; using System.ServiceModel.Security; using Microsoft.Transactions.Wsat.Protocol; namespace Microsoft.Transactions.Wsat.Messaging { class SupportingTokenChannelListener: LayeredChannelListener where TChannel : class, IChannel { IChannelListener innerChannelListener; SupportingTokenSecurityTokenResolver tokenResolver; ProtocolVersion protocolVersion; public SupportingTokenChannelListener(SupportingTokenBindingElement bindingElement, BindingContext context, SupportingTokenSecurityTokenResolver tokenResolver) : base(context.Binding, context.BuildInnerChannelListener ()) { this.protocolVersion= bindingElement.ProtocolVersion; this.tokenResolver = tokenResolver; } public ProtocolVersion ProtocolVersion { get { return this.protocolVersion; } } protected override void OnOpening() { base.OnOpening(); this.innerChannelListener = (IChannelListener )(object)this.InnerChannelListener; } protected override TChannel OnAcceptChannel(TimeSpan timeout) { TChannel innerChannel = this.innerChannelListener.AcceptChannel(timeout); if (innerChannel == null) return null; return WrapChannel(innerChannel); } protected override IAsyncResult OnBeginAcceptChannel(TimeSpan timeout, AsyncCallback callback, object state) { return this.innerChannelListener.BeginAcceptChannel(timeout, callback, state); } protected override TChannel OnEndAcceptChannel(IAsyncResult result) { TChannel innerChannel = this.innerChannelListener.EndAcceptChannel(result); if (innerChannel == null) return null; return WrapChannel(innerChannel); } protected override bool OnWaitForChannel(TimeSpan timeout) { return this.innerChannelListener.WaitForChannel(timeout); } protected override IAsyncResult OnBeginWaitForChannel(TimeSpan timeout, AsyncCallback callback, object state) { return this.innerChannelListener.BeginWaitForChannel(timeout, callback, state); } protected override bool OnEndWaitForChannel(IAsyncResult result) { return this.innerChannelListener.EndWaitForChannel(result); } TChannel WrapChannel(TChannel innerChannel) { if (DebugTrace.Verbose) { DebugTrace.Trace(TraceLevel.Verbose, "Creating new SupportingTokenChannel<{0}>", typeof(TChannel).Name); } if (typeof(TChannel) == typeof(IDuplexChannel)) { return (TChannel)(object)new SupportingTokenDuplexChannel(this, (IDuplexChannel)innerChannel, this.tokenResolver, this.protocolVersion); } else { // The listener supports a fixed set of channel types. The function // itself is internal. If the listener is asked to support a channel // type that the application does not recognize, that is automatically // a bug that needs to be reported back to Microsoft. DiagnosticUtility.FailFast("SupportingTokenListener does not support " + typeof(TChannel).Name); return null; // Keep the compiler happy } } } } // 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
- CodePageUtils.cs
- EventRouteFactory.cs
- StandardCommandToolStripMenuItem.cs
- WebPartCancelEventArgs.cs
- NativeRightsManagementAPIsStructures.cs
- SiteMapProvider.cs
- DecoratedNameAttribute.cs
- BitmapDecoder.cs
- SharedPersonalizationStateInfo.cs
- NameObjectCollectionBase.cs
- PostBackTrigger.cs
- DomainUpDown.cs
- InternalsVisibleToAttribute.cs
- UnitySerializationHolder.cs
- XmlIlTypeHelper.cs
- SqlPersonalizationProvider.cs
- XmlnsCache.cs
- SqlDataSourceCache.cs
- BinaryConverter.cs
- FixedPosition.cs
- InternalPermissions.cs
- XmlUrlEditor.cs
- ActiveXSite.cs
- ProtocolsConfigurationEntry.cs
- MemoryFailPoint.cs
- UrlPath.cs
- Int32CAMarshaler.cs
- GridViewAutomationPeer.cs
- CatalogPartCollection.cs
- VScrollBar.cs
- RijndaelManaged.cs
- CultureMapper.cs
- SqlDuplicator.cs
- WmlSelectionListAdapter.cs
- SmiGettersStream.cs
- SqlMethodAttribute.cs
- WebPartMovingEventArgs.cs
- BamlWriter.cs
- ProjectionCamera.cs
- GenerateScriptTypeAttribute.cs
- CodeValidator.cs
- DataServiceContext.cs
- SQLSingle.cs
- ValuePattern.cs
- HyperLink.cs
- _AutoWebProxyScriptEngine.cs
- SafePEFileHandle.cs
- AdjustableArrowCap.cs
- CheckBox.cs
- TempFiles.cs
- HttpPostClientProtocol.cs
- RegisteredDisposeScript.cs
- DesignerObject.cs
- XmlAttributeCollection.cs
- CodeBinaryOperatorExpression.cs
- SqlConnection.cs
- DispatcherHooks.cs
- VisualStyleElement.cs
- ListBindingConverter.cs
- ObjectContextServiceProvider.cs
- TextBox.cs
- SystemIcons.cs
- GeneralTransform2DTo3D.cs
- ServiceModelPerformanceCounters.cs
- MetabaseServerConfig.cs
- ContentPlaceHolder.cs
- WebPartActionVerb.cs
- OleDbErrorCollection.cs
- TextCompositionManager.cs
- safemediahandle.cs
- FileDialog.cs
- UrlMappingsModule.cs
- ListView.cs
- TextCompositionManager.cs
- DependentTransaction.cs
- EntityViewGenerationConstants.cs
- SystemDropShadowChrome.cs
- RepeatBehavior.cs
- Brush.cs
- ToolStripArrowRenderEventArgs.cs
- LogFlushAsyncResult.cs
- DbConnectionHelper.cs
- WindowExtensionMethods.cs
- TransactionContextValidator.cs
- SelectionHighlightInfo.cs
- ParentQuery.cs
- SectionVisual.cs
- ContextMenuStripActionList.cs
- UpdatableGenericsFeature.cs
- BadImageFormatException.cs
- _ProxyChain.cs
- GuidTagList.cs
- SingleTagSectionHandler.cs
- DateTimeEditor.cs
- ExpressionConverter.cs
- SplineKeyFrames.cs
- BindingExpressionBase.cs
- TypeBuilderInstantiation.cs
- EntityCommand.cs
- JpegBitmapEncoder.cs