-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathC0nanPrincipal.java
More file actions
64 lines (53 loc) · 1.45 KB
/
C0nanPrincipal.java
File metadata and controls
64 lines (53 loc) · 1.45 KB
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
package net.c0nan.authentication;
import java.io.Serializable;
import java.security.Principal;
import java.security.acl.Group;
/**
* @author: c0nan
*
*/
public class C0nanPrincipal implements Principal, Serializable {
private static final long serialVersionUID = 123L;
private final String name;
private final String displayName;
private final String emailAddress;
private Group[] groups;
public C0nanPrincipal(String name, String displayName,String emailAddress,Group[] groups) {
this.name = name;
this.displayName = displayName;
this.groups = groups;
this.emailAddress = emailAddress;
}
@Override
public boolean equals(Object another) {
if (!(another instanceof Principal))
return false;
String anotherName = ((Principal) another).getName();
boolean equals = false;
if (name == null)
equals = anotherName == null;
else
equals = name.equals(anotherName);
return equals;
}
@Override
public int hashCode() {
return (name == null ? 0 : name.hashCode());
}
@Override
public String toString() {
return name;
}
public String getName() {
return name;
}
public String getDisplayName() {
return displayName;
}
public String getEmailAddress() {
return emailAddress;
}
public Group[] getGroups() {
return groups;
}
}