Exemple #1
0
        /// <summary>
        /// Send a "You need to authenticate yourself." error followed by the
        /// welcome message.
        /// </summary>
        /// <param name="socket"></param>
        private void TellClientToReAuthenticate(AsyncSocket socket)
        {
            MessageAuthenticationResponse response = new MessageAuthenticationResponse(false);

            response.ErrorMessage = "You need to authenticate yourself.";
            SendMessageToClient.Send(response, socket, true);
            SendMessageToClient.Send(_welcomeMessage, socket, true);
        }
        private void HandleAuthenticationResponse(string msg)
        {
            MessageAuthenticationResponse authResponse = (MessageAuthenticationResponse)JsonConvert.DeserializeObject(msg, typeof(MessageAuthenticationResponse));

            Authenticated = authResponse.Success;
            autologinKey  = authResponse.AutologinKey;

            if (!authResponse.Success)
            {
                AuthenticationFailed = true;
                Log.Warn("WifiRemoteClient: Failed to authenticate: '{0}'", authResponse.ErrorMessage);
            }
        }
Exemple #3
0
        private void SendAuthenticationResponse(AsyncSocket socket, bool _success)
        {
            MessageAuthenticationResponse authResponse = new MessageAuthenticationResponse(_success);

            if (!_success)
            {
                authResponse.ErrorMessage = "Login failed";
            }
            else
            {
                Logger.Debug("WifiRemote: Client identified: " + socket.GetRemoteClient().ToString());
                string key = GetRandomMD5();
                authResponse.AutologinKey = key;
                _loginTokens.Add(new AutoLoginToken(key, socket.GetRemoteClient()));
            }

            SendMessageToClient.Send(authResponse, socket, true);
        }