internal MyCognitoUserPoolStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
        {
            // The code that defines your stack goes here
            var userpool = new UserPool(this, "myuserpool", new UserPoolProps {
                SignInCaseSensitive = false, // So user can sign in as username, Username, etc.
                SelfSignUpEnabled   = true,
                UserPoolName        = "MyUserPool",
                UserVerification    = new UserVerificationConfig {
                    EmailSubject = "Verify your email for our awesome app!",
                    EmailBody    = "Hello {username}, Thanks for signing up to our awesome app! Your verification code is {####}",
                    EmailStyle   = VerificationEmailStyle.CODE,
                    SmsMessage   = "Hello {username}, Thanks for signing up to our awesome app! Your verification code is {####}"
                },
                SignInAliases = new SignInAliases {
                    Username = true,
                    Email    = true
                }
            });

            userpool.AddDomain("CognitoDomain", new UserPoolDomainProps { // UserPoolDomainProps implements IUserPoolDomainOptions {
                CognitoDomain = new CognitoDomainOptions {
                    DomainPrefix = "my-awesome-app"
                }
            });

            userpool.AddClient("MyUserPoolClient", new UserPoolClientProps {
            });
        }
        public void LoginToFacebookPositiveTestCase()
        {
            User user = UserPool.getOne();

            NavigationUtils.GoToFacebookLoginPage();
            new LoginAction().LogIn(user);
            new LoginAsserts().AssertUserIsLoggedIn(user.UserId);
        }
        public SosBot(UserPool userPool)
        {
            _userPool = userPool;

            Thread threadBot = new Thread(this._doRoutine);

            threadBot.Start();
        }
        public void LoginToFacebookNegativeTestCase()
        {
            User user = UserPool.getOne();

            user.Password = "******";
            NavigationUtils.GoToFacebookLoginPage();
            new LoginAction().LogIn(user);
            new LoginAsserts().AssertUserIsNotLoggedIn(user.FirstName);
        }
        public void SearchAccountByUserName_PositiveTestCase()
        {
            User user = UserPool.getOne();

            NavigationUtils.GoToFacebookLoginPage();
            new LoginAction().LogIn(user);
            new SearchAction().Search("volodymyr lohvyniuk");
            new SearchAsserts().AssertSearchResultPresent("volodymyr.lohvyniuk");
        }
        private void LogIn()
        {
            logonStrategy = Scope.Resolve <LogOnFrame>();

            var user = UserPool.GetUser();

            logonStrategy.LogOn(user);

            Logger.Info($"User {user.Login} is logged in.");
        }
Exemple #7
0
        protected void btnLogout_Click(object sender, EventArgs e)
        {
            FormsAuthentication.SignOut();

            UserPool userPool = (UserPool)Application["UserPool"];

            userPool.RemoveUser(this.UcPage.UserName);

            killCookies();

            this.UcKioskPage.Refresh();
        }
Exemple #8
0
        private async Task <UserPool> GetUserpoolDetail(CancellationToken cancellationToken = default)
        {
            if (currentUserPool != null)
            {
                return(currentUserPool);
            }

            var param = new UserpoolParam();
            var res   = await Request <UserpoolResponse>(param.CreateRequest(), cancellationToken);

            currentUserPool = res.Result;
            return(res.Result);
        }
Exemple #9
0
        // <EVENT listing>
        //***********************************************************************************
        //  *****  Pre-Execution Events  ----------------------------------------------------
        //    BeginRequest
        //    AuthenticateRequest
        //    PostAuthenticateRequest
        //    AuthorizeRequest
        //    PostAuthorizeRequest
        //    ResolveRequestCache
        //    PostResolveRequestCache
        //    MapRequestHandler
        //    PostMapRequestHandler
        //    AcquireRequestState
        //    PostAcquireRequestState
        //    PreRequestHandlerExecute
        //
        //
        //
        //
        //  *****  ProcessRequest(Handler Execution  ----------------------------------------
        //
        //
        //
        //
        //  *****  Post-Execution Events  ---------------------------------------------------
        //    PostRequestHandlerExecute
        //    ReleaseRequestState
        //    PostReleaseRequestState
        //    UpdateRequestCache
        //    PostUpdateRequestCache
        //    LogRequest
        //    PostLogRequest
        //    EndRequest
        //    PreSendRequestHeaders
        //    PreSendRequestContent
        //***********************************************************************************



        public void Init(HttpApplication r_objApplication)
        {
            HttpContext objContext = this.getContext(r_objApplication);;

            _userPool = (UserPool)objContext.Application["UserPool"];



            //------------------------------------------
            r_objApplication.AuthenticateRequest += new EventHandler(this.AuthenticateRequest);
            r_objApplication.AuthorizeRequest    += new EventHandler(this.AuthorizeRequest);

            ////------------------------------------------
            r_objApplication.ReleaseRequestState += new EventHandler(this.ReleaseRequestState);
        }
