コード例 #1
0
        public LoyaltyCardPage()
        {
            InitializeComponent();

            _userClientService = new UserClientService();
            // UpdateData();
        }
コード例 #2
0
        public async Task AddUserFollowerTest()
        {
            var             followedApplicationUserId = Guid.NewGuid();
            var             dbContext             = TestsBase.CreateDbContext();
            ApplicationUser applicationUserEntity = new()
            {
                AzureAdB2cobjectId = followedApplicationUserId,
                EmailAddress       = "*****@*****.**",
                FullName           = "AUTOMATED TEST USER"
            };
            await dbContext.ApplicationUser.AddAsync(applicationUserEntity);

            await dbContext.SaveChangesAsync();

            await base.SignIn(Role.User);

            UserClientService userClientService = base.CreateUserClientService();
            await userClientService.AddUserFollowerAsync(followedApplicationUserId : applicationUserEntity.ApplicationUserId);

            var followerEntity = await dbContext.UserFollower
                                 .SingleOrDefaultAsync(p => p.FollowedApplicationUser.AzureAdB2cobjectId == followedApplicationUserId);

            Assert.IsNotNull(followerEntity);
        }
    }
コード例 #3
0
        public async Task GetMyConversationsUsers()
        {
            var authorizedHttpClient = await base.SignIn(Role.User);

            var             dbContext       = TestsBase.CreateDbContext();
            ApplicationUser destinataryUser = new ApplicationUser()
            {
                ApplicationUserStatusId = 1,
                EmailAddress            = "*****@*****.**",
                FullName = "TST Cnv USER",
            };
            await dbContext.ApplicationUser.AddAsync(destinataryUser);

            await dbContext.SaveChangesAsync();

            var currentUser = dbContext.ApplicationUser.First();
            UserClientService userClientService = CreateUserClientService();
            await userClientService.SendMessageAsync(new Models.UserMessage.UserMessageModel()
            {
                Message             = "Test Message",
                ToApplicationUserId = destinataryUser.ApplicationUserId
            });

            UserMessageClientService userMessageClientService = base.CreateUserMessageClientService();
            var result = await userMessageClientService.GetMyConversationsUsersAsync();

            Assert.IsNotNull(result);
        }
コード例 #4
0
        public async Task ListUsersTest()
        {
            await base.SignIn(Role.User);

            UserClientService userClientService = base.CreateUserClientService();
            var result = await userClientService.ListUsersAsync();

            Assert.IsNotNull(result);
        }
コード例 #5
0
        public async Task GetMyRolesTest()
        {
            await base.SignIn(Role.User);

            UserClientService userClientService = base.CreateUserClientService();
            var result = await userClientService.GetMyRolesAsync();

            Assert.IsNotNull(result);
            Assert.AreEqual(result, Role.User.ToString());
        }
コード例 #6
0
        public async Task SendMessageTest()
        {
            await base.SignIn(Role.User);

            UserClientService userClientService = base.CreateUserClientService();
            await userClientService.SendMessageAsync(new UserMessageModel()
            {
                Message             = "PRUEBA",
                ToApplicationUserId = 1
            });
        }
コード例 #7
0
        public async Task InviteUserTest()
        {
            await base.SignIn(Role.User);

            UserClientService userClientService = base.CreateUserClientService();
            await userClientService.InviteUserAsync(inviteUserModel : new Models.Invites.InviteUserModel()
            {
                CustomMessage  = "This is a message from FairPlayTube Automated Tests",
                ToEmailAddress = "*****@*****.**"
            });
        }
コード例 #8
0
        public static void SecureConnect(TcpClient tcpclient, params string[] value)
        {
            var stream = tcpclient.GetStream();

            if (Program.ServerProperties["SSLENABLED"] == "false")
            {
                SocketUtilities.SendInvalid(stream, "SSL isn't enabled on this server");
                tcpclient.Close();
                return;
            }
            if (value.Length != 2)
            {
                SocketUtilities.SendInvalid(stream, "Incorrect number of parameters");
                tcpclient.Close();
                return;
            }
            string username = value[0];
            string client   = value[1];

            if (Program.Clients.ContainsKey(username))
            {
                SocketUtilities.SendCommand(stream, new CommandParameterPair("INVALIDUN {0}", username));
                tcpclient.Close();
                return;
            }
            string certFile;

            if (!Program.ServerDependencies.TryGetValue("SSLCERT", out certFile))
            {
                SocketUtilities.SendInvalid(stream, "SSL isn't properly supported on this server");
                tcpclient.Close();
                return;
            }
            string password;

            if (!Program.ServerDependencies.TryGetValue("SSLPASS", out password))
            {
                SocketUtilities.SendInvalid(stream, "SSL isn't properyly supported on this serverserver");
                tcpclient.Close();
                return;
            }
            var service = new UserClientService(new SecureClient(stream, certFile, username, client, new ConcurrentDictionary <string, string>(), new ConcurrentDictionary <string, string>(), DateTime.UtcNow, password), true);

            service.SendCommand(new CommandParameterPair("CONNECTED"));
            Program.Clients.TryAdd(username, service);
            var thread = new Thread(ClientManagement.ManageClient);

            thread.Start(service);
            Program.ClientThreads.TryAdd(username, thread);
        }
