com.evasion.sam.jaas.EvasionPrincipal Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of evasion-sam-modul Show documentation
Show all versions of evasion-sam-modul Show documentation
API de l'application modulaire evasion-en-ligne
/*
* 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();
}
}