All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.evasion.sam.jaas.EvasionPrincipal Maven / Gradle / Ivy

There is a newer version: 2.0.0.2
Show newest version
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.evasion.sam.jaas;

import java.io.Serializable;
import java.security.Principal;
import java.util.Date;

/**
 *
 * @author sebastien
 */
public class EvasionPrincipal implements Principal, Serializable {

    private static final long serialVersionUID = -4116057474613606287L;
    private String name;
    private Date lastLogin;

    public EvasionPrincipal(String name) {
        super();
        this.name = name;
    }

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

    public Date getLastLogin() {
        return new Date(this.lastLogin.getTime());
    }

    public void setLastLogin(Date lastLogin) {
        if (lastLogin != null) {
            this.lastLogin = new Date(lastLogin.getTime());
        }
    }

    /**
     * {@inheritDoc }
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((name == null) ? 0 : name.hashCode());
        return result;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final EvasionPrincipal other = (EvasionPrincipal) obj;
        if (name == null) {
            if (other.name != null) {
                return false;
            }
        } else if (!name.equals(other.name)) {
            return false;
        }
        return true;
    }

    public String toString() {
        return EvasionPrincipal.class.getName() + ": " + getName();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy