Example #1
0
    public void Construct(
        PlayerPrefPasswordDerivation playerPrefPasswordDerivation,
        UserWalletManager userWalletManager,
        HopeWalletInfoManager hopeWalletInfoManager,
        WalletPasswordVerification walletPasswordVerification,
        ContactsManager contactsManager,
        DynamicDataCache dynamicDataCache,
        ButtonClickObserver buttonClickObserver,
        CurrencyManager currencyManager,
        LogoutHandler logoutHandler)
    {
        this.playerPrefPasswordDerivation = playerPrefPasswordDerivation;
        this.userWalletManager            = userWalletManager;
        this.hopeWalletInfoManager        = hopeWalletInfoManager;
        this.walletPasswordVerification   = walletPasswordVerification;
        this.contactsManager     = contactsManager;
        this.dynamicDataCache    = dynamicDataCache;
        this.buttonClickObserver = buttonClickObserver;
        this.currencyManager     = currencyManager;
        this.logoutHandler       = logoutHandler;

        buttonClickObserver.SubscribeObservable(this);
        defaultCurrencyOptions.ButtonClicked((int)currencyManager.ActiveCurrency);

        walletName = hopeWalletInfoManager.GetWalletInfo(userWalletManager.GetWalletAddress()).WalletName;

        deleteWalletButton.onClick.AddListener(() => popupManager.GetPopup <GeneralOkCancelPopup>(true)
                                               .SetSubText($"Are you sure you want to delete wallet '{walletName}'?\nThis cannot be undone!")
                                               .OnOkClicked(() => DeleteWallet(userWalletManager, hopeWalletInfoManager, logoutHandler))
                                               .DisableEnterButton());
    }
        public async Task SetUp()
        {
            var dbContextOptions = new DbContextOptionsBuilder <LoginContext>()
                                   .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString())
                                   .Options;

            _loginContext = new LoginContext(dbContextOptions);
            _loginContext.Clients.Add(new Data.Entities.Client()
            {
                IdentityServerClientId = "mvc", ServiceDetails = new ServiceDetails {
                    ServiceName = "Acme Service", SupportUrl = "https://acme.gov.uk/Support"
                }
            });
            await _loginContext.SaveChangesAsync();

            _interactionService = Substitute.For <IIdentityServerInteractionService>();
            _interactionService.GetLogoutContextAsync("logoutid").Returns(new IdentityServer4.Models.LogoutRequest("iframeurl", new LogoutMessage())
            {
                ClientId = "mvc", PostLogoutRedirectUri = "https://postlogouturi"
            });

            _userService = Substitute.For <IUserService>();

            var principal = new TestPrincipal(new Claim(JwtClaimTypes.Subject, "user123"));

            _eventService = Substitute.For <IEventService>();

            _httpContextAccessor = Substitute.For <IHttpContextAccessor>();
            _httpContextAccessor.HttpContext.User.Returns(principal);

            _handler = new LogoutHandler(_interactionService, _loginContext, _userService, _eventService, _httpContextAccessor);
        }
 public void Construct(
     EthereumTransactionManager ethereumTransactionManager,
     EthereumNetworkManager.Settings ethereumNetworkSettings,
     EthereumPendingTransactionManager ethereumPendingTransactionManager,
     TokenContractManager tokenContractManager,
     TradableAssetManager tradableAssetManager,
     TradableAssetPriceManager tradableAssetPriceManager,
     TradableAssetNotificationManager notificationManager,
     LockedPRPSManager lockedPrpsManager,
     PRPS prpsContract,
     CurrencyManager currencyManager,
     HopeWalletInfoManager hopeWalletInfoManager,
     UserWalletManager userWalletManager,
     LogoutHandler logoutHandler)
 {
     this.ethereumNetworkSettings           = ethereumNetworkSettings;
     this.ethereumTransactionManager        = ethereumTransactionManager;
     this.ethereumPendingTransactionManager = ethereumPendingTransactionManager;
     this.tokenContractManager      = tokenContractManager;
     this.tradableAssetManager      = tradableAssetManager;
     this.tradableAssetPriceManager = tradableAssetPriceManager;
     this.notificationManager       = notificationManager;
     this.lockedPrpsManager         = lockedPrpsManager;
     this.prpsContract          = prpsContract;
     this.currencyManager       = currencyManager;
     this.hopeWalletInfoManager = hopeWalletInfoManager;
     this.userWalletManager     = userWalletManager;
     this.logoutHandler         = logoutHandler;
 }
Example #4
0
        static void Main(string[] args)
        {
            XmlConfigurator.Configure();
            try
            {
                ThreadPool.SetMinThreads(32, 1024);

                var statePersister = new StatePersister();

                AuthController    authController    = new AuthController(StatePersister.LoadUsers(), statePersister);
                ElectroController electroController = new ElectroController(StatePersister.LoadElections(), StatePersister.LoadKeys(), authController, statePersister);

                var staticHandler = new StaticHandler(GetPrefix(null), Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "web"));
                staticHandler.Start();

                var registerHandler = new RegisterHandler(authController, GetPrefix("register"));
                registerHandler.Start();

                var loginHandler = new LoginHandler(authController, GetPrefix("login"));
                loginHandler.Start();

                var logoutHandler = new LogoutHandler(authController, GetPrefix("logout"));
                logoutHandler.Start();

                var startElectionHandler = new StartElectionHandler(electroController, authController, GetPrefix("startElection"));
                startElectionHandler.Start();

                var listElectionsHandler = new ListElectionsHandler(electroController, authController, GetPrefix("listElections"));
                listElectionsHandler.Start();

                var findElectionHandler = new FindElectionHandler(electroController, authController, GetPrefix("findElection"));
                findElectionHandler.Start();

                var nominateHandler = new NominateHandler(electroController, authController, GetPrefix("nominate"));
                nominateHandler.Start();

                var voteHandler = new VoteHandler(electroController, authController, GetPrefix("vote"));
                voteHandler.Start();

                while (true)
                {
                    Thread.Sleep(electionsSnapshotTimeoutMs);
                    try
                    {
                        log.Info("Saving elections snapshot");
                        StatePersister.SaveAllElections(electroController.DumpElections().Reverse());
                        log.Info("Elections snapshot saved");
                    }
                    catch (Exception e)
                    {
                        log.Error("Failed to save elections snapshot. Sleeping and retrying", e);
                    }
                }
            }
            catch (Exception e)
            {
                log.Fatal(e);
            }
        }
Example #5
0
    public void Construct(LogoutHandler logoutHandler, PopupManager popupManager)
    {
        this.logoutHandler = logoutHandler;
        this.popupManager  = popupManager;

        openWalletMenuAnimator.ResetGameObjects += () =>
        {
            if (dropdownOpen)
            {
                ToggleDropdown();
            }
        };
    }
Example #6
0
    void Start()
    {
        m_RegisterationPanel.SetActive(false);
        m_LoginHandler    = new LoginHandler(LoginResponse);
        m_RegisterHandler = new RegisterHandler(RegisterationResponse);
        m_SessionHandler  = new SessionHandler(SessionResponse);
        m_LogoutHandler   = new LogoutHandler(LogoutResponse);

        if (CookiesManager.Instance.HasCookie(CookiesManager.UNICORN))
        {
            LoadingWindowUI.Instance.Register(this);
            m_SessionHandler.Session();
        }
    }
Example #7
0
    public void Construct(
        HopeWalletInfoManager hopeWalletInfoManager,
        UserWalletManager userWalletManager,
        WalletPasswordVerification walletPasswordVerification,
        LogoutHandler logoutHandler,
        DynamicDataCache dynamicDataCache,
        ButtonClickObserver buttonClickObserver)
    {
        this.walletPasswordVerification = walletPasswordVerification;
        this.logoutHandler       = logoutHandler;
        this.dynamicDataCache    = dynamicDataCache;
        this.buttonClickObserver = buttonClickObserver;

        walletName     = hopeWalletInfoManager.GetWalletInfo(userWalletManager.GetWalletAddress()).WalletName;
        formTitle.text = walletName;

        SetMessageText();

        (dynamicDataCache.GetData("pass") as ProtectedString)?.SetValue(RandomBytes.Secure.SHA3.GetBytes(16));
    }
Example #8
0
    private void DeleteWallet(UserWalletManager userWalletManager, HopeWalletInfoManager hopeWalletInfoManager, LogoutHandler logoutHandler)
    {
        var wallets        = hopeWalletInfoManager.Wallets;
        var walletToDelete = hopeWalletInfoManager.GetWalletInfo(userWalletManager.GetWalletAddress());

        for (int i = wallets.IndexOf(walletToDelete) + 1; i < wallets.Count; i++)
        {
            hopeWalletInfoManager.UpdateWalletInfo(wallets[i].WalletNum, new WalletInfo(wallets[i].EncryptedWalletData, wallets[i].WalletName, wallets[i].WalletAddresses, wallets[i].WalletNum - 1));
        }

        hopeWalletInfoManager.DeleteWalletInfo(walletToDelete);
        logoutHandler.Logout();
    }
Example #9
0
        public void Logout()
        {
            string signoutUrl = new LogoutHandler().Signout();

            Response.Redirect(signoutUrl);
        }
 public void SetUp()
 {
     _sut = new LogoutHandler();
 }