public class PassiveCallbackHandler extends Object implements CallbackHandler
PassiveCallbackHandler has constructor that takes a username and password so its handle() method does not have to prompt the user for input.
Useful for server-side applications.
This code was inspired from an article from:
Constructor and Description |
---|
PassiveCallbackHandler(String username,
char[] passwordArray)
Creates a callback handler with the give username
and password.
|
Modifier and Type | Method and Description |
---|---|
void |
clearPassword()
Clears out password state.
|
void |
handle(Callback[] callbacks)
Handles the specified set of Callbacks.
|
public PassiveCallbackHandler(String username, char[] passwordArray)
Creates a callback handler with the give username and password.
username
- The username.passwordArray
- The password.public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
Handles the specified set of Callbacks. Uses the username and password that were supplied to our constructor to popluate the Callbacks.
This class supports NameCallback and PasswordCallback.
handle
in interface CallbackHandler
callbacks
- the callbacks to handleIOException
- if an input or output error occurs.UnsupportedCallbackException
- if the callback is not an
instance of NameCallback or PasswordCallbackpublic void clearPassword()
Clears out password state.
Copyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.