Exemple #10
0
        protected void Logout()
        {
            UcUserArgs args = new UcUserArgs();

            args.UserName   = "";
            args.Password   = "";
            args.UserId     = this.UcPage.UserId;
            args.UserRoleId = this.UcPage.UserRoleId;
            OnLoggingOut(args);

            FormsAuthentication.SignOut();

            UserPool userPool = (UserPool)Application["UserPool"];

            userPool.RemoveUser(Page.User.Identity.Name);
        }
        public static void UcApplicationStart(HttpApplicationState app)
        {
            UserDS.UserDSDataTable dt = BllProxyUser.GetUsersByRole(1, 1);
            if (dt.Rows.Count == 0)
            {
                BllProxyUser.InsertUser("admin", "Admin", "Admin", "welcome", 1, "");
            }

            UserPool userPool = new UserPool();

            app.Add("UserPool", userPool);

            SosBot bot = new SosBot(userPool);

            app.Add("bot", bot);
        }
Exemple #12
0
        private int _benchLimit = 2;// 5

        public CollectorProcess(CollectorOptions options)
        {
            _options = options;
            _bench   = UserBench.Create(_options.CacheDirectory);
            _pool    = UserPool.Create(_options.CacheDirectory);

            var requestOptions = LoadRequestConfiguration(_options.ResourceConfigFile);

            _resources = new ResourceManager(
                requestOptions,
                options.IgnoreUserProfile,
                options.IgnoreFriends,
                options.IgnoreFollowers,
                options.IgnoreTimeline
                );
            _resources.NoResourceAvailable += _resources_NoResourceAvailable;
        }
