commit | author | age
|
2a4fb8
|
1 |
/* |
U |
2 |
http-realm - Authentication Extensions to jdk.httpserver |
|
3 |
Copyright (C) 2021 Ulrich Hilger |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Affero General Public License as |
|
7 |
published by the Free Software Foundation, either version 3 of the |
|
8 |
License, or (at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU Affero General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU Affero General Public License |
|
16 |
along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
package de.uhilger.httpserver.auth.realm; |
|
19 |
|
|
20 |
/** |
9aedc9
|
21 |
* Ein Nutzer im Kontext dieser Package |
U |
22 |
* |
2a4fb8
|
23 |
* @author Ulrich Hilger |
U |
24 |
* @version 1, 22.05.2021 |
|
25 |
*/ |
|
26 |
public class User { |
|
27 |
private String name; |
|
28 |
private String password; |
|
29 |
|
9aedc9
|
30 |
/** |
U |
31 |
* Den Namen des Nutzers ermitteln |
|
32 |
* @return Name des Nutzers |
|
33 |
*/ |
2a4fb8
|
34 |
public String getName() { |
U |
35 |
return name; |
|
36 |
} |
|
37 |
|
9aedc9
|
38 |
/** |
U |
39 |
* Den Namen des Nutzers setzen |
|
40 |
* @param name Name des Nutzers |
|
41 |
*/ |
2a4fb8
|
42 |
public void setName(String name) { |
U |
43 |
this.name = name; |
|
44 |
} |
|
45 |
|
9aedc9
|
46 |
/** |
U |
47 |
* Das Kennwort des Nutzers ermitteln |
|
48 |
* @return Kennwort des Nutzers |
|
49 |
*/ |
2a4fb8
|
50 |
public String getPassword() { |
U |
51 |
return password; |
|
52 |
} |
|
53 |
|
9aedc9
|
54 |
/** |
U |
55 |
* Das Kennwort des Nutzers setzen |
|
56 |
* @param password das Kennwort des Nutzers |
|
57 |
*/ |
2a4fb8
|
58 |
public void setPassword(String password) { |
U |
59 |
this.password = password; |
|
60 |
} |
|
61 |
|
9aedc9
|
62 |
/** |
U |
63 |
* Den Hashcode dieses Objekts ermitteln |
|
64 |
* @return den Hashcode |
|
65 |
*/ |
2a4fb8
|
66 |
@Override |
U |
67 |
public int hashCode() { |
|
68 |
return this.getName().hashCode(); |
|
69 |
} |
|
70 |
|
9aedc9
|
71 |
/** |
U |
72 |
* Dieses Objekt mit einem anderen Objekt vergleichen |
|
73 |
* @param obj das Objekt, mit dem dieses Objekt verglichen werden soll |
|
74 |
* @return true, wenn die Objekte gleich sind, false, wenn nicht |
|
75 |
*/ |
2a4fb8
|
76 |
@Override |
U |
77 |
public boolean equals(Object obj) { |
|
78 |
if(obj instanceof User) { |
|
79 |
return this.getName().equals(((User) obj).getName()); |
|
80 |
} else { |
|
81 |
return false; |
|
82 |
} |
|
83 |
} |
|
84 |
|
|
85 |
} |