1 7 8 package org.jboss.security; 9 10 11 12 18 public class CallerIdentity extends SimplePrincipal 19 { 20 21 private Object credential; 22 23 private int hashCode; 25 26 29 public CallerIdentity(String principal, Object credential) 30 { 31 super(principal); 32 this.credential = credential; 33 } 34 35 public Object getCredential() 36 { 37 return credential; 38 } 39 40 44 public String toString() 45 { 46 return "[principal=" + getName() + "]"; 47 } 48 49 52 public boolean equals(Object obj) 53 { 54 if (obj == null) return false; 55 if (obj instanceof CallerIdentity) 56 { 57 CallerIdentity other = (CallerIdentity)obj; 58 return getName().equals(other.getName()); 59 } 60 return false; 61 } 62 63 66 public int hashCode() 67 { 68 if (hashCode == 0) 69 { 70 hashCode = toString().hashCode(); 71 } 72 return hashCode; 73 } 74 } 75 | Popular Tags |