Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / MsmqChannelFactoryBase.cs / 1 / MsmqChannelFactoryBase.cs
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------
namespace System.ServiceModel.Channels
{
using System.IdentityModel.Selectors;
using System.ServiceModel;
using System.IdentityModel.Tokens;
using System.Net.Security;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.ServiceModel.Security;
using System.ServiceModel.Security.Tokens;
using System.Threading;
abstract class MsmqChannelFactoryBase : TransportChannelFactory
{
MsmqUri.IAddressTranslator addressTranslator;
Uri customDeadLetterQueue;
bool durable;
DeadLetterQueue deadLetterQueue;
string deadLetterQueuePathName;
bool exactlyOnce = true;
TimeSpan timeToLive;
MsmqTransportSecurity msmqTransportSecurity;
bool useMsmqTracing;
bool useSourceJournal;
SecurityTokenManager securityTokenManager;
protected MsmqChannelFactoryBase(MsmqBindingElementBase bindingElement, BindingContext context) :
this(bindingElement, context, TransportDefaults.GetDefaultMessageEncoderFactory())
{}
protected MsmqChannelFactoryBase(MsmqBindingElementBase bindingElement, BindingContext context, MessageEncoderFactory encoderFactory)
: base(bindingElement, context)
{
this.addressTranslator = bindingElement.AddressTranslator;
this.customDeadLetterQueue = bindingElement.CustomDeadLetterQueue;
this.durable = bindingElement.Durable;
this.deadLetterQueue = bindingElement.DeadLetterQueue;
this.exactlyOnce = bindingElement.ExactlyOnce;
this.msmqTransportSecurity = new MsmqTransportSecurity(bindingElement.MsmqTransportSecurity);
this.timeToLive = bindingElement.TimeToLive;
this.useMsmqTracing = bindingElement.UseMsmqTracing;
this.useSourceJournal = bindingElement.UseSourceJournal;
if (this.MsmqTransportSecurity.MsmqAuthenticationMode == MsmqAuthenticationMode.Certificate)
{
InitializeSecurityTokenManager(context);
}
if (null != this.customDeadLetterQueue)
this.deadLetterQueuePathName = MsmqUri.DeadLetterQueueAddressTranslator.UriToFormatName(this.customDeadLetterQueue);
}
internal MsmqUri.IAddressTranslator AddressTranslator
{
get
{
return this.addressTranslator;
}
}
public Uri CustomDeadLetterQueue
{
get
{
return this.customDeadLetterQueue;
}
}
public DeadLetterQueue DeadLetterQueue
{
get
{
return this.deadLetterQueue;
}
}
internal string DeadLetterQueuePathName
{
get
{
return this.deadLetterQueuePathName;
}
}
public bool Durable
{
get
{
return this.durable;
}
}
public bool ExactlyOnce
{
get
{
return this.exactlyOnce;
}
}
public MsmqTransportSecurity MsmqTransportSecurity
{
get
{
return this.msmqTransportSecurity;
}
}
public override string Scheme
{
get { return this.addressTranslator.Scheme; }
}
public TimeSpan TimeToLive
{
get
{
return this.timeToLive;
}
}
public SecurityTokenManager SecurityTokenManager
{
get { return this.securityTokenManager; }
}
public bool UseSourceJournal
{
get
{
return this.useSourceJournal;
}
}
public bool UseMsmqTracing
{
get
{
return this.useMsmqTracing;
}
}
internal bool IsMsmqX509SecurityConfigured
{
get
{
return (MsmqAuthenticationMode.Certificate == this.MsmqTransportSecurity.MsmqAuthenticationMode);
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
void InitializeSecurityTokenManager(BindingContext context)
{
SecurityCredentialsManager credentials = context.BindingParameters.Find();
if (credentials != null)
this.securityTokenManager = credentials.CreateSecurityTokenManager();
}
internal SecurityTokenProvider CreateTokenProvider(EndpointAddress to, Uri via)
{
InitiatorServiceModelSecurityTokenRequirement x509Requirement = new InitiatorServiceModelSecurityTokenRequirement();
x509Requirement.TokenType = SecurityTokenTypes.X509Certificate;
x509Requirement.TargetAddress = to;
x509Requirement.Via = via;
x509Requirement.KeyUsage = SecurityKeyUsage.Signature;
x509Requirement.TransportScheme = this.Scheme;
return this.SecurityTokenManager.CreateSecurityTokenProvider(x509Requirement);
}
[MethodImpl(MethodImplOptions.NoInlining)]
internal SecurityTokenProviderContainer CreateX509TokenProvider(EndpointAddress to, Uri via)
{
if (MsmqAuthenticationMode.Certificate == this.MsmqTransportSecurity.MsmqAuthenticationMode && this.SecurityTokenManager != null)
{
return new SecurityTokenProviderContainer(CreateTokenProvider(to, via));
}
else
{
return null;
}
}
protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
{
return new CompletedAsyncResult(callback, state);
}
protected override void OnEndOpen(IAsyncResult result)
{
CompletedAsyncResult.End(result);
}
protected override void OnOpen(TimeSpan timeout)
{
}
}
}
// 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
- Axis.cs
- unitconverter.cs
- PropertyGeneratedEventArgs.cs
- ConnectionsZoneAutoFormat.cs
- OleDbParameterCollection.cs
- StyleBamlTreeBuilder.cs
- ServiceHostingEnvironment.cs
- AppDomain.cs
- ExpressionBindingsDialog.cs
- NativeMethods.cs
- FirstMatchCodeGroup.cs
- XmlReaderSettings.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- AdRotator.cs
- BuildResultCache.cs
- InstalledFontCollection.cs
- XmlAttribute.cs
- XmlElementAttribute.cs
- CatalogPart.cs
- BufferModeSettings.cs
- WebServiceData.cs
- SecurityStandardsManager.cs
- FileAuthorizationModule.cs
- AppSettingsReader.cs
- AxDesigner.cs
- Utils.cs
- ControlValuePropertyAttribute.cs
- IChannel.cs
- NoClickablePointException.cs
- EventToken.cs
- ManagedFilter.cs
- BitSet.cs
- EventListenerClientSide.cs
- AuthenticationSection.cs
- MeasureItemEvent.cs
- SocketAddress.cs
- ConnectionConsumerAttribute.cs
- KeyValueSerializer.cs
- TimelineGroup.cs
- HiddenFieldPageStatePersister.cs
- InputScopeAttribute.cs
- System.Data.OracleClient_BID.cs
- DocumentApplicationJournalEntryEventArgs.cs
- AuthenticationService.cs
- MessageQueuePermission.cs
- BatchParser.cs
- CollectionBase.cs
- DeploymentSection.cs
- DetailsViewRow.cs
- Char.cs
- DynamicArgumentDesigner.xaml.cs
- DiagnosticTrace.cs
- SoapIncludeAttribute.cs
- TableAdapterManagerGenerator.cs
- linebase.cs
- XmlWriterTraceListener.cs
- CachedTypeface.cs
- SecurityException.cs
- FunctionUpdateCommand.cs
- MatrixAnimationBase.cs
- CollectionViewGroupRoot.cs
- XmlnsCompatibleWithAttribute.cs
- RegexGroupCollection.cs
- QueryTreeBuilder.cs
- XmlFormatExtensionAttribute.cs
- HtmlTableCell.cs
- CompilerTypeWithParams.cs
- SecurityChannelFactory.cs
- AQNBuilder.cs
- PackageDigitalSignatureManager.cs
- CodeStatementCollection.cs
- XmlSchemaInclude.cs
- UnsafeNativeMethods.cs
- WeakReadOnlyCollection.cs
- InputReport.cs
- QueueProcessor.cs
- M3DUtil.cs
- CompilerGeneratedAttribute.cs
- DesignerObjectListAdapter.cs
- SiteMapHierarchicalDataSourceView.cs
- PeerNameRecordCollection.cs
- PropertyPushdownHelper.cs
- ActivityExecutorDelegateInfo.cs
- Win32Exception.cs
- KnownBoxes.cs
- SqlTriggerContext.cs
- DrawTreeNodeEventArgs.cs
- HttpHostedTransportConfiguration.cs
- XPathException.cs
- MembershipSection.cs
- TextRange.cs
- TraceXPathNavigator.cs
- ColorTransformHelper.cs
- CatalogZoneBase.cs
- RelationshipFixer.cs
- IssuedTokenClientCredential.cs
- Style.cs
- TextEmbeddedObject.cs
- CmsUtils.cs
- SocketInformation.cs