/// <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)); }