001/*
002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Vladimir Pasquier <vpasquier@nuxeo.com>
018 */
019
020package org.nuxeo.shibboleth.invitation;
021
022import java.util.Set;
023
024import org.apache.commons.lang3.StringUtils;
025import org.nuxeo.ecm.platform.api.login.UserIdentificationInfo;
026
027/**
028 * @since 7.4
029 */
030public class ShibbolethUserInfo extends UserIdentificationInfo {
031
032    private static final long serialVersionUID = 6894397878763275157L;
033
034    protected String firstName;
035
036    protected String lastName;
037
038    protected String company;
039
040    protected Set<String> roles;
041
042    private ShibbolethUserInfo(String emailAsUserName, String password) {
043        super(emailAsUserName, password);
044    }
045
046    public ShibbolethUserInfo(String emailAsUserName, String password, String firstName, String lastName, String company) {
047        super(emailAsUserName, password);
048
049        if (emailAsUserName == null || StringUtils.isEmpty(emailAsUserName)) {
050            throw new IllegalStateException("A valid username should always be provided");
051        }
052
053        this.firstName = firstName;
054        this.lastName = lastName;
055        this.company = company;
056    }
057
058    public String getFirstName() {
059        return firstName;
060    }
061
062    public String getLastName() {
063        return lastName;
064    }
065
066    public String getCompany() {
067        return company;
068    }
069
070    public Set<String> getRoles() {
071        return roles;
072    }
073
074    public void setRoles(Set<String> roles) {
075        this.roles = roles;
076    }
077
078}