You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
791 B

3 years ago
using System;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Dispatcher;
namespace EC.Onvif.Security
{
public class SoapSecurityHeaderInspector : IClientMessageInspector
{
private readonly string username;
private readonly string password;
private readonly TimeSpan time_shift;
public SoapSecurityHeaderInspector(string username, string password, TimeSpan timeShift)
{
this.username = username;
this.password = password;
time_shift = timeShift;
}
public void AfterReceiveReply(ref Message reply, object correlationState)
{
}
public object BeforeSendRequest(ref Message request, IClientChannel channel)
{
request.Headers.Add(new SoapSecurityHeader(username, password, time_shift));
return null;
}
}
}