/// <summary>
 /// Adds the binding parameters.
 /// </summary>
 /// <param name="description">The description.</param>
 /// <param name="serviceHostBase">The service host base.</param>
 /// <param name="endpoints">The endpoints.</param>
 /// <param name="parameters">The parameters.</param>
 public void AddBindingParameters(ServiceDescription description,
                                  ServiceHostBase serviceHostBase,
                                  System.Collections.ObjectModel.Collection <ServiceEndpoint> endpoints,
                                  System.ServiceModel.Channels.BindingParameterCollection parameters)
 {
     // Not implemented.
 }
Exemplo n.º 2
0
        public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
        {
            // Sign only the header, but not the body.

            // This does not work.
            //endpoint.Contract.ProtectionLevel = System.Net.Security.ProtectionLevel.Sign;
            //foreach (OperationDescription operation in endpoint.Contract.Operations)
            //{
            //    MessageDescription requestMessage = operation.Messages.First(msg => msg.Direction == MessageDirection.Input);

            //    foreach (MessagePartDescription body in requestMessage.Body.Parts)
            //    {
            //        body.ProtectionLevel = System.Net.Security.ProtectionLevel.None;
            //    }
            //}

            bindingParameters.Remove <ChannelProtectionRequirements>();

            var m = new MessagePartSpecification();

            m.IsBodyIncluded = false;

            var c1 = new ChannelProtectionRequirements();

            c1.IncomingSignatureParts.AddParts(m, "*");

            MessagePartSpecification m1 = new MessagePartSpecification();

            m.IsBodyIncluded = false;
            c1.IncomingEncryptionParts.AddParts(m1, "*");

            bindingParameters.Add(c1);
        }
 public void AddBindingParameters(OperationDescription description, System.ServiceModel.Channels.BindingParameterCollection parameters)
 {
     if (innerFormatterBehavior != null)
     {
         innerFormatterBehavior.AddBindingParameters(description, parameters);
     }
 }
 /// <summary>
 /// Configures any binding elements to support the contract behavior.
 /// </summary>
 /// <param name="contractDescription">The contract description to modify.</param>
 /// <param name="endpoint">The endpoint to modify.</param>
 /// <param name="bindingParameters">The objects that binding elements require to support the behavior.</param>
 public void AddBindingParameters(
     ContractDescription contractDescription,
     ServiceEndpoint endpoint,
     System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
 {
     // Not implemented.
 }
 /// <summary>
 /// Provides the ability to pass custom data to binding elements
 /// to support the contract implementation.
 /// </summary>
 /// <param name="serviceDescription">The service description of the service.</param>
 /// <param name="serviceHostBase">The host of the service.</param>
 /// <param name="endpoints">The service endpoints.</param>
 /// <param name="bindingParameters">Custom objects to which binding elements have access.
 /// </param>
 public void AddBindingParameters(ServiceDescription serviceDescription,
                                  System.ServiceModel.ServiceHostBase serviceHostBase,
                                  System.Collections.ObjectModel.Collection <ServiceEndpoint> endpoints,
                                  System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
 {
     return;
 }
Exemplo n.º 6
0
        public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
        {
            SsoClientCredentials cred = bindingParameters.Find <SsoClientCredentials>();

            if (cred == null)
            {
                throw new ConfigurationErrorsException("The session behavior must be used in conjunction with SsoClientCredentials");
            }
            cred.Session  = session;
            cred.Duration = duration;
            cred.Cache    = cache;
            cred.Config   = config;
        }
Exemplo n.º 7
0
 public CFClientBase(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress)
 {
     if ((binding == null))
     {
         throw new System.ArgumentNullException("binding");
     }
     if ((remoteAddress == null))
     {
         throw new System.ArgumentNullException("remoteAddress");
     }
     this.remoteAddress      = remoteAddress;
     this.binding            = binding;
     this._clientCredentials = new System.ServiceModel.Description.ClientCredentials();
     this._parameters        = new System.ServiceModel.Channels.BindingParameterCollection();
     this._parameters.Add(this._clientCredentials);
     this.outputChannelFactorySyncObject  = new object();
     this.requestChannelFactorySyncObject = new object();
 }
        public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
        {
            var proReq =
                bindingParameters.Remove <ChannelProtectionRequirements>();

            proReq = new ChannelProtectionRequirements();

            MessagePartSpecification unProtectedSpec = new MessagePartSpecification();
            MessagePartSpecification protectedSpec   = new MessagePartSpecification(true);

            // I'm setting same protection level for all the actions.
            // You could specify different protection level per action, if required.
            // Also note, I haven't implemented any support for custom SOAP headers.
            // However that can easily be added using the same mechansim.
            switch (level)
            {
            case ProtectionLevel.None:
                proReq.OutgoingSignatureParts.AddParts(unProtectedSpec, "*");
                proReq.IncomingSignatureParts.AddParts(unProtectedSpec, "*");

                proReq.OutgoingEncryptionParts.AddParts(unProtectedSpec, "*");
                proReq.IncomingEncryptionParts.AddParts(unProtectedSpec, "*");
                break;

            case ProtectionLevel.Sign:
                proReq.OutgoingSignatureParts.AddParts(protectedSpec, "*");
                proReq.IncomingSignatureParts.AddParts(protectedSpec, "*");

                proReq.OutgoingEncryptionParts.AddParts(unProtectedSpec, "*");
                proReq.IncomingEncryptionParts.AddParts(unProtectedSpec, "*");
                break;

            case ProtectionLevel.EncryptAndSign:
                proReq.OutgoingSignatureParts.AddParts(protectedSpec, "*");
                proReq.IncomingSignatureParts.AddParts(protectedSpec, "*");

                proReq.OutgoingEncryptionParts.AddParts(protectedSpec, "*");
                proReq.IncomingEncryptionParts.AddParts(protectedSpec, "*");
                break;
            }
            // Add our protection requirement for this endpoint into the binding params.

            bindingParameters.Add(proReq);
        }
Exemplo n.º 9
0
 public override System.ServiceModel.Channels.IChannelFactory <TChannel> BuildChannelFactory <TChannel>(System.ServiceModel.Channels.BindingParameterCollection parameters)
 {
     return(default(System.ServiceModel.Channels.IChannelFactory <TChannel>));
 }
Exemplo n.º 10
0
 public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection <ServiceEndpoint> endpoints, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
 {
     throw new Exception("The method or operation is not implemented.");
 }
 void IEndpointBehavior.AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection parameters)
 {
     throw new NotImplementedException();
 }
 public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
 {
     //throw new NotImplementedException();
 }
Exemplo n.º 13
0
 public void AddBindingParameters(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection <ServiceEndpoint> endpoints, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 14
0
 void IContractBehavior.AddBindingParameters(ContractDescription contractDescription, ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
 {
 }
Exemplo n.º 15
0
 public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
 {
 }
Exemplo n.º 16
0
 public void AddBindingParameters(ContractDescription contractDescription, ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
 {
     // no binding parameters need to be set here
     return;
 }
 public void AddBindingParameters(OperationDescription operationDescription, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
 {
     // throw new NotImplementedException();
 }
 void System.ServiceModel.Description.IOperationBehavior.AddBindingParameters(System.ServiceModel.Description.OperationDescription description, System.ServiceModel.Channels.BindingParameterCollection parameters)
 {
 }
 /// <summary>
 /// Pass the data at runtime to bindings to support custom behavior. The current implementation does nothing.
 /// </summary>
 /// <param name="endpoint">The endpoint to modify.</param>
 /// <param name="bindingParameters">The objects that binding elements require to support the behavior.</param>
 public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
 {
     // Leave empty, do nothing
 }
        /// <summary>
        /// The _logger
        /// </summary>
        //private static ILogger _logger = LogManager.GetLogger(typeof(CrossOriginResourceSharingBehavior).ToString());

        /// <summary>
        /// Adds the binding parameters.
        /// </summary>
        /// <param name="endpoint">The endpoint.</param>
        /// <param name="bindingParameters">The binding parameters.</param>
        public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
        {
            //no need to implement since we don't add any binding params
        }
 public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
 {
     // No implementation necessary
 }
 public override System.ServiceModel.Channels.IChannelFactory <TChannel> BuildChannelFactory <TChannel>(System.ServiceModel.Channels.BindingParameterCollection parameters)
 {
     throw null;
 }
        public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection <ServiceEndpoint> endpoints, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
        {
            Dispatcher dispatcher;

            if (DispatcherType != null)
            {
                dispatcher = (Dispatcher)Activator.CreateInstance(DispatcherType);
            }
            else
            {
                dispatcher = new WcfProxyDispatcher();
            }

            SubscriptionEndpoint  subscription = new SubscriptionEndpoint(SubscriptionId ?? Guid.NewGuid(), Name, ConfigurationName, Address ?? serviceDescription.Endpoints[0].Address.Uri.ToString(), ContractType, dispatcher, WcfProxyDispatcher.CreateMessageFilter(ContractType), Transient);
            SubscriptionExtension extension    = new SubscriptionExtension(subscription);

            extension.UnsubscribeOnClosing = UnsubscribeOnClosing;
            serviceHostBase.Extensions.Add(extension);
        }
 void IEndpointBehavior.AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
 {
     return;
 }
Exemplo n.º 25
0
 void IOperationBehavior.AddBindingParameters(OperationDescription operationDescription, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
 {
 }
Exemplo n.º 26
0
 public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
 {
     throw new Exception("The method or operation is not implemented.");
 }
 void System.ServiceModel.Description.IServiceBehavior.AddBindingParameters(System.ServiceModel.Description.ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection <System.ServiceModel.Description.ServiceEndpoint> endpoints, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
 {
 }
Exemplo n.º 28
0
        ///// <summary>
        ///// Enables the discovery.
        ///// </summary>
        ///// <exception cref="System.ApplicationException"></exception>
        //private void EnableDiscovery()
        //{
        //    string announcementEndpointUrl = ConfigurationManager.AppSettings[DiscoAppSettingsKey.Announce];
        //    if (String.IsNullOrWhiteSpace(announcementEndpointUrl))
        //    {
        //        string errorMessage = string.Format(
        //            "No value found for key '{0}' in configuration file"
        //            + ", please provide a key '{0}' in the section AppConfig and set its value to the appropriate announcement endpoint url",
        //            DiscoAppSettingsKey.Announce
        //            );
        //        throw new ApplicationException(errorMessage);
        //    }
        //    var announcementEndpoint = new AnnouncementEndpoint(BindingFactory.CreateBindingFromKey(BindingFactory.Key.WsHttpBindingNoSecurity),
        //        new EndpointAddress(announcementEndpointUrl));
        //    var discovery = new ServiceDiscoveryBehavior();
        //    discovery.AnnouncementEndpoints.Add(announcementEndpoint);
        //    Description.Behaviors.Add(discovery);
        //}



        ///// <summary>
        ///// Makes the announcing service.
        ///// </summary>
        //public void MakeAnnouncingService()
        //{
        //    if (ConfigurationHelper.EnableMex)
        //        AddMexEndpoints();
        //    if (ConfigurationHelper.EnableDiscovery)
        //        EnableDiscovery();
        //    if (ConfigurationHelper.UpscaleBindings)
        //        UpscaleBindings();
        //}

        ///// <summary>
        ///// Upscales the bindings.
        ///// </summary>
        //private void UpscaleBindings()
        //{
        //    foreach (var item in Description.Endpoints)
        //    {
        //        item.Binding.Upscale();
        //    }
        //}


        ///// <summary>
        ///// Adds the mex endpoints.
        ///// </summary>
        //private void AddMexEndpoints()
        //{
        //    var mexBehavior = Description.Behaviors.Find<ServiceMetadataBehavior>();
        //    if (mexBehavior == null)
        //    {
        //        mexBehavior = new ServiceMetadataBehavior();
        //        Description.Behaviors.Add(mexBehavior);
        //    }
        //    foreach (Uri baseAddress in BaseAddresses)
        //    {
        //        if (baseAddress.Scheme == Uri.UriSchemeHttp)
        //        {
        //            mexBehavior.HttpGetEnabled = true;
        //            mexBehavior.HttpGetUrl = baseAddress;
        //            AddServiceEndpoint(ServiceMetadataBehavior.MexContractName,
        //                MetadataExchangeBindings.CreateMexHttpBinding(),
        //                "mex");
        //        }
        //        else if (baseAddress.Scheme == Uri.UriSchemeHttps)
        //        {
        //            mexBehavior.HttpsGetEnabled = true;
        //            mexBehavior.HttpsGetUrl = baseAddress;
        //            AddServiceEndpoint(ServiceMetadataBehavior.MexContractName,
        //                MetadataExchangeBindings.CreateMexHttpsBinding(),
        //                "mex");
        //        }
        //        else if (baseAddress.Scheme == Uri.UriSchemeNetPipe)
        //        {
        //            AddServiceEndpoint(ServiceMetadataBehavior.MexContractName,
        //                MetadataExchangeBindings.CreateMexNamedPipeBinding(),
        //                "mex");
        //        }
        //        else if (baseAddress.Scheme == Uri.UriSchemeNetTcp)
        //        {
        //            AddServiceEndpoint(ServiceMetadataBehavior.MexContractName,
        //                MetadataExchangeBindings.CreateMexTcpBinding(),
        //                "mex");
        //        }
        //    }
        //}



        #region Implementation of IServiceBehavior

        /// <summary>
        /// Provides the ability to pass custom data to binding elements to support the contract implementation.
        /// </summary>
        /// <param name="serviceDescription">The service description of the service.</param>
        /// <param name="serviceHostBase">The host of the service.</param>
        /// <param name="endpoints">The service endpoints.</param>
        /// <param name="bindingParameters">Custom objects to which binding elements have access.</param>
        public void AddBindingParameters(ServiceDescription serviceDescription,
                                         ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection <ServiceEndpoint> endpoints,
                                         System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
        {
            //       serviceHostBase.EnableDiscovery(true);
        }
 void System.ServiceModel.Description.IEndpointBehavior.AddBindingParameters(ServiceEndpoint serviceEndpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
 {
 }
Exemplo n.º 30
0
 public void AddBindingParameters(OperationDescription description, System.ServiceModel.Channels.BindingParameterCollection parameters)
 {
 }