view gwt-client/src/main/java/org/dive4elements/river/client/server/auth/DefaultUser.java @ 9497:d6d5ca6d4af0

Enabled logging of saml-group-name in log-ing logfile. Some cleanup/refaktoring.
author gernotbelger
date Thu, 27 Sep 2018 17:40:39 +0200
parents 7bc35bbd8b27
children
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU AGPL (>=v3)
 * and comes with ABSOLUTELY NO WARRANTY! Check out the
 * documentation coming with Dive4Elements River for details.
 */

package org.dive4elements.river.client.server.auth;

import java.util.List;

public class DefaultUser implements User {
    private final String name;
    private final String account;
    private final String password;
    private final String samlXML;
    private final boolean expired;
    private final List<String> roles;
    private final List<String> features;
    private final String userGroup;

    public DefaultUser(final String name, final String password, final String samlXML, final boolean expired, final List<String> roles,
            final List<String> features, final String userGroup) {
        this.name = name;
        this.password = password;
        this.samlXML = samlXML;
        this.expired = expired;
        this.roles = roles;
        this.features = features;
        this.account = name;
        this.userGroup = userGroup;
    }

    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public String getPassword() {
        return this.password;
    }

    @Override
    public boolean hasExpired() {
        return this.expired;
    }

    @Override
    public List<String> getRoles() {
        // XXX: return clone of the list?
        return this.roles;
    }

    public List<String> getAllowedFeatures() {
        return this.features;
    }

    @Override
    public boolean canUseFeature(final String feature) {
        return this.features.contains(feature);
    }

    @Override
    public String getAccount() {
        return this.account;
    }

    @Override
    public String getSamlXMLBase64() {
        return this.samlXML;
    }

    @Override
    public String getUserGroup() {
        return this.userGroup;
    }
}

http://dive4elements.wald.intevation.org