Example #1
0
        /// <summary>
        /// Authenticate on the server
        /// </summary>
        /// <param name="userName">user name for authentication</param>
        /// <returns><c>true</c> - authentication success</returns>
        public AuthenticationResult Authenticate(string userName)
        {
            if (ConnectedUsers.Exists(u =>
                                      String.Compare(u.Context.UserName, userName, StringComparison.OrdinalIgnoreCase) == 0))
            {
                return(AuthenticationResult.Failed());
            }
            IConsoleCallback callback = OperationContext.Current.GetCallbackChannel <IConsoleCallback>();

            _currentUser = new ConnectedUser(ServerConsole.Authenticate(userName), callback);
            ConnectedUsers.Add(_currentUser);
            return(AuthenticationResult.Success(ConnectedUsers.Count - 1));
        }
Example #2
0
 /// <summary>
 /// Exit from the server
 /// </summary>
 public void Quite()
 {
     ConnectedUsers.Remove(_currentUser);
     _currentUser = null;
     //OperationContext.Current.Channel.Abort();
 }