Example #1
0
        public static Account New(string username, HashedPassword password, IEnumerable <AccessPriviledge> priviledges)
        {
            CheckUsernameValidity(username);
            CheckPasswordValidity(password);
            CheckPriviledgesValidity(priviledges);

            return(new Account(null, username, password, priviledges));
        }
Example #2
0
 private Account(
     Identity identity,
     string username,
     HashedPassword password,
     IEnumerable <AccessPriviledge> priviledges)
 {
     Identity     = identity;
     Username     = username;
     Password     = password;
     _Priviledges = priviledges.ToList();
 }
Example #3
0
 private static void CheckPasswordValidity(HashedPassword password)
 {
     if (password == null)
     {
         throw new AccessDomainViolationException("Password is null.");
     }
     if (password.Salt.Length == 0)
     {
         throw new AccessDomainViolationException("Password salt has no value.");
     }
     if (password.Value.Length == 0)
     {
         throw new AccessDomainViolationException("Password has no value.");
     }
 }
Example #4
0
 public void ChangePassword(HashedPassword newPassword)
 {
     CheckPasswordValidity(newPassword);
     Password = newPassword;
 }
Example #5
0
 public static Account Existing(Identity identity, string username, HashedPassword password, IEnumerable <AccessPriviledge> priviledges)
 {
     return(new Account(identity, username, password, priviledges));
 }