3 import java.util.Arrays;
5 import businessLogic.SecurityManager;
11 private byte[] username;
12 private byte[] password;
16 private boolean admin = false;
19 public Account(String usr){
20 this.username = SecurityManager.getInstance().calculateHash(usr);
26 public Account(String usr, String pass, boolean isAdmin) {
27 this.username = SecurityManager.getInstance().calculateHash(usr);
28 this.salt = SecurityManager.getInstance().generateSalt();
29 this.password = SecurityManager.getInstance().calculateSaltedHash(pass.toCharArray(), this.salt);
35 public Account(String usr, String pass, Owner ow) {
36 this.username = SecurityManager.getInstance().calculateHash(usr);
37 this.salt = SecurityManager.getInstance().generateSalt();
38 this.password = SecurityManager.getInstance().calculateSaltedHash(pass.toCharArray(),
45 public byte[] getUsername() {
49 public byte[] getPassword() {
53 public Owner getOwner() {
57 public boolean getAdmin() {
61 public void setAdmin(boolean admin) {
65 public byte[] getSalt() {
69 public void setSalt(byte[] salt) {
75 public boolean equals(Object obj) {
80 if (getClass() != obj.getClass())
82 Account other = (Account) obj;
83 if (!Arrays.equals(password, other.password))
85 if (!Arrays.equals(username, other.username))