1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-25 21:42:07 +01:00

Log a warning if the server didn't report SASL mechanisms

and return the empty list.
This commit is contained in:
Florian Schmaus 2014-11-16 19:03:03 +01:00
parent 504b550ef2
commit 5dd2bb5874

View file

@ -37,6 +37,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
/**
* <p>This class is responsible authenticating the user using SASL, binding the resource
@ -57,6 +58,8 @@ import java.util.Set;
*/
public class SASLAuthentication {
private static final Logger LOGGER = Logger.getLogger(SASLAuthentication.class.getName());
private static final List<SASLMechanism> REGISTERED_MECHANISMS = new ArrayList<SASLMechanism>();
private static final Set<String> BLACKLISTED_MECHANISMS = new HashSet<String>();
@ -408,6 +411,10 @@ public class SASLAuthentication {
private List<String> serverMechanisms() {
Mechanisms mechanisms = connection.getFeature(Mechanisms.ELEMENT, Mechanisms.NAMESPACE);
if (mechanisms == null) {
LOGGER.warning("Server did not report any SASL mechanisms");
return Collections.emptyList();
}
return mechanisms.getMechanisms();
}
}