Debian Codegraph @

ssl-proxies/src/main/java/org/globus/gsi/gssapi/jaas/PasswordCredential.java

raw
1 /*
2 * Copyright 1999-2010 University of Chicago
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
5 * compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software distributed under the License is
10 * distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11 * express or implied.
12 *
13 * See the License for the specific language governing permissions and limitations under the License.
14 */
15 package org.globus.gsi.gssapi.jaas;
16
17 import java.io.Serializable;
18
19 public class PasswordCredential implements Serializable {
20
21 private char[] password;
22
23 public PasswordCredential(String password) {
24 this.password = password.toCharArray();
25 }
26
27 public String getPassword() {
28 return new String(this.password);
29 }
30
31 public boolean equals(Object another) {
32 if (!(another instanceof PasswordCredential)) {
33 return false;
34 }
35 String pass = ((PasswordCredential)another).getPassword();
36 if (this.password == null) {
37 return (pass == null);
38 } else {
39 return (new String(this.password)).equals(pass);
40 }
41 }
42
43 public String toString() {
44 return getPassword();
45 }
46 }