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 a NameCallback. 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 Details

    • name

      protected String name
      The name provided to a NameCallback.
    • wrapped

      protected final AFCallbackHandler wrapped
      The callback handler for all callbacks.
  • Constructor Details

    • NameStoringHandler

      public NameStoringHandler(AFCallbackHandler wrapped)
      Creates a callback handler storing the name provided to a NameCallback by the wrapped AFCallbackHandler.
      Parameters:
      wrapped - The AFCallbackHandler to which all callbacks will be forwarded. This must not be null.
  • Method Details

    • handle

      public Callback[] handle(Callback[] callbacks) throws UnsupportedCallbackException, IOException
      Description copied from interface: AFCallbackHandler
      This method is similar to CallbackHandler.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 interface AFCallbackHandler
      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 the callbacks parameter, an UnsupportedCallbackException will be thrown.
      IOException - If an input or output error occurs, an IOException will be thrown.
    • getName

      public String getName()
      Gets the name that has been provided to a NameCallback or null in case there has not been a NameCallback.
      Returns:
      The name that has been provided to a NameCallback or null in case there has not been a NameCallback.