1 17 18 package org.apache.geronimo.security; 19 20 import java.io.Serializable ; 21 import java.security.Principal ; 22 23 24 27 public class IdentificationPrincipal implements Principal , Serializable { 28 private final SubjectId id; 29 private transient String name; 30 31 public IdentificationPrincipal(SubjectId id) { 32 this.id = id; 33 } 34 35 public SubjectId getId() { 36 return id; 37 } 38 39 48 public boolean equals(Object another) { 49 if (!(another instanceof IdentificationPrincipal)) return false; 50 51 IdentificationPrincipal idPrincipal = (IdentificationPrincipal) another; 52 53 return id.equals(idPrincipal.id); 54 } 55 56 61 public String toString() { 62 return getName(); 63 } 64 65 70 public int hashCode() { 71 return getName().hashCode(); 72 } 73 74 79 public String getName() { 80 if (name == null) { 81 82 StringBuffer buffer = new StringBuffer (""); 83 buffer.append(getClass().getName()); 84 buffer.append("["); 85 buffer.append(id); 86 buffer.append("]"); 87 88 name = buffer.toString(); 89 } 90 return name; 91 } 92 } 93 | Popular Tags |