Class Sasl2TaskResult

java.lang.Object
org.jivesoftware.openfire.sasl.task.Sasl2TaskResult

public final class Sasl2TaskResult extends Object
The outcome of one step of a Sasl2Task. A step either produces data that is to be sent to the peer in a <task-data/> element (after which the peer is expected to respond with a <task-data/> element of its own), or completes the task. A step that must abort the entire SASL2 negotiation does not return a result: it throws a SaslFailureException instead. Instances are immutable.
See Also:
  • Method Details

    • taskData

      @Nonnull public static Sasl2TaskResult taskData(@Nonnull org.dom4j.Element... children)
      A result that sends a <task-data/> element containing the provided children to the peer. Every child element must carry its own namespace: <task-data/> is in the SASL2 namespace, which is not an appropriate namespace for third-party payloads.
      Parameters:
      children - the child elements of the <task-data/> element that is sent to the peer.
      Returns:
      a result (never null).
    • taskData

      @Nonnull public static Sasl2TaskResult taskData(@Nonnull Collection<org.dom4j.Element> children)
      A result that sends a <task-data/> element containing the provided children to the peer.
      Parameters:
      children - the child elements of the <task-data/> element that is sent to the peer. Can be empty, which sends an empty <task-data/> element.
      Returns:
      a result (never null).
    • completed

      @Nonnull public static Sasl2TaskResult completed()
      A result that completes the task without contributing any data to the response that the peer receives.
      Returns:
      a result (never null).
    • completed

      @Nonnull public static Sasl2TaskResult completed(@Nullable byte[] additionalData)
      A result that completes the task, contributing mechanism-style <additional-data/> to the response that the peer receives. The data is placed in the next <continue/> element if another round of tasks follows, or in the final <success/> element if this was the last task. Most tasks have no such data and use completed().
      Parameters:
      additionalData - data to be base64-encoded into an <additional-data/> element, or null.
      Returns:
      a result (never null).
    • getType

      @Nonnull public Sasl2TaskResult.Type getType()
    • getTaskData

      @Nonnull public List<org.dom4j.Element> getTaskData()
      The children of the <task-data/> element to send to the peer. Only meaningful for Sasl2TaskResult.Type.TASK_DATA. This list is immutable and contains defensive copies of the original elements.
      Returns:
      an immutable list of elements (never null, possibly empty).
    • getAdditionalData

      @Nullable public byte[] getAdditionalData()
      Data to be rendered as <additional-data/>. Only meaningful for Sasl2TaskResult.Type.COMPLETED.
      Returns:
      the additional data, or null.
    • toString

      public String toString()
      Overrides:
      toString in class Object