view gwt-client/src/main/java/org/dive4elements/river/client/server/auth/saml/User.java @ 5948:d7b9b3e3c61a

Make instantiation of saml.User easier. Most of the parameters of the constructor can be taken from the Assertion object, so there's no reason to pass them separately. Also, trying to check the validity dates isn't useful for the single sign on case. See comments in the hasExpired method.
author Bernhard Herzog <bh@intevation.de>
date Wed, 08 May 2013 17:56:14 +0200
parents 0b092a1d136b
children a51adfc957bf
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.saml;

import java.util.Date;
import java.util.List;

import org.dive4elements.river.client.server.auth.DefaultUser;
import org.dive4elements.river.client.server.auth.saml.Assertion;

public class User
extends DefaultUser
implements org.dive4elements.river.client.server.auth.User {

    private Assertion assertion;

    public User(Assertion assertion, List<String> features, String password) {
        this.setName(assertion.getUserID());
        this.setAccount(assertion.getNameID());
        this.setRoles(assertion.getRoles());
        this.assertion = assertion;
        this.setAllowedFeatures(features);
        this.setPassword(password);
    }

    @Override
    public boolean hasExpired() {
        // We could check the validity dates of the assertion here, but
        // when using this for Single-Sign-On this would lead to the
        // code in GGInAFilter to re-authenticate with the password
        // stored in the User object, which isn't known in the case of
        // Single-Sign-On.
        return false;
    }
}

// vim:set ts=4 sw=4 si et fenc=utf8 tw=80:

http://dive4elements.wald.intevation.org