Line | |
---|
1 | package clarin.cmdi.componentregistry.model; |
---|
2 | |
---|
3 | import clarin.cmdi.componentregistry.UserCredentials; |
---|
4 | import javax.xml.bind.annotation.XmlElement; |
---|
5 | import javax.xml.bind.annotation.XmlRootElement; |
---|
6 | |
---|
7 | /** |
---|
8 | * |
---|
9 | * @author Twan Goosen <twan.goosen@mpi.nl> |
---|
10 | */ |
---|
11 | @XmlRootElement |
---|
12 | public class AuthenticationInfo { |
---|
13 | |
---|
14 | @XmlElement |
---|
15 | private boolean authenticated; |
---|
16 | @XmlElement |
---|
17 | private String username; |
---|
18 | @XmlElement |
---|
19 | private String displayName; |
---|
20 | @XmlElement |
---|
21 | private boolean isAdmin; |
---|
22 | |
---|
23 | public AuthenticationInfo() { |
---|
24 | } |
---|
25 | |
---|
26 | public AuthenticationInfo(boolean authenticated) { |
---|
27 | this.authenticated = authenticated; |
---|
28 | } |
---|
29 | |
---|
30 | public AuthenticationInfo(UserCredentials userInfo, boolean isAdmin) { |
---|
31 | this.authenticated = (userInfo != null); |
---|
32 | if (userInfo != null) { |
---|
33 | this.username = userInfo.getPrincipalName(); |
---|
34 | this.displayName = userInfo.getDisplayName(); |
---|
35 | this.isAdmin = isAdmin; |
---|
36 | } |
---|
37 | } |
---|
38 | |
---|
39 | public String getUsername() { |
---|
40 | return username; |
---|
41 | } |
---|
42 | |
---|
43 | public String getDisplayName() { |
---|
44 | return displayName; |
---|
45 | } |
---|
46 | |
---|
47 | public boolean isAuthenticated() { |
---|
48 | return authenticated; |
---|
49 | } |
---|
50 | |
---|
51 | public boolean isIsAdmin() { |
---|
52 | return isAdmin; |
---|
53 | } |
---|
54 | |
---|
55 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.