01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.security.realm.providers;
17:
18: import java.io.Serializable;
19: import java.util.Arrays;
20:
21: import javax.security.auth.DestroyFailedException;
22: import javax.security.auth.Destroyable;
23:
24: /**
25: * @version $Rev: 599041 $ $Date: 2007-11-28 07:58:50 -0800 (Wed, 28 Nov 2007) $
26: */
27: public class GeronimoPasswordCredential implements Destroyable,
28: Serializable {
29:
30: private String userName;
31: private char[] password;
32: private boolean destroyed;
33:
34: public GeronimoPasswordCredential(String userName, char[] password) {
35: assert userName != null;
36: assert password != null;
37:
38: this .userName = userName;
39: this .password = password.clone();
40: }
41:
42: public String getUserName() {
43: return userName;
44: }
45:
46: public char[] getPassword() {
47: return password.clone();
48: }
49:
50: public void destroy() throws DestroyFailedException {
51: userName = null;
52: Arrays.fill(password, ' ');
53: password = null;
54: destroyed = true;
55: }
56:
57: public boolean isDestroyed() {
58: return destroyed;
59: }
60: }
|