Class NameStoringHandler
- java.lang.Object
-
- de.aristaflow.adept2.base.security.callbackhandler.NameStoringHandler
-
- All Implemented Interfaces:
AFCallbackHandler
public class NameStoringHandler extends Object implements AFCallbackHandler
A wrapping callback handler storing the name provided to aNameCallback. This allows for correct name-based delay. Otherwise an attack would be possible by not providing the name directly but only via the callback handler.- Author:
- Ulrich Kreher
-
-
Field Summary
Fields Modifier and Type Field Description protected StringnameThe name provided to aNameCallback.protected AFCallbackHandlerwrappedThe callback handler for all callbacks.
-
Constructor Summary
Constructors Constructor Description NameStoringHandler(AFCallbackHandler wrapped)Creates a callback handler storing the name provided to aNameCallbackby the wrappedAFCallbackHandler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetName()Gets the name that has been provided to aNameCallbackornullin case there has not been aNameCallback.Callback[]handle(Callback[] callbacks)This method is similar toCallbackHandler.handle(Callback[])but returns the provided callbacks back to the caller.
-
-
-
Field Detail
-
name
protected String name
The name provided to aNameCallback.
-
wrapped
protected final AFCallbackHandler wrapped
The callback handler for all callbacks.
-
-
Constructor Detail
-
NameStoringHandler
public NameStoringHandler(AFCallbackHandler wrapped)
Creates a callback handler storing the name provided to aNameCallbackby the wrappedAFCallbackHandler.- Parameters:
wrapped- TheAFCallbackHandlerto which all callbacks will be forwarded. This must not benull.
-
-
Method Detail
-
handle
public Callback[] handle(Callback[] callbacks) throws UnsupportedCallbackException, IOException
Description copied from interface:AFCallbackHandlerThis 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:
handlein 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 thecallbacksparameter, anUnsupportedCallbackExceptionwill be thrown.IOException- If an input or output error occurs, anIOExceptionwill be thrown.
-
getName
public String getName()
Gets the name that has been provided to aNameCallbackornullin case there has not been aNameCallback.- Returns:
- The name that has been provided to a
NameCallbackornullin case there has not been aNameCallback.
-
-