protected virtual void OnGoodAuthentication(AuthenticationMessage message) { Server.GetWaitingListClient(message.ConnectionId).Send(new ExampleMessage() { Content = "[SERVER] You are authenticated" }); }
protected virtual void OnBadAuthentication(AuthenticationMessage message) { Server.GetWaitingListClient(message.ConnectionId).Send(new ExampleMessage() { Content = "[SERVER] Bad credentials" }); }
protected override void ProcessMessage(AuthenticationMessage message) { // todo: temporary Console.WriteLine("[AUTH HANDLER] Received auth! : " + message.Username + " / " + message.Password); if (!VerifyCredentials(message)) { OnBadAuthentication(message); return; } OnGoodAuthentication(message); Server.AuthenticateClient(message.ConnectionId, message.Username); }
public AuthenticationHandler(Server server) : base(server) { }