我将 NetTcpBinding 与 WPF 客户端一起使用。我想知道CallBackChanel(OperationContext.Current.GetCallbackChannel)是否可以被其他人欺骗......我可以确定,如果我将这个CallBack对象存储在一个列表中,这个回调就不能使用被别人...
例子:
private class ClientCallBack
{
public IDuplexServiceCallBack CallBack { get; set; }
public long UserId { get; set; }
public bool IsAuthenticate { get; set; }
public DateTime LastPing { get; set; }
public DateTime LastPong { get; set; }
public bool Fault { get; set; }
public long Ping { get; set; }
}
static List<ClientCallBack> Clients;
public void Login(string UserName, string Password)
{
var auth = new AutentificationService();
var user = auth.Login(UserName, Password, true, null);
if (user != null)
{
Clients.Add(new ClientCallBack()
{
CallBack = OperationContext.Current.GetCallbackChannel<IDuplexServiceCallBack>();,
Fault = false,
IsAutenticate = true,
LastPing = DateTime.Now,
LastPong = DateTime.Now,
Ping = 0,
UserId = user.Id
});
}
}
public void action() {
var client = Clients.FirstOrDefault(o => o.CallBack == OperationContext.Current.GetCallbackChannel<IDuplexServiceCallBack>(););
if (client != null && client.IsAutenticate)
{
//This client is authenticated
}
}
有人可以使用其他人的回调吗?
坦克