Add header to WCF RequestSecurityToken Message

I am trying to configure a client (web application) and a service (WCF service) that will communicate using WSHttpBinding. It seems that to use this binding, the client sends preliminary messages to configure the channel.

There is a service bus between the client and the service, which is routed to the user header. When using security BasicHttpBinding message routes without problems.

My question is: is there a way to add the same custom header to the RequestSecurityToken preliminary message?

Thanks in advance.

+5
source share
1 answer

It was allowed.

Unfortunately, according to the MSDN documentation, a service that uses WCF transport security cannot go through the router, and neither the service nor the client can be on the Internet ( https://msdn.microsoft.com/en-us/library/ff648863 .aspx # TransportSecurity ).

We wanted to violate both principles.

So, to shorten the messages, from five calls and replies to one, we switched to Message Security and disabled InstallSecurityContext and NegotiateServiceCredential. - This should have been done both in the Service configuration settings and in Client.

In addition to this, noteworthy advice may be that in order to point the service to our service bus, we have changed client service ClientViaBehavior on the client side.

Disable installation_context and NegotiateServiceCredential:

WSHttpBinding binding = new WSHttpBinding(); binding.Security.Mode = SecurityMode.Message; binding.Security.Message.EstablishSecurityContext = false; binding.Security.Message.NegotiateServiceCredential = false; 

Service Bus Point Client:

 serviceClient.Endpoint.EndpointBehaviors.Add(new ClientViaBehavior(new Uri("http://url/WCFService/ServiceName.svc"))); 
+1
source

All Articles