1 23 24 package javax.resource.spi.security; 25 26 import javax.resource.spi.ManagedConnectionFactory ; 27 28 38 39 public final class PasswordCredential implements java.io.Serializable { 40 41 private String userName; 42 private char[] password; 43 private ManagedConnectionFactory mcf; 44 45 55 public 56 PasswordCredential(String userName, char[] password) { 57 this.userName = userName; 58 this.password = (char[])password.clone(); 59 } 60 61 66 public 67 String getUserName() { 68 return userName; 69 } 70 71 80 public 81 char[] getPassword() { 82 return password; 83 } 84 85 93 public 94 ManagedConnectionFactory getManagedConnectionFactory() { 95 return mcf; 96 } 97 98 104 public 105 void setManagedConnectionFactory(ManagedConnectionFactory mcf) { 106 this.mcf = mcf; 107 } 108 109 118 public 119 boolean equals(Object other) { 120 if (!(other instanceof PasswordCredential )) 121 return false; 122 123 PasswordCredential pc = (PasswordCredential )other; 124 125 if (!(userName.equals(pc.userName))) 126 return false; 127 128 if (password.length != pc.password.length) 129 return false; 130 131 for (int i = 0; i < password.length;i++) { 132 if (password[i] != pc.password[i]) 133 return false; 134 } 135 136 return true; 137 } 138 139 143 public 144 int hashCode() { 145 String s = userName; 146 s += new String (password); 147 return s.hashCode(); 148 } 149 150 } 151 152 | Popular Tags |