コード例 #9
0
        public static void Connect(TcpClient tcpClient, params string[] parameters)
        {
            if (!tcpClient.Connected)
            {
                tcpClient.Close();
                return;
            }
            NetworkStream stream = tcpClient.GetStream();

            if (parameters.Length != 2)
            {
                SocketUtilities.SendInvalid(stream, "Parameters not formatted correctly");
                stream.Close();
                tcpClient.Close();
                return;
            }
            string username = parameters[0];
            string client   = parameters[1];

            if (Program.Clients.ContainsKey(username) | username.Trim().ToLower() == "system" | username.Length > 15)
            {
                SocketUtilities.SendCommand(stream, new CommandParameterPair("INVALIDUN"));
                stream.Close();
                tcpClient.Close();
                return;
            }

            var service = new UserClientService(new UserClient(username, client, tcpClient, new ConcurrentDictionary <string, string>(), new ConcurrentDictionary <string, string>(), DateTime.UtcNow));

            SocketUtilities.SendCommand(stream, new CommandParameterPair("CONNECTED"));

            ConsoleUtilities.PrintWarning("Got here!");
            foreach (IMessagingClient sclient in Program.Clients.Values)
            {
                sclient.Alert(String.Format("{0} has connected", username), 3);
            }
            ConsoleUtilities.PrintInformation("Connected {0}", username);
            Program.Clients.TryAdd(username, service);
            Thread thread = new Thread(ClientManagement.ManageClient);

            thread.Start(service);
            Program.ClientThreads.TryAdd(username, thread);
        }
コード例 #10
0
        public Server(IServiceProvider provider)
        {
            _provider = provider;
            _logger   = provider.GetService <ILoggerFactory>()?.CreateLogger("Chat.Server");

            _eventBus = provider.GetRequiredService <IEventBus>();

            var eventLogger = provider.GetService <ILoggerFactory>()?.CreateLogger("Chat.Server.Events");

            _eventBus.GetEventStream <DomainEvent>().Subscribe(e => eventLogger.LogInformation(
                                                                   e.GetType().Name + " " + JsonConvert.SerializeObject(e)));

            _userRepo     = provider.GetRequiredService <IUserRepository>();
            _chatroomRepo = provider.GetRequiredService <IChatroomRepository>();
            _messageRepo  = provider.GetRequiredService <IMessageRepository>();

            _identityService   = provider.GetRequiredService <IdentityService>();
            _chatroomService   = provider.GetRequiredService <ChatroomService>();
            _messageService    = provider.GetRequiredService <MessageService>();
            _userClientService = provider.GetRequiredService <UserClientService>();

            _chatroomService.EnsureGlobalChatroomCreated();
        }
コード例 #11
0
ファイル: HomeController.cs プロジェクト: mohanaddepalli/DMS
        public async Task <ActionResult> Login(string username, string password)
        {
            if (ModelState.IsValid)
            {
                var userClientService = new UserClientService();
                var user = await userClientService.ValidateUser(username, password);

                if (user != null)
                {
                    Session["UserId"]   = user.UserId;
                    Session["UserName"] = user.LoginName;
                    return(RedirectToAction("Index", "Document"));
                }
                else
                {
                    ViewBag.error = "Invalid Account";
                    return(View("Index"));
                }
            }
            else
            {
                return(View("Index"));
            }
        }
コード例 #12
0
 public CustomAuthStateProvider(UserClientService userClientService)
 {
     this.UserClientService = userClientService;
 }
コード例 #13
0
 public SampleRequest(UrlService urlService, ParkrunClientService client, UserClientService userClient)
 {
     _urlService = urlService;
     _client     = client;
     _userClient = userClient;
 }
コード例 #14
0
 public CustomAccountClaimsPrincipalFactory(IAccessTokenProviderAccessor accessor,
                                            HttpClientService httpClientService, UserClientService userClientService) : base(accessor)
 {
     this.HttpClientService = httpClientService;
     this.UserClientService = userClientService;
 }
コード例 #15
0
 public AuthenticationService()
 {
     _userClientService = new UserClientService();
 }
コード例 #16
0
 public UsersClientsController(ILogger <ApiController> logger, UserClientService userClient) : base(logger)
 {
     _userClient = userClient;
 }