1 22 package org.jboss.security.srp; 23 24 import java.io.Serializable ; 25 26 30 public class SRPSessionKey implements Serializable 31 { 32 private static final long serialVersionUID = -7783783206948014409L; 33 public static final Integer NO_SESSION_ID = new Integer (0); 34 private String username; 35 private int sessionID; 36 37 public SRPSessionKey(String username) 38 { 39 this(username, NO_SESSION_ID); 40 } 41 public SRPSessionKey(String username, int sessionID) 42 { 43 this.username = username; 44 this.sessionID = sessionID; 45 } 46 public SRPSessionKey(String username, Integer sessionID) 47 { 48 this.username = username; 49 if( sessionID != null ) 50 this.sessionID = sessionID.intValue(); 51 } 52 53 public boolean equals(Object obj) 54 { 55 SRPSessionKey key = (SRPSessionKey) obj; 56 return this.username.equals(key.username) && this.sessionID == key.sessionID; 57 } 58 59 public int hashCode() 60 { 61 return this.username.hashCode() + this.sessionID; 62 } 63 64 public int getSessionID() 65 { 66 return sessionID; 67 } 68 69 public String getUsername() 70 { 71 return username; 72 } 73 74 public String toString() 75 { 76 return "{username="+username+", sessionID="+sessionID+"}"; 77 } 78 } 79 | Popular Tags |