예제 #1
0
        public User(string email, string name, string password, IHashProvider hashProvider)
        {
            if (hashProvider == null)
            {
                throw new ArgumentException(nameof(hashProvider));
            }

            var(hash, salt) = hashProvider.HashPassword(password);

            Email           = email ?? throw new ArgumentException(nameof(email));
            NormalizedEmail = email.ToLower();
            Name            = name ?? throw new ArgumentException(nameof(name));
            PasswordHash    = hash;
            Salt            = salt;
        }