public class NamePasswordHandler extends java.lang.Object implements AFCallbackHandler
NameCallback and PasswordCallback) if
required. Optionally an additional AFCallbackHandler can be
provided to which all other Callbacks will be forwarded. If
this is not provided and another callback is required, the callback handling
will fail.| Modifier and Type | Field and Description |
|---|---|
protected AFCallbackHandler |
furtherHandling
The callback handler for all other callbacks.
|
protected java.lang.String |
name
The name to provide in a
NameCallback if required. |
protected char[] |
password
The password to provide in a
PasswordCallback if required. |
| Constructor and Description |
|---|
NamePasswordHandler(java.lang.String name,
java.lang.String password)
Creates a callback handler providing the designated name and password to
the appropriate callbacks.
|
NamePasswordHandler(java.lang.String name,
java.lang.String password,
AFCallbackHandler furtherHandling)
Creates a callback handler providing the designated name and password to
the appropriate callbacks.
|
| Modifier and Type | Method and Description |
|---|---|
javax.security.auth.callback.Callback[] |
handle(javax.security.auth.callback.Callback[] callbacks)
This method is similar to
CallbackHandler.handle(Callback[]) but returns the provided callbacks back
to the caller. |
protected final java.lang.String name
NameCallback if required.protected final char[] password
PasswordCallback if required.protected final AFCallbackHandler furtherHandling
public NamePasswordHandler(java.lang.String name,
java.lang.String password)
Callback is required
besides a NameCallback and a PasswordCallback,
callback handling will fail.name - The name to provide in a NameCallback if required.password - The password to provide in a PasswordCallback
if required.public NamePasswordHandler(java.lang.String name,
java.lang.String password,
AFCallbackHandler furtherHandling)
Callback is required
besides a NameCallback and a PasswordCallback,
these callbacks will be collected and provided to the designated
AFCallbackHandler.name - The name to provide in a NameCallback if required.password - The password to provide in a PasswordCallback
if required.furtherHandling - The CallbackHandler to which all other
callbacks will be forwarded. This may be null which
equals NamePasswordHandler(String, String).public javax.security.auth.callback.Callback[] handle(javax.security.auth.callback.Callback[] callbacks)
throws javax.security.auth.callback.UnsupportedCallbackException,
java.io.IOException
AFCallbackHandlerCallbackHandler.handle(Callback[]) but returns the provided callbacks back
to the caller. This allows for calling this method remotely. Note that all
callbacks need to be serialisable. handle in interface AFCallbackHandlercallbacks - The callbacks to be handled by this callback handler.javax.security.auth.callback.UnsupportedCallbackException - If the implementation of this method
does not support one or more of the callbacks specified in the
callbacks parameter, an
UnsupportedCallbackException will be thrown.java.io.IOException - If an input or output error occurs, an
IOException will be thrown.