public static Account New(string username, HashedPassword password, IEnumerable <AccessPriviledge> priviledges) { CheckUsernameValidity(username); CheckPasswordValidity(password); CheckPriviledgesValidity(priviledges); return(new Account(null, username, password, priviledges)); }
private Account( Identity identity, string username, HashedPassword password, IEnumerable <AccessPriviledge> priviledges) { Identity = identity; Username = username; Password = password; _Priviledges = priviledges.ToList(); }
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."); } }
public void ChangePassword(HashedPassword newPassword) { CheckPasswordValidity(newPassword); Password = newPassword; }
public static Account Existing(Identity identity, string username, HashedPassword password, IEnumerable <AccessPriviledge> priviledges) { return(new Account(identity, username, password, priviledges)); }