| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| PasswordValidationCallback |
|
| 1.0;1 |
| 1 | /** | |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 | * contributor license agreements. See the NOTICE file distributed with | |
| 4 | * this work for additional information regarding copyright ownership. | |
| 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 | * (the "License"); you may not use this file except in compliance with | |
| 7 | * the License. You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * 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 | */ | |
| 17 | package javax.security.auth.message.callback; | |
| 18 | ||
| 19 | import javax.security.auth.callback.Callback; | |
| 20 | import javax.security.auth.Subject; | |
| 21 | ||
| 22 | import java.util.Arrays; | |
| 23 | ||
| 24 | /** | |
| 25 | * Callback that enables an authentication module to supply a username and password (to a runtime?) and determine if | |
| 26 | * the result of validation. | |
| 27 | * | |
| 28 | * @version $Rev: 617352 $ $Date: 2008-01-31 21:16:16 -0800 (Thu, 31 Jan 2008) $ | |
| 29 | */ | |
| 30 | public class PasswordValidationCallback implements Callback { | |
| 31 | ||
| 32 | private final Subject subject; | |
| 33 | private final String username; | |
| 34 | private char[] password; | |
| 35 | private boolean result; | |
| 36 | ||
| 37 | 0 | public PasswordValidationCallback(Subject subject, String username, char[] password) { |
| 38 | 0 | this.subject = subject; |
| 39 | 0 | this.username = username; |
| 40 | 0 | this.password = password; |
| 41 | 0 | } |
| 42 | ||
| 43 | public Subject getSubject() { | |
| 44 | 0 | return subject; |
| 45 | } | |
| 46 | ||
| 47 | public String getUsername() { | |
| 48 | 0 | return username; |
| 49 | } | |
| 50 | ||
| 51 | public char[] getPassword() { | |
| 52 | 0 | return password; |
| 53 | } | |
| 54 | ||
| 55 | public void clearPassword() { | |
| 56 | 0 | Arrays.fill(password, (char) 0); |
| 57 | 0 | password = new char[0]; |
| 58 | 0 | } |
| 59 | ||
| 60 | public boolean getResult() { | |
| 61 | 0 | return result; |
| 62 | } | |
| 63 | ||
| 64 | public void setResult(boolean result) { | |
| 65 | 0 | this.result = result; |
| 66 | 0 | } |
| 67 | } |