internal bool Authenticate(Func<bool, AuthenticationPrompt> knowsUserPassword)
        {
            // don't prompt user third time for password when upgrading passwords from v2
            if (this.isAuthenticated)
                return true;

            var authentication = new AuthenticationSequence(this.IsMasterPasswordValid, knowsUserPassword);
            this.isAuthenticated = authentication.AuthenticateIfRequired();
            if (this.isAuthenticated)
              this.persistence.Initialize();

            return this.isAuthenticated;
        }
        internal PasswordsV2Update(Func<bool, AuthenticationPrompt> knowsUserPassword)
        {
            // we cant use PersistenceSecurity, because it already works on new PasswordFunctions2 methods
            var authentication = new AuthenticationSequence(this.IsMasterPasswordValid, knowsUserPassword);
            this.isAuthenticated = authentication.AuthenticateIfRequired();
            if (!this.isAuthenticated)
            {
                const string MESSAGE = "Application was not able to upgrade your passwords to version 2, because your master password isn't valid.";
                throw new SecurityAccessDeniedException(MESSAGE);
            }

            this.CheckEmptyMasterPassword();
        }
Exemplo n.º 3
0
        internal bool Authenticate(Func <bool, AuthenticationPrompt> knowsUserPassword)
        {
            // don't prompt user third time for password when upgrading passwords from v2
            if (this.isAuthenticated)
            {
                return(true);
            }

            var authentication = new AuthenticationSequence(this.IsMasterPasswordValid, knowsUserPassword);

            this.isAuthenticated = authentication.AuthenticateIfRequired();
            return(this.isAuthenticated);
        }