Ejemplo n.º 1
0
 public DuplexSessionServerReliableChannelBinder(ChannelBuilder builder, EndpointAddress remoteAddress, MessageFilter filter, int priority, MaskingMode maskingMode, TolerateFaultsMode faultMode, TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout) : base(builder, remoteAddress, filter, priority, maskingMode, faultMode, defaultCloseTimeout, defaultSendTimeout)
 {
 }
Ejemplo n.º 2
0
 internal void ApplyPropertiesOnDemuxer(ChannelBuilder builder, BindingContext context)
 {
     // Only used for services
 }
Ejemplo n.º 3
0
 protected ServerReliableChannelBinder(ChannelBuilder builder, EndpointAddress remoteAddress, MessageFilter filter, int priority, MaskingMode maskingMode, TolerateFaultsMode faultMode, TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout) : base(default(TChannel), maskingMode, faultMode, defaultCloseTimeout, defaultSendTimeout)
 {
     this.pendingChannelEvent = new InterruptibleWaitObject(false, false);
     this.listener            = builder.BuildChannelListener <TChannel>(filter, priority);
     this.remoteAddress       = remoteAddress;
 }
Ejemplo n.º 4
0
 public ChannelBuilder(ChannelBuilder channelBuilder)
 {
     _binding           = new CustomBinding(channelBuilder.Binding);
     _bindingParameters = channelBuilder.BindingParameters;
 }
