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    protected String email;
043
044    private ShibbolethUserInfo(String emailAsUserName, String password) {
045        super(emailAsUserName, password);
046    }
047
048    public ShibbolethUserInfo(String username, String password, String firstName, String lastName, String company, String email) {
049        super(username, password);
050
051        if (username == null || StringUtils.isEmpty(username)) {
052            throw new IllegalStateException("A valid username should always be provided");
053        }
054
055        this.firstName = firstName;
056        this.lastName = lastName;
057        this.company = company;
058        this.email = email;
059    }
060
061    public String getFirstName() {
062        return firstName;
063    }
064
065    public String getLastName() {
066        return lastName;
067    }
068
069    public String getCompany() {
070        return company;
071    }
072
073    public String getEmail() {
074        return email;
075    }
076
077    public Set<String> getRoles() {
078        return roles;
079    }
080
081    public void setRoles(Set<String> roles) {
082        this.roles = roles;
083    }
084
085}