1 22 package org.jboss.security.srp.jaas; 23 24 import org.jboss.security.SimplePrincipal; 25 26 31 public class SRPPrincipal extends SimplePrincipal 32 { 33 34 static final long serialVersionUID = -7123071794402068344L; 35 36 private int sessionID; 37 38 39 public SRPPrincipal(String name) 40 { 41 this(name, 0); 42 } 43 public SRPPrincipal(String name, int sessionID) 44 { 45 super(name); 46 this.sessionID = sessionID; 47 } 48 public SRPPrincipal(String name, Integer sessionID) 49 { 50 super(name); 51 this.sessionID = sessionID != null ? sessionID.intValue() : 0; 52 } 53 54 public int getSessionID() 55 { 56 return sessionID; 57 } 58 59 64 public boolean equals(Object obj) 65 { 66 SRPPrincipal p = (SRPPrincipal) obj; 67 return getName().equals(p.getName()) && sessionID == getSessionID(); 68 } 69 73 public int hashCode() 74 { 75 return getName().hashCode() + sessionID; 76 } 77 } 78 | Popular Tags |