Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard
 
e90cb4313afcb055dc132e18d8f41b9f71370eb2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package domain;

import java.io.Serializable;
import java.util.Arrays;

import businessLogic.SecurityManager;

public class Account implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	

	private byte[] username;
	private byte[] password;
	private byte[] salt;


	private Owner owner;
	private boolean admin = false;

	
	public Account(byte[] usr){
		this.username = usr;
		this.salt =null;
		this.password = null;
		this.owner = null;
		
	}
	public Account(Owner own){
		this.username = null;
		this.salt =null;
		this.password = null;
		this.owner = own;
		
	}
	public Account(String usr, String pass, boolean isAdmin) {
		this.username = SecurityManager.getInstance().calculateHash(usr);
		this.salt = SecurityManager.getInstance().generateSalt();
		this.password = SecurityManager.getInstance().calculateSaltedHash(pass.toCharArray(), this.salt);
		this.owner = null;
		this.admin = isAdmin;

	}

	public Account(String usr, String pass, Owner ow) {
		this.username = SecurityManager.getInstance().calculateHash(usr);
		this.salt = SecurityManager.getInstance().generateSalt();
		this.password = SecurityManager.getInstance().calculateSaltedHash(pass.toCharArray(),
				this.salt);
		this.owner = ow;
		this.admin = false;

	}

	
	public byte[] getUsername() {
		return username;
	}

	public byte[] getPassword() {
		return password;
	}

	public Owner getOwner() {
		return owner;
	}

	public boolean getAdmin() {
		return admin;
	}

	public void setAdmin(boolean admin) {
		this.admin = admin;
	}

	public byte[] getSalt() {
		return salt;
	}

	public void setSalt(byte[] salt) {
		this.salt = salt;
	}
	

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Account other = (Account) obj;
		if (!Arrays.equals(username, other.username))
			return false;
		return true;
	}

}

Commits for RRRRHHHH_CoderuralHouses/src/domain/Account.java

Diff revisions: vs.
Revision Author Commited Message
e90cb4 ... Diff Diff camjan Tue 19 May, 2015 19:39:31 +0000

Owner deletion added

25898b ... Diff Diff camjan Mon 18 May, 2015 15:26:01 +0000

Account adding and deleting fixed

4f8bcc ... Diff Diff epinzolas001 Mon 18 May, 2015 09:49:54 +0000

Merge conflicts solutioned

7bf57b ... Diff Diff camjan Sun 17 May, 2015 11:59:22 +0000

Possibility of registering new owners added

0f75b2 ... Diff Diff camjan Sat 16 May, 2015 14:34:49 +0000

Username is saved hashed and password hashed and salted

2ac167 ... Diff Diff Eneko Pinzolas Murua Wed 15 Apr, 2015 13:53:44 +0000

admin completed

bd03dd ... Diff Diff camjan Tue 10 Mar, 2015 13:06:22 +0000

Administrator class created delete debbuging started

41f4d3 ... epinzolas001 Fri 27 Feb, 2015 12:55:15 +0000

Created Account class to separate identification from the Owner