// now go through the progression of mechanisms we support, from the
// most secure to the
// least secure.
if (supportsAuthentication(AUTHENTICATION_DIGESTMD5)) {
authenticator = new DigestMD5Authenticator(host, username, password, getSASLRealm());
} else if (supportsAuthentication(AUTHENTICATION_CRAMMD5)) {
authenticator = new CramMD5Authenticator(username, password);
} else if (supportsAuthentication(AUTHENTICATION_LOGIN)) {
authenticator = new LoginAuthenticator(username, password);
} else if (supportsAuthentication(AUTHENTICATION_PLAIN)) {