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.
30 lines
828 B
30 lines
828 B
using System.ServiceModel;
|
|
using System.ServiceModel.Channels;
|
|
using System.ServiceModel.Dispatcher;
|
|
|
|
namespace EC.Helper.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;
|
|
}
|
|
}
|