Ejemplo n.º 5
0
        /*internal override bool RequiresChannelDemuxer()
         * {
         * if (!base.RequiresChannelDemuxer())
         *  return this.RequiresChannelDemuxer(this.ProtectionTokenParameters);
         * return true;
         * }*/

        protected override IChannelFactory <TChannel> BuildChannelFactoryCore <TChannel>(BindingContext context)
        {
            ISecurityCapabilities      property           = this.GetProperty <ISecurityCapabilities>(context);
            SecurityCredentialsManager credentialsManager = context.BindingParameters.Find <SecurityCredentialsManager>() ?? (SecurityCredentialsManager)ClientCredentials.CreateDefaultCredentials();
            bool           addChannelDemuxerIfRequired    = this.RequiresChannelDemuxer();
            ChannelBuilder channelBuilder = new ChannelBuilder(context, addChannelDemuxerIfRequired);

            if (addChannelDemuxerIfRequired)
            {
#if FEATURE_CORECLR
                throw new NotImplementedException("ApplyPropertiesOnDemuxer is not supported in .NET Core");
#else
                this.ApplyPropertiesOnDemuxer(channelBuilder, context);
#endif
            }
            BindingContext bindingContext1 = context.Clone();
            SecurityChannelFactory <TChannel> securityChannelFactory;
            if (this.ProtectionTokenParameters is SecureConversationSecurityTokenParameters)
            {
                SecureConversationSecurityTokenParameters protectionTokenParameters = (SecureConversationSecurityTokenParameters)this.ProtectionTokenParameters;
                if (protectionTokenParameters.BootstrapSecurityBindingElement == null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError((Exception) new InvalidOperationException(SR.GetString("SecureConversationSecurityTokenParametersRequireBootstrapBinding")));
                }
                BindingContext bindingContext2 = bindingContext1.Clone();
                bindingContext2.BindingParameters.Remove <ChannelProtectionRequirements>();
// BootstrapProtectionRequirements not supported
//         bindingContext2.BindingParameters.Add((object) protectionTokenParameters.BootstrapProtectionRequirements);
                if (protectionTokenParameters.RequireCancellation)
                {
                    SessionSymmetricMessageSecurityProtocolFactory securityProtocolFactory = new SessionSymmetricMessageSecurityProtocolFactory();
                    securityProtocolFactory.SecurityTokenParameters = protectionTokenParameters.Clone();
                    ((SecureConversationSecurityTokenParameters)securityProtocolFactory.SecurityTokenParameters).IssuerBindingContext = bindingContext2;
                    securityProtocolFactory.ApplyConfidentiality           = true;
                    securityProtocolFactory.RequireConfidentiality         = true;
                    securityProtocolFactory.ApplyIntegrity                 = true;
                    securityProtocolFactory.RequireIntegrity               = true;
                    securityProtocolFactory.IdentityVerifier               = this.LocalClientSettings.IdentityVerifier;
                    securityProtocolFactory.DoRequestSignatureConfirmation = this.RequireSignatureConfirmation;
                    securityProtocolFactory.MessageProtectionOrder         = this.MessageProtectionOrder;
                    securityProtocolFactory.IdentityVerifier               = this.LocalClientSettings.IdentityVerifier;
                    securityProtocolFactory.ProtectionRequirements.Add(SecurityBindingElement.ComputeProtectionRequirements((SecurityBindingElement)this, context.BindingParameters, context.Binding.Elements, false));
                    this.ConfigureProtocolFactory((SecurityProtocolFactory)securityProtocolFactory, credentialsManager, false, bindingContext1, (Binding)context.Binding);
                    SecuritySessionClientSettings <TChannel> sessionClientSettings = new SecuritySessionClientSettings <TChannel>();
                    sessionClientSettings.ChannelBuilder                = channelBuilder;
                    sessionClientSettings.KeyRenewalInterval            = this.LocalClientSettings.SessionKeyRenewalInterval;
                    sessionClientSettings.CanRenewSession               = protectionTokenParameters.CanRenewSession;
                    sessionClientSettings.KeyRolloverInterval           = this.LocalClientSettings.SessionKeyRolloverInterval;
                    sessionClientSettings.TolerateTransportFailures     = this.LocalClientSettings.ReconnectTransportOnFailure;
                    sessionClientSettings.IssuedSecurityTokenParameters = protectionTokenParameters.Clone();
                    ((SecureConversationSecurityTokenParameters)sessionClientSettings.IssuedSecurityTokenParameters).IssuerBindingContext = bindingContext1;
                    sessionClientSettings.SecurityStandardsManager = securityProtocolFactory.StandardsManager;
                    Console.WriteLine("Assigned sessionClientSettings.SessionProtocolFactory");
                    sessionClientSettings.SessionProtocolFactory = (SecurityProtocolFactory)securityProtocolFactory;
                    securityChannelFactory = new SecurityChannelFactory <TChannel>(property, context, sessionClientSettings);
                }
                else
                {
#if FEATURE_CORECLR
                    throw new NotImplementedException("SymmetricSecurityProtocolFactory not supported in .NET Core");
#else
                    SymmetricSecurityProtocolFactory securityProtocolFactory = new SymmetricSecurityProtocolFactory();
                    securityProtocolFactory.SecurityTokenParameters = protectionTokenParameters.Clone();
                    ((SecureConversationSecurityTokenParameters)securityProtocolFactory.SecurityTokenParameters).IssuerBindingContext = bindingContext2;
                    securityProtocolFactory.ApplyConfidentiality           = true;
                    securityProtocolFactory.RequireConfidentiality         = true;
                    securityProtocolFactory.ApplyIntegrity                 = true;
                    securityProtocolFactory.RequireIntegrity               = true;
                    securityProtocolFactory.IdentityVerifier               = this.LocalClientSettings.IdentityVerifier;
                    securityProtocolFactory.DoRequestSignatureConfirmation = this.RequireSignatureConfirmation;
                    securityProtocolFactory.MessageProtectionOrder         = this.MessageProtectionOrder;
                    securityProtocolFactory.ProtectionRequirements.Add(SecurityBindingElement.ComputeProtectionRequirements((SecurityBindingElement)this, context.BindingParameters, context.Binding.Elements, false));
                    this.ConfigureProtocolFactory((SecurityProtocolFactory)securityProtocolFactory, credentialsManager, false, bindingContext1, (Binding)context.Binding);
                    securityChannelFactory = new SecurityChannelFactory <TChannel>(property, context, channelBuilder, (SecurityProtocolFactory)securityProtocolFactory);
#endif
                }
            }
            else
            {
                SecurityProtocolFactory securityProtocolFactory = this.CreateSecurityProtocolFactory <TChannel>(context, credentialsManager, false, bindingContext1);
                securityChannelFactory = new SecurityChannelFactory <TChannel>(property, context, channelBuilder, securityProtocolFactory);
            }
            return((IChannelFactory <TChannel>)securityChannelFactory);
        }
Ejemplo n.º 6
0
 SecurityChannelFactory(ISecurityCapabilities securityCapabilities, BindingContext context, ChannelBuilder channelBuilder, IChannelFactory innerChannelFactory)
     : base(context.Binding, innerChannelFactory)
 {
     this.channelBuilder       = channelBuilder;
     this.messageVersion       = context.Binding.MessageVersion;
     this.securityCapabilities = securityCapabilities;
 }
Ejemplo n.º 7
0
 public SecurityChannelFactory(ISecurityCapabilities securityCapabilities, BindingContext context, ChannelBuilder channelBuilder, SecurityProtocolFactory protocolFactory, IChannelFactory innerChannelFactory)
     : this(securityCapabilities, context, channelBuilder, innerChannelFactory)
 {
     this.securityProtocolFactory = protocolFactory;
 }
Ejemplo n.º 8
0
 public SecurityChannelFactory(ISecurityCapabilities securityCapabilities, BindingContext context, ChannelBuilder channelBuilder, SecurityProtocolFactory protocolFactory)
     : this(securityCapabilities, context, channelBuilder, protocolFactory, channelBuilder.BuildChannelFactory <TChannel>())
 {
 }