Class SASLAuthentication

java.lang.Object
org.jivesoftware.smack.SASLAuthentication

public final class SASLAuthentication extends Object

This class is responsible authenticating the user using SASL, binding the resource to the connection and establishing a session with the server.

Once TLS has been negotiated (i.e. the connection has been secured) it is possible to register with the server or authenticate using SASL. If the server supports SASL then Smack will try to authenticate using SASL.

The server may support many SASL mechanisms to use for authenticating. Out of the box Smack provides several SASL mechanisms, but it is possible to register new SASL Mechanisms. Use registerSASLMechanism(SASLMechanism) to register a new mechanisms.

See Also:
  • Method Details

    • registerSASLMechanism

      public static void registerSASLMechanism(SASLMechanism mechanism)
      Registers a new SASL mechanism.
      Parameters:
      mechanism - a SASLMechanism subclass.
    • getRegisterdSASLMechanisms

      public static Map<String,String> getRegisterdSASLMechanisms()
      Returns the registered SASLMechanism sorted by the level of preference.
      Returns:
      the registered SASLMechanism sorted by the level of preference.
    • isSaslMechanismRegistered

      public static boolean isSaslMechanismRegistered(String saslMechanism)
    • unregisterSASLMechanism

      public static boolean unregisterSASLMechanism(String clazz)
      Unregister a SASLMechanism by it's full class name. For example "org.jivesoftware.smack.sasl.javax.SASLCramMD5Mechanism".
      Parameters:
      clazz - the SASLMechanism class's name
      Returns:
      true if the given SASLMechanism was removed, false otherwise
    • blacklistSASLMechanism

      public static boolean blacklistSASLMechanism(String mechanism)
    • unBlacklistSASLMechanism

      public static boolean unBlacklistSASLMechanism(String mechanism)
    • getBlacklistedSASLMechanisms

      public static Set<String> getBlacklistedSASLMechanisms()
    • authenticationSuccessful

      public boolean authenticationSuccessful()