public async Task PostLogin()

in MonolithicApplication/src/Controllers/UserController.cs [91:126]


        public async Task<IHttpActionResult> PostLogin([FromBody] user login)
        {
            var search = from u in this.unishopEntitiesContext.users
                               where u.email == login.email
                               select u;

            if (search.Count() == 0)
            {
                return this.NotFound();
            }

            var user = search.First();

            byte[] hashBytes = Convert.FromBase64String(user.password);

            byte[] salt = new byte[16];
            Array.Copy(hashBytes, 0, salt, 0, 16);
            var pbkdf2 = new Rfc2898DeriveBytes(login.password, salt, 10000);
            byte[] hash = pbkdf2.GetBytes(20);

            bool match = true;
            for (int i = 0; i < 20; i++)
            {
                if (hashBytes[i + 16] != hash[i])
                {
                    match = false;
                }
            }

            if (!match)
            {
                return this.BadRequest();
            }

            return this.Ok(user);
        }