source: ComponentRegistry/branches/ComponentRegistry-2.0/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/model/AuthenticationInfo.java @ 6860

Last change on this file since 6860 was 6860, checked in by Twan Goosen, 9 years ago

auth info: isAdmin

File size: 1.2 KB
Line 
1package clarin.cmdi.componentregistry.model;
2
3import clarin.cmdi.componentregistry.UserCredentials;
4import javax.xml.bind.annotation.XmlElement;
5import javax.xml.bind.annotation.XmlRootElement;
6
7/**
8 *
9 * @author Twan Goosen <twan.goosen@mpi.nl>
10 */
11@XmlRootElement
12public 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.