Smack currently has two methods for login:
this is causing some code duplication. Instead a single method should be used that handles the case when Smack should connect anonymously, i.e. using SASL ANONYMOUS.
Sketch of the changes:
- Introduce authenticateAnonymous() configuration builder method
- Ensure that callback handler, username and password are not set if authenticate anonymous is set (the other way is not possible, since username could be provided by other means e.g. SASL EXTERNAL).
- If authenticateAnonymous use only SASL ANONYMOUS mech
- If !authenticateAnonymous ignore SASL ANONYMOUS mech