Skip to content

Instantly share code, notes, and snippets.

@skenderbeu
Last active June 23, 2018 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skenderbeu/0821233b21950155b8165ffb83e80959 to your computer and use it in GitHub Desktop.
Save skenderbeu/0821233b21950155b8165ffb83e80959 to your computer and use it in GitHub Desktop.
using System.ServiceModel.Description;
namespace RoyalMail
{
public class EndPointBehaviour: IEndpointBehavior
{
RoyalMailHeaderCredentials _credentials;
public void ApplyClientBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
{
var inspector = new ClientMessageInspector();
inspector.SetCredentials(_credentials);
clientRuntime.MessageInspectors.Add(inspector);
}
public void SetCredentials(string clientId, string secret)
{
_credentials = new RoyalMailHeaderCredentials
{
ClientID = clientId,
Secret = secret
};
}
public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters){}
public void ApplyDispatchBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher) {}
public void Validate(ServiceEndpoint endpoint) {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment