Class FastRequest

java.lang.Object
org.jivesoftware.openfire.fast.FastRequest

public final class FastRequest extends Object
The FAST (XEP-0484) content of a SASL2 <authenticate/> element: a request for a new token, an authentication with an existing one, or both. Parsing is separated from application, so that the whole element is validated before any of it is recorded on the session. from(Element, String, String, LocalClientSession) reads and validates; applyTo(LocalSession) writes the result through FastSessionState. This mirrors Bind2Request, which occupies the same position in the handling of <authenticate/>.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Records this request on the session, for the SASL mechanism implementation and for the handling of a successful authentication to act on.
    from(org.dom4j.Element doc, String mechanismName, String userAgentId, LocalClientSession session)
    Parses and validates the FAST content of a SASL2 <authenticate/> element.
    Returns the user-agent id that identifies the client installation, or null if this request carried no identity prerequisites, which is the case for a <fast/> element on a non-FAST authentication.
    Returns the replay counter supplied by the client, or null if none was supplied.
    Returns the FAST mechanism for which a new token was requested, or null if none was requested.
    boolean
    Returns whether the client asked for the token it authenticated with to be invalidated.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • from

      @Nullable public static FastRequest from(@Nonnull org.dom4j.Element doc, @Nonnull String mechanismName, @Nullable String userAgentId, @Nonnull LocalClientSession session) throws SaslFailureException
      Parses and validates the FAST content of a SASL2 <authenticate/> element. Returns null when the element carries no FAST content and the selected mechanism is not a FAST mechanism, in which case there is nothing for the caller to apply. The identity prerequisites of XEP-0484 ยง 4.1 (a local authenticating JID in the stream's 'from' attribute, and a SASL2 user-agent id) are enforced here, for both token authentication and token requests.
      Parameters:
      doc - the <authenticate/> element (cannot be null).
      mechanismName - the upper-cased name of the selected SASL mechanism (cannot be null).
      userAgentId - the 'id' of the SASL2 <user-agent/> element, or null if the client supplied none.
      session - the session that is authenticating (cannot be null).
      Returns:
      the parsed request, or null if the element carries no FAST content.
      Throws:
      SaslFailureException - if the FAST content is malformed, or names a mechanism that was not offered.
    • applyTo

      public void applyTo(@Nonnull LocalSession session)
      Records this request on the session, for the SASL mechanism implementation and for the handling of a successful authentication to act on.
      Parameters:
      session - the session that is authenticating (cannot be null).
    • getRequestedMechanism

      @Nullable public String getRequestedMechanism()
      Returns the FAST mechanism for which a new token was requested, or null if none was requested.
      Returns:
      a FAST mechanism name, or null.
    • getClientId

      @Nullable public String getClientId()
      Returns the user-agent id that identifies the client installation, or null if this request carried no identity prerequisites, which is the case for a <fast/> element on a non-FAST authentication.
      Returns:
      a client identifier, or null.
    • getReplayCount

      @Nullable public Long getReplayCount()
      Returns the replay counter supplied by the client, or null if none was supplied.
      Returns:
      a positive counter value, or null.
    • isInvalidate

      public boolean isInvalidate()
      Returns whether the client asked for the token it authenticated with to be invalidated.
      Returns:
      true if invalidation was requested.
    • toString

      public String toString()
      Overrides:
      toString in class Object