Package org.jivesoftware.openfire.sasl
Class MechanismName
java.lang.Object
org.jivesoftware.openfire.sasl.MechanismName
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 Summary
Modifier and TypeMethodDescriptionstatic booleanReturnstrueif the given SASL mechanism name is a FAST mechanism (HT-* or HT2-*).static booleanReturnstrueif the given SASL mechanism name is a member of the SCRAM family.static StringrequiredChannelBindingType(String mechanismName) Returns the specific TLS channel-binding type name required by the given SASL mechanism, ornullif the mechanism does not require a specific one.static booleanrequiresChannelBinding(String mechanismName) Returnstrueif the given SASL mechanism name requires channel binding.
-
Method Details
-
isScram
Returnstrueif the given SASL mechanism name is a member of the SCRAM family. SCRAM mechanism names are, per RFC 5802 § 4, the stringSCRAM-followed by the name of the underlying hash function (optionally suffixed with-PLUSfor the channel binding variant).- Parameters:
mechanismName- the SASL mechanism name to check (cannot be null)- Returns:
trueif the mechanism is a SCRAM mechanism;falseotherwise
-
isFast
Returnstrueif the given SASL mechanism name is a FAST mechanism (HT-* or HT2-*). FAST mechanisms are not registered in thesasl.mechsconfiguration 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:
trueif the mechanism is a FAST HT-family mechanism;falseotherwise
-
requiresChannelBinding
Returnstrueif the given SASL mechanism name requires channel binding.Two naming conventions are recognised:
- The
-PLUSsuffix used by SCRAM mechanisms (e.g.SCRAM-SHA-1-PLUS). - The
-UNIQ,-ENDP, and-EXPRsuffixes used by HT-* and HT2-* mechanisms, mapping totls-unique,tls-server-end-point, andtls-exporterchannel-binding types respectively (per the HT draft, Table 1).
- Parameters:
mechanismName- the SASL mechanism name to check (cannot be null)- Returns:
trueif the mechanism requires channel binding;falseotherwise
- The
-
requiredChannelBindingType
Returns the specific TLS channel-binding type name required by the given SASL mechanism, ornullif the mechanism does not require a specific one.Two naming conventions are recognised:
- The
-PLUSsuffix used by SCRAM mechanisms (e.g.SCRAM-SHA-1-PLUS) — these mechanisms negotiate the exact CB type at runtime, sonullis returned and availability is checked elsewhere (any CB type is sufficient). - The
-UNIQ,-ENDP, and-EXPRsuffixes 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).
nullreturn does not imply that the mechanism needs no channel binding; userequiresChannelBinding(String)for that. A-PLUSmechanism 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"), ornullif no specific type is required (includes NONE and PLUS mechanisms)
- The
-