001/*
002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl-2.1.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Vladimir Pasquier <vpasquier@nuxeo.com>
016 */
017
018package org.nuxeo.shibboleth.invitation;
019
020import java.util.Set;
021
022import org.apache.commons.lang3.StringUtils;
023import org.nuxeo.ecm.platform.api.login.UserIdentificationInfo;
024
025/**
026 * @since 7.4
027 */
028public class ShibbolethUserInfo extends UserIdentificationInfo {
029
030    private static final long serialVersionUID = 6894397878763275157L;
031
032    protected String firstName;
033
034    protected String lastName;
035
036    protected String company;
037
038    protected Set<String> roles;
039
040    private ShibbolethUserInfo(String emailAsUserName, String password) {
041        super(emailAsUserName, password);
042    }
043
044    public ShibbolethUserInfo(String emailAsUserName, String password, String firstName, String lastName, String company) {
045        super(emailAsUserName, password);
046
047        if (emailAsUserName == null || StringUtils.isEmpty(emailAsUserName)) {
048            throw new IllegalStateException("A valid username should always be provided");
049        }
050
051        this.firstName = firstName;
052        this.lastName = lastName;
053        this.company = company;
054    }
055
056    public String getFirstName() {
057        return firstName;
058    }
059
060    public String getLastName() {
061        return lastName;
062    }
063
064    public String getCompany() {
065        return company;
066    }
067
068    public Set<String> getRoles() {
069        return roles;
070    }
071
072    public void setRoles(Set<String> roles) {
073        this.roles = roles;
074    }
075
076}