01: /*
02: * BEGIN_HEADER - DO NOT EDIT
03: *
04: * The contents of this file are subject to the terms
05: * of the Common Development and Distribution License
06: * (the "License"). You may not use this file except
07: * in compliance with the License.
08: *
09: * You can obtain a copy of the license at
10: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
11: * See the License for the specific language governing
12: * permissions and limitations under the License.
13: *
14: * When distributing Covered Code, include this CDDL
15: * HEADER in each file and include the License file at
16: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
17: * If applicable add the following below this CDDL HEADER,
18: * with the fields enclosed by brackets "[]" replaced with
19: * your own identifying information: Portions Copyright
20: * [year] [name of copyright owner]
21: */
22:
23: /*
24: * @(#)PasswordCredential.java
25: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
26: *
27: * END_HEADER - DO NOT EDIT
28: */
29: /**
30: * PasswordCredential.java
31: *
32: * SUN PROPRIETARY/CONFIDENTIAL.
33: * This software is the proprietary information of Sun Microsystems, Inc.
34: * Use is subject to license terms.
35: *
36: * Created on February 23, 2005, 6:36 PM
37: */package com.sun.jbi.binding.security;
38:
39: /**
40: * PrivateCredential for a Subject to encapsulate Username and Password information.
41: * Currently used only on outbound
42: *
43: * @author Sun Microsystems, Inc.
44: */
45: public class PasswordCredential {
46: /** Username. */
47: private String mUsername;
48:
49: /** Password. */
50: private String mPassword;
51:
52: /**
53: * Creates a new instance of PasswordCredential.
54: *
55: * @param username - user name
56: * @param password - password
57: */
58: public PasswordCredential(String username, String password) {
59: mUsername = username;
60: mPassword = password;
61: }
62:
63: /**
64: * @return username string
65: */
66: public String getUsername() {
67: return mUsername;
68: }
69:
70: /**
71: * @return password string
72: */
73: public String getPassword() {
74: return mPassword;
75: }
76:
77: /**
78: * @param obj Object to check for equality
79: * @return true if obj is equal to this instance.
80: */
81: public boolean equals(Object obj) {
82: if (obj instanceof PasswordCredential) {
83: PasswordCredential otherCredential = (PasswordCredential) obj;
84:
85: return (getUsername().equals(otherCredential.getUsername()) && getPassword()
86: .equals(otherCredential.getPassword()));
87: }
88: return false;
89:
90: }
91:
92: /**
93: * @return the hash code.
94: */
95: public int hashCode() {
96: return getUsername().hashCode() + getPassword().hashCode();
97: }
98:
99: }
|