Class NamePasswordHandler
- java.lang.Object
-
- de.aristaflow.adept2.base.security.callbackhandler.NamePasswordHandler
-
- All Implemented Interfaces:
AFCallbackHandler
public class NamePasswordHandler extends Object implements AFCallbackHandler
A simple callback handler providing a name and a password to the appropriate callbacks (NameCallback
andPasswordCallback
) if required. Optionally an additionalAFCallbackHandler
can be provided to which all otherCallback
s will be forwarded. If this is not provided and another callback is required, the callback handling will fail.- Author:
- Ulrich Kreher
-
-
Field Summary
Fields Modifier and Type Field Description protected AFCallbackHandler
furtherHandling
The callback handler for all other callbacks.protected String
name
The name to provide in aNameCallback
if required.protected char[]
password
The password to provide in aPasswordCallback
if required.
-
Constructor Summary
Constructors Constructor Description NamePasswordHandler(String name, String password)
Creates a callback handler providing the designated name and password to the appropriate callbacks.NamePasswordHandler(String name, String password, AFCallbackHandler furtherHandling)
Creates a callback handler providing the designated name and password to the appropriate callbacks.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Callback[]
handle(Callback[] callbacks)
This method is similar toCallbackHandler.handle(Callback[])
but returns the provided callbacks back to the caller.
-
-
-
Field Detail
-
name
protected final String name
The name to provide in aNameCallback
if required.
-
password
protected final char[] password
The password to provide in aPasswordCallback
if required.
-
furtherHandling
protected final AFCallbackHandler furtherHandling
The callback handler for all other callbacks.
-
-
Constructor Detail
-
NamePasswordHandler
public NamePasswordHandler(String name, String password)
Creates a callback handler providing the designated name and password to the appropriate callbacks. If anotherCallback
is required besides aNameCallback
and aPasswordCallback
, callback handling will fail.- Parameters:
name
- The name to provide in aNameCallback
if required.password
- The password to provide in aPasswordCallback
if required.
-
NamePasswordHandler
public NamePasswordHandler(String name, String password, AFCallbackHandler furtherHandling)
Creates a callback handler providing the designated name and password to the appropriate callbacks. If anotherCallback
is required besides aNameCallback
and aPasswordCallback
, these callbacks will be collected and provided to the designatedAFCallbackHandler
.- Parameters:
name
- The name to provide in aNameCallback
if required.password
- The password to provide in aPasswordCallback
if required.furtherHandling
- TheCallbackHandler
to which all other callbacks will be forwarded. This may benull
which equalsNamePasswordHandler(String, String)
.
-
-
Method Detail
-
handle
public Callback[] handle(Callback[] callbacks) throws UnsupportedCallbackException, IOException
Description copied from interface:AFCallbackHandler
This method is similar toCallbackHandler.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.
When called remotely, the provided callbacks are copies of the server-side objects. When changing these objects, the changes are not reflected on server side. Therefore these objects (or rather copies of them) need to be returned.- Specified by:
handle
in interfaceAFCallbackHandler
- Parameters:
callbacks
- The callbacks to be handled by this callback handler.- Returns:
- All the callbacks that should be handled by this callback handler. Just return the complete array of callbacks. Do not skip any callbacks, for instance the ones that the callback handler did not handle!
- Throws:
UnsupportedCallbackException
- If the implementation of this method does not support one or more of the callbacks specified in thecallbacks
parameter, anUnsupportedCallbackException
will be thrown.IOException
- If an input or output error occurs, anIOException
will be thrown.
-
-