Last active
June 23, 2018 11:50
-
-
Save skenderbeu/0821233b21950155b8165ffb83e80959 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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