Class MechanismName

java.lang.Object
org.jivesoftware.openfire.sasl.MechanismName

public final class MechanismName extends Object
Classification of SASL mechanism names by the conventions encoded in the names themselves. Every method here is a pure function of the mechanism name. Nothing in this class consults configuration, session state or the set of mechanisms that this server happens to support, which makes each of them exhaustively testable against a fixed list of names. Callers are expected to pass an upper-cased name, which is the form that SASLAuthentication normalises inbound mechanism names to.
  • Method Details

    • isScram

      public static boolean isScram(@Nonnull String mechanismName)
      Returns true if the given SASL mechanism name is a member of the SCRAM family. SCRAM mechanism names are, per RFC 5802 § 4, the string SCRAM- followed by the name of the underlying hash function (optionally suffixed with -PLUS for the channel binding variant).
      Parameters:
      mechanismName - the SASL mechanism name to check (cannot be null)
      Returns:
      true if the mechanism is a SCRAM mechanism; false otherwise
    • isFast

      public static boolean isFast(@Nonnull String mechanismName)
      Returns true if the given SASL mechanism name is a FAST mechanism (HT-* or HT2-*). FAST mechanisms are not registered in the sasl.mechs configuration property, so they must be recognised independently of the standard mechanism list when FAST is enabled.
      Parameters:
      mechanismName - the SASL mechanism name to check (cannot be null)
      Returns:
      true if the mechanism is a FAST HT-family mechanism; false otherwise
    • requiresChannelBinding

      public static boolean requiresChannelBinding(@Nonnull String mechanismName)
      Returns true if the given SASL mechanism name requires channel binding.

      Two naming conventions are recognised:

      • The -PLUS suffix used by SCRAM mechanisms (e.g. SCRAM-SHA-1-PLUS).
      • The -UNIQ, -ENDP, and -EXPR suffixes used by HT-* and HT2-* mechanisms, mapping to tls-unique, tls-server-end-point, and tls-exporter channel-binding types respectively (per the HT draft, Table 1).
      Parameters:
      mechanismName - the SASL mechanism name to check (cannot be null)
      Returns:
      true if the mechanism requires channel binding; false otherwise
    • requiredChannelBindingType

      @Nullable public static String requiredChannelBindingType(@Nonnull String mechanismName)
      Returns the specific TLS channel-binding type name required by the given SASL mechanism, or null if the mechanism does not require a specific one.

      Two naming conventions are recognised:

      • The -PLUS suffix used by SCRAM mechanisms (e.g. SCRAM-SHA-1-PLUS) — these mechanisms negotiate the exact CB type at runtime, so null is returned and availability is checked elsewhere (any CB type is sufficient).
      • The -UNIQ, -ENDP, and -EXPR suffixes used by HT-* and HT2-* mechanisms — these encode a specific CB type in the mechanism name, so the exact type is returned ("tls-unique", "tls-server-end-point", or "tls-exporter" per the HT draft, Table 1).
      Note that a null return does not imply that the mechanism needs no channel binding; use requiresChannelBinding(String) for that. A -PLUS mechanism requires channel binding but has no single required type.
      Parameters:
      mechanismName - the SASL mechanism name to check (cannot be null)
      Returns:
      the required TLS channel-binding type name (e.g. "tls-unique"), or null if no specific type is required (includes NONE and PLUS mechanisms)