Exemple #13
0
        protected void dvControl_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            e.NewValues["user_role_id"] = userRoleId;
            e.NewValues["time_zone"]    = timeZone;

            String userName = e.OldValues["username"].ToString();

            UserPool userPool = (UserPool)Application["UserPool"];

            userPool.RemoveUser(userName);


            if (userName == this.UcAppPage.UserName)
            {
                FormsAuthentication.SignOut();
                this.Refresh();
            }
        }
        protected bool doLogin(String username, String password)
        {
            bool result = false;

            UserPool userPool = (UserPool)Application["UserPool"];

            if (userPool.RegisterUser(username, password))
            {
                ltMessage.Text = "";

                FormsAuthentication.SignOut();
                FormsAuthentication.SetAuthCookie(username, false);


                Int32 userId     = userPool.GetUserId(username);
                Int32 userRoleId = userPool.GetUserRoleId(username);


                //----------------------------------------
                UcUserArgs args = new UcUserArgs();
                args.UserName   = username;
                args.Password   = password;
                args.UserId     = userId;
                args.UserRoleId = userRoleId;
                login(args);
                //----------------------------------------

                if (!args.Cancel)
                {
                    result = true;
                }
                else
                {
                    result = false;
                    doLogout(args.Message);
                }
            }
            else
            {
            }

            return(result);
        }
        public void TestSetUp()
        {
            var mainPage = Scope.Resolve <IMainPage>();

            mainPage.Open();
            mainPage.WaitForLoad();

            logonStrategy = Scope.Resolve <LogOnFrame>();

            var user = UserPool.GetUser();

            logonStrategy.LogOn(user);

            Logger.Info($"User {user.Login} is logged in.");

            var bookmarksPage = Scope.Resolve <IBookmarkPage>();

            bookmarksPage.Open();
            bookmarksPage.WaitForLoad();
        }
        protected void doLogout(string message)
        {
            //----------------------------------------
            UcUserArgs args = new UcUserArgs();

            args.UserName   = "";
            args.Password   = "";
            args.UserId     = this.UcPage.UserId;
            args.UserRoleId = this.UcPage.UserRoleId;
            logout(args);
            //----------------------------------------


            FormsAuthentication.SignOut();

            UserPool userPool = (UserPool)Application["UserPool"];

            userPool.RemoveUser(ltUsername.Text);

            ltMessage.Text = message;
        }
        protected override void save()
        {
            try
            {
                if (this.profileId != 0)
                {
                    this.dvControl.UpdateItem(true);
                }

                UserPool _userPool = (UserPool)this.Context.Application["UserPool"];
                if (_userPool != null)
                {
                    _userPool.ReloadUserData(this.UcPage.UserName);
                }
            }
            catch //(Exception ex)
            {
                this.showErrorMessage("Cannot save the data!");
                //this.showErrorMessage(ex.Message);
            }
        }
        public void CheckTileBookmarks()
        {
            var pageHeader = Scope.Resolve <IPageHeader>().WaitForLoading();

            pageHeader.OpenLogonFrame();

            logonStrategy.LogOn(UserPool.GetUser());

            var tutorialNavigator = Scope.Resolve <ITutorialNavigator>().WaitForLoading();

            var tiles = tutorialNavigator.GetAllTilesCache();

            CollectionAssert.IsNotEmpty(tiles);

            foreach (var tile in tiles)
            {
                Logger.Info($"{tile.Title} {(tile.BookMarkDisplayed() ? "has" : "does NOT have")} a bookmark");

                Assert.That(tile.BookMarkDisplayed(), Is.True);
            }
        }
Exemple #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                NameValueCollection parameters = Request.QueryString;
                foreach (String key in parameters.AllKeys)
                {
                    Session.Add(key, parameters[key]);
                }
            }

            //Read
            String userName = (string)Session["userName"];
            String password = (string)Session["password"];

            if (Request.Cookies["UserName"] != null)
            {
                HttpCookie cookieUsername = Request.Cookies["UserName"];
                userName = Server.HtmlEncode(cookieUsername.Value);
            }
            if (Request.Cookies["Password"] != null)
            {
                HttpCookie cookiePassword = Request.Cookies["Password"];
                password = Server.HtmlEncode(cookiePassword.Value);
            }

            UserPool userPool = (UserPool)Application["UserPool"];

            if (userPool.RegisterUser(userName, password))
            {
                FormsAuthentication.SignOut();
                FormsAuthentication.SetAuthCookie(userName, false);

                Response.Redirect("UcKioskConnect.aspx");
            }
            else
            {
                Response.Redirect("UcKioskLogin.aspx");
            }
        }
Exemple #20
0
        public void CompareUserProgress()
        {
            logonStrategy.LogOn(UserPool.GetUser());

            var progress = Scope.Resolve <IUserService>().GetStatistics(BaseDriver.GetBrowserCookies()).UserProgress;

            var statistics = Scope.Resolve <ITutorialSection>().WaitForLoading();

            var groups    = statistics.GetStatsByType(StatisticsType.Groups);
            var tutorials = statistics.GetStatsByType(StatisticsType.Tutorials);
            var missions  = statistics.GetStatsByType(StatisticsType.Missions);

            Assert.Multiple(() =>
            {
                Logger.Info($"From User service {progress.GroupsTotal}, from the main page {groups.Total}");
                Assert.That(
                    progress.GroupsTotal.Equals(groups.Total), $"{progress.GroupsTotal} not equals to {groups.Total}");

                Logger.Info($"From User service {progress.GroupsCompleted}, from the main page {groups.Completed}");
                Assert.That(
                    progress.GroupsCompleted.Equals(groups.Completed), $"{progress.GroupsCompleted} not equals to {groups.Completed}");

                Logger.Info($"From User service {progress.MissionsTotal}, from the main page {missions.Total}");
                Assert.That(
                    progress.MissionsTotal.Equals(missions.Total), $"{progress.MissionsTotal} not equals to {missions.Total}");

                Logger.Info($"From User service {progress.MissionsCompleted}, from the main page {missions.Completed}");
                Assert.That(
                    progress.MissionsCompleted.Equals(missions.Completed), $"{progress.MissionsCompleted} not equals to {missions.Completed}");

                Logger.Info($"From User service {progress.TutorialTotal}, from the main page {tutorials.Total}");
                Assert.That(
                    progress.TutorialTotal.Equals(tutorials.Total), $"{progress.TutorialTotal} not equals to {tutorials.Total}");

                Logger.Info($"From User service {progress.TutorialCompleted}, from the main page {tutorials.Completed}");
                Assert.That(
                    progress.TutorialCompleted.Equals(tutorials.Completed), $"{progress.TutorialCompleted} not equals to {tutorials.Completed}");
            });
        }
