Package org.jivesoftware.openfire.fast
Class FastRequest
java.lang.Object
org.jivesoftware.openfire.fast.FastRequest
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 TypeMethodDescriptionvoidapplyTo(LocalSession session) Records this request on the session, for the SASL mechanism implementation and for the handling of a successful authentication to act on.static FastRequestfrom(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, ornullif 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, ornullif none was supplied.Returns the FAST mechanism for which a new token was requested, ornullif none was requested.booleanReturns whether the client asked for the token it authenticated with to be invalidated.toString()
-
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. Returnsnullwhen 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
nullif the element carries no FAST content. - Throws:
SaslFailureException- if the FAST content is malformed, or names a mechanism that was not offered.
-
applyTo
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
Returns the FAST mechanism for which a new token was requested, ornullif none was requested.- Returns:
- a FAST mechanism name, or
null.
-
getClientId
Returns the user-agent id that identifies the client installation, ornullif 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
Returns the replay counter supplied by the client, ornullif 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:
trueif invalidation was requested.
-
toString
-