mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 14:22:05 +01:00
Log a warning if the server didn't report SASL mechanisms
and return the empty list.
This commit is contained in:
parent
504b550ef2
commit
5dd2bb5874
1 changed files with 7 additions and 0 deletions
|
@ -37,6 +37,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>This class is responsible authenticating the user using SASL, binding the resource
|
* <p>This class is responsible authenticating the user using SASL, binding the resource
|
||||||
|
@ -57,6 +58,8 @@ import java.util.Set;
|
||||||
*/
|
*/
|
||||||
public class SASLAuthentication {
|
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 List<SASLMechanism> REGISTERED_MECHANISMS = new ArrayList<SASLMechanism>();
|
||||||
|
|
||||||
private static final Set<String> BLACKLISTED_MECHANISMS = new HashSet<String>();
|
private static final Set<String> BLACKLISTED_MECHANISMS = new HashSet<String>();
|
||||||
|
@ -408,6 +411,10 @@ public class SASLAuthentication {
|
||||||
|
|
||||||
private List<String> serverMechanisms() {
|
private List<String> serverMechanisms() {
|
||||||
Mechanisms mechanisms = connection.getFeature(Mechanisms.ELEMENT, Mechanisms.NAMESPACE);
|
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();
|
return mechanisms.getMechanisms();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue