2014-11-12 10:15:38 -05:00
|
|
|
package eu.siacs.conversations.crypto.sasl;
|
|
|
|
|
|
|
|
import android.util.Base64;
|
|
|
|
|
|
|
|
import java.nio.charset.Charset;
|
|
|
|
|
|
|
|
import eu.siacs.conversations.entities.Account;
|
|
|
|
import eu.siacs.conversations.xml.TagWriter;
|
|
|
|
|
|
|
|
public class Plain extends SaslMechanism {
|
2014-11-12 15:35:44 -05:00
|
|
|
public Plain(final TagWriter tagWriter, final Account account) {
|
|
|
|
super(tagWriter, account, null);
|
|
|
|
}
|
2014-11-12 10:15:38 -05:00
|
|
|
|
2014-11-15 09:42:40 -05:00
|
|
|
@Override
|
|
|
|
public int getPriority() {
|
2015-01-01 19:39:19 -05:00
|
|
|
return 10;
|
2014-11-15 09:42:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getMechanism() {
|
2014-11-12 15:35:44 -05:00
|
|
|
return "PLAIN";
|
|
|
|
}
|
2014-11-12 10:15:38 -05:00
|
|
|
|
2014-11-12 15:35:44 -05:00
|
|
|
@Override
|
|
|
|
public String getClientFirstMessage() {
|
|
|
|
final String sasl = '\u0000' + account.getUsername() + '\u0000' + account.getPassword();
|
|
|
|
return Base64.encodeToString(sasl.getBytes(Charset.defaultCharset()), Base64.NO_WRAP);
|
|
|
|
}
|
2014-11-12 10:15:38 -05:00
|
|
|
}
|