Exemple #21
0
        public void CompareUserHistory()
        {
            logonStrategy.LogOn(UserPool.GetUser());

            var cookies = BaseDriver.GetBrowserCookies();

            var userService = Scope.Resolve <IUserService>();

            string path = $"{TestContext.CurrentContext.Test.Name} ({_browser})";

            userService.DownloadHistory(cookies, path);

            var userFileHistory = UserHistoryData.GetUserHistory(path);

            var userHistory = userService.GetUserHistory(cookies);

            CollectionAssert.IsNotEmpty(userHistory);

            CollectionAssert.IsNotEmpty(userFileHistory);

            CompareHistories(userFileHistory, userHistory);
        }
        protected void Application_Start(object sender, EventArgs e)
        {
            UserPool userPool = new UserPool();

            Application.Add("UserPool", userPool);

            ////delegate botDelegate = new ( w TimerCallback(bot.doit());

            //Thread _bot = new Thread();
            //Application.Add("bot", _bot);
            //_bot.Start();


            SosBot bot = new SosBot(userPool);

            Application.Add("bot", bot);



            UcTextChatController textChatController = new UcTextChatController();

            Application.Add("UcTextChatController", textChatController);
        }
Exemple #23
0
        private bool DoLogin(String username, String password)
        {
            UserPool userPool = (UserPool)Application["UserPool"];

            if (userPool.RegisterUser(username, password))
            {
                FormsAuthentication.SignOut();
                FormsAuthentication.SetAuthCookie(username, false);

                Int32 userId     = userPool.GetUserId(username);
                Int32 userRoleId = userPool.GetUserRoleId(username);

                UcUserArgs args = new UcUserArgs();
                args.UserName   = username;
                args.Password   = password;
                args.UserId     = userId;
                args.UserRoleId = userRoleId;
                login(args);

                return(true);
            }

            return(false);
        }
 private void OnRemoveUserExecute()
 {
     UserPool.Remove(SelectedUser);
 }
 private void OnAddUserExecute()
 {
     UserPool.Add(new UserModel());
 }
Exemple #26
0
        /// <summary>
        /// Creates a new IRC client, but will not connect until ConnectAsync is called.
        /// </summary>
        /// <param name="serverAddress">Server address including port in the form of "hostname:port".</param>
        /// <param name="user">The IRC user to connect as.</param>
        /// <param name="useSSL">Connect with SSL if true.</param>
        public IrcClient(string serverAddress, IrcUser user, bool useSSL = false)
        {
            if (serverAddress == null) throw new ArgumentNullException("serverAddress");
            if (user == null) throw new ArgumentNullException("user");

            User = user;
            ServerAddress = serverAddress;
            Encoding = Encoding.UTF8;
            Channels = new ChannelCollection(this);
            Settings = new ClientSettings();
            Handlers = new Dictionary<string, MessageHandler>();
            MessageHandlers.RegisterDefaultHandlers(this);
            RequestManager = new RequestManager();
            UseSSL = useSSL;
            WriteQueue = new ConcurrentQueue<string>();
            ServerInfo = new ServerInfo();
            PrivmsgPrefix = "";
            Users = new UserPool();
            Users.Add(User); // Add self to user pool
        }