package org.jboss.security;
public class CallerIdentity extends SimplePrincipal
{
private Object credential;
private int hashCode;
public CallerIdentity(String principal, Object credential)
{
super(principal);
this.credential = credential;
}
public Object getCredential()
{
return credential;
}
public String toString()
{
return "[principal=" + getName() + "]";
}
public boolean equals(Object obj)
{
if (obj == null) return false;
if (obj instanceof CallerIdentity)
{
CallerIdentity other = (CallerIdentity)obj;
return getName().equals(other.getName());
}
return false;
}
public int hashCode()
{
if (hashCode == 0)
{
hashCode = toString().hashCode();
}
return hashCode;
}
}