/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* A default CallbackHandler implementation.
*/
/**
* Invoke an array of Callbacks.
*
* <p>
*
* @param callbacks an array of <code>Callback</code> objects which contain
* the information requested by an underlying security
* service to be retrieved or displayed.
*
* @exception java.io.IOException if an input or output error occurs. <p>
*
* @exception UnsupportedCallbackException if the implementation of this
* method does not support one or more of the Callbacks
* specified in the <code>callbacks</code> parameter.
*/
throws IOException, UnsupportedCallbackException {
if (callbacks[i] instanceof TextOutputCallback) {
// display the message according to the specified type
switch (toc.getMessageType()) {
break;
case TextOutputCallback.ERROR:
break;
case TextOutputCallback.WARNING:
break;
default:
throw new IOException("Unsupported message type: " +
toc.getMessageType());
}
} else if (callbacks[i] instanceof NameCallback) {
// prompt the user for a username
// ignore the provided defaultName
} else if (callbacks[i] instanceof PasswordCallback) {
// prompt the user for sensitive information
} else {
throw new UnsupportedCallbackException
(callbacks[i], "Unrecognized Callback");
}
}
}
// Reads user password from given input stream.
char[] lineBuffer;
char[] buf;
int i;
int offset = 0;
int c;
loop: while (true) {
case -1:
case '\n':
break loop;
case '\r':
if (!(in instanceof PushbackInputStream)) {
}
} else
break loop;
default:
if (--room < 0) {
lineBuffer = buf;
}
break;
}
}
if (offset == 0) {
return null;
}
return ret;
}
}