1 45 package org.exolab.jms.common.security; 46 47 import java.io.Serializable ; 48 import java.security.Principal ; 49 50 51 57 public class BasicPrincipal implements Principal , Serializable { 58 59 62 private String _name; 63 64 67 private String _password; 68 69 72 static final long serialVersionUID = 1; 73 74 75 81 public BasicPrincipal(String name, String password) { 82 if (name == null) { 83 throw new IllegalArgumentException ("Argument 'name' is null"); 84 } 85 if (password == null) { 86 throw new IllegalArgumentException ("Argument 'password' is null"); 87 } 88 _name = name; 89 _password = password; 90 } 91 92 97 public String getName() { 98 return _name; 99 } 100 101 106 public String getPassword() { 107 return _password; 108 } 109 110 117 public boolean equals(Object another) { 118 boolean equal = (this == another); 119 if (!equal && another instanceof BasicPrincipal) { 120 BasicPrincipal other = (BasicPrincipal) another; 121 if (_name.equals(other.getName()) 122 && _password.equals(other.getPassword())) { 123 equal = true; 124 } 125 } 126 return equal; 127 } 128 129 134 public int hashCode() { 135 return _name.hashCode(); 136 } 137 138 } 139 | Popular Tags |