equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
25 |
25 |
26 package javax.security.auth.callback; |
26 package javax.security.auth.callback; |
27 |
27 |
28 /** |
28 /** |
29 * <p> Underlying security services instantiate and pass a |
29 * <p> Underlying security services instantiate and pass a |
30 * <code>PasswordCallback</code> to the <code>handle</code> |
30 * {@code PasswordCallback} to the {@code handle} |
31 * method of a <code>CallbackHandler</code> to retrieve password information. |
31 * method of a {@code CallbackHandler} to retrieve password information. |
32 * |
32 * |
33 * @see javax.security.auth.callback.CallbackHandler |
33 * @see javax.security.auth.callback.CallbackHandler |
34 */ |
34 */ |
35 public class PasswordCallback implements Callback, java.io.Serializable { |
35 public class PasswordCallback implements Callback, java.io.Serializable { |
36 |
36 |
51 * @since 1.4 |
51 * @since 1.4 |
52 */ |
52 */ |
53 private char[] inputPassword; |
53 private char[] inputPassword; |
54 |
54 |
55 /** |
55 /** |
56 * Construct a <code>PasswordCallback</code> with a prompt |
56 * Construct a {@code PasswordCallback} with a prompt |
57 * and a boolean specifying whether the password should be displayed |
57 * and a boolean specifying whether the password should be displayed |
58 * as it is being typed. |
58 * as it is being typed. |
59 * |
59 * |
60 * <p> |
60 * <p> |
61 * |
61 * |
62 * @param prompt the prompt used to request the password. <p> |
62 * @param prompt the prompt used to request the password. <p> |
63 * |
63 * |
64 * @param echoOn true if the password should be displayed |
64 * @param echoOn true if the password should be displayed |
65 * as it is being typed. |
65 * as it is being typed. |
66 * |
66 * |
67 * @exception IllegalArgumentException if <code>prompt</code> is null or |
67 * @exception IllegalArgumentException if {@code prompt} is null or |
68 * if <code>prompt</code> has a length of 0. |
68 * if {@code prompt} has a length of 0. |
69 */ |
69 */ |
70 public PasswordCallback(String prompt, boolean echoOn) { |
70 public PasswordCallback(String prompt, boolean echoOn) { |
71 if (prompt == null || prompt.length() == 0) |
71 if (prompt == null || prompt.length() == 0) |
72 throw new IllegalArgumentException(); |
72 throw new IllegalArgumentException(); |
73 |
73 |