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

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

Added new GET method /authentication for retrieving current auth state

File size: 1.1 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
21    public AuthenticationInfo() {
22    }
23
24    public AuthenticationInfo(boolean authenticated) {
25        this.authenticated = authenticated;
26    }
27
28    public AuthenticationInfo(UserCredentials userInfo) {
29        this.authenticated = (userInfo != null);
30        if (userInfo != null) {
31            this.username = userInfo.getPrincipalName();
32            this.displayName = userInfo.getDisplayName();
33        }
34    }
35
36    public String getUsername() {
37        return username;
38    }
39
40    public String getDisplayName() {
41        return displayName;
42    }
43
44    public boolean isAuthenticated() {
45        return authenticated;
46    }
47
48}
Note: See TracBrowser for help on using the repository browser.