public bool Verify(string accountId, string password, string otp)
        {
            var passwordFromDb = _profile.GetPassword(accountId);

            var hashedPassword = _hash.ComputeHash(password);

            var currentOtp = _otpService.GetCurrentOtp(accountId);

            return(hashedPassword == passwordFromDb && otp == currentOtp);
        }
示例#2
0
        public bool Verify(string accountId, string inputPassword, string otp)
        {
            var password     = _Profile.GetPassword(accountId);
            var hashPassword = _Hash.ComputeHash(inputPassword);
            var currentOpt   = _OtpService.GetOpt(accountId);

            if (hashPassword != password || currentOpt != otp)
            {
                //_LogFailedCounterDecorator.LogFailedCount(accountId);
                return(false);
            }
            return(true);
        }
示例#3
0
        public bool Verify(string accountId, string password, string otp)
        {
            var passwordFromDb = _ProfileDao.GetPassword(accountId);

            var hashedPassword = _Hash.ComputeHash(password);

            var currentOtp = _Otp.GetOtp(accountId);

            if (passwordFromDb == hashedPassword && otp == currentOtp)
            {
                return(true);
            }

            return(false);
        }
示例#4
0
        /// <summary>
        /// sets properties with generated values (only if they have not )
        /// </summary>
        protected void Compile(IndexEntry indexEntry)
        {
            if (string.IsNullOrEmpty(indexEntry.DesignDocument) && indexEntry.Type != null)
            {
                indexEntry.DesignDocument = indexEntry.Type.GetTypeInfo().FullName;
            }

            if (string.IsNullOrEmpty(indexEntry.Name))
            {
                var entries = indexEntry.Index.Fields.Select(x =>
                {
                    var entry = x.First();
                    return($"{entry.Key}.{entry.Value}");
                });

                indexEntry.Name = _hash.ComputeHash(string.Join("-", entries));
            }
        }
示例#5
0
        public Negotiator Get <TReq, TRes>(TReq requestModel) where TReq : IRequest <TRes>
        {
            var response = _delegate.Get <TReq, TRes>(requestModel);

            response.WithHeader("Cache-Control", "public, max-age=600");
            var serialized = (string)JsonConvert.SerializeObject(response.NegotiationContext.DefaultModel);
            var hashString = _hasher.ComputeHash(serialized);

            if (!string.IsNullOrEmpty(RequestETag) && hashString == RequestETag)
            {
                return(response
                       .WithModel(null)
                       .WithStatusCode(HttpStatusCode.NotModified));
            }

            return(response
                   .WithHeader("ETag", hashString));
        }
 private void GivenHash(string password, string hashedPassword)
 {
     _Hash.ComputeHash(password).Returns(hashedPassword);
 }
示例#7
0
 private void GivenHash(string inputPassword, string hashedPassword)
 {
     _hash.ComputeHash(inputPassword).Returns(hashedPassword);
 }