コード例 #1
0
 protected virtual void OnGoodAuthentication(AuthenticationMessage message)
 {
     Server.GetWaitingListClient(message.ConnectionId).Send(new ExampleMessage()
     {
         Content = "[SERVER] You are authenticated"
     });
 }
コード例 #2
0
 protected virtual void OnBadAuthentication(AuthenticationMessage message)
 {
     Server.GetWaitingListClient(message.ConnectionId).Send(new ExampleMessage()
     {
         Content = "[SERVER] Bad credentials"
     });
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 public AuthenticationHandler(Server server) : base(server)
 {
 }