1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 00:59:39 +02:00

Make SASLMechanism.getAuthenticationText() return byte[]

every SASL Mechanism is designed as a byte array based protocol. XMPP
adds the constraint that the challenges and responses are send base64
encoded. It's therefore better API design to let getAuthenticationText()
return byte[] instead of String.
This commit is contained in:
Florian Schmaus 2014-08-11 21:39:09 +02:00
parent c5b7f14527
commit f37682d980
5 changed files with 32 additions and 14 deletions

View file

@ -33,7 +33,6 @@ import javax.security.sasl.SaslException;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.sasl.SASLMechanism;
import org.jivesoftware.smack.util.StringUtils;
public abstract class SASLJavaXMechanism extends SASLMechanism {
@ -107,19 +106,17 @@ public abstract class SASLJavaXMechanism extends SASLMechanism {
}
}
protected String getAuthenticationText() throws SmackException {
String authenticationText = null;
@Override
protected byte[] getAuthenticationText() throws SmackException {
if (sc.hasInitialResponse()) {
byte[] response;
try {
response = sc.evaluateChallenge(new byte[0]);
return sc.evaluateChallenge(new byte[0]);
}
catch (SaslException e) {
throw new SmackException(e);
}
authenticationText = StringUtils.encodeBase64(response, false);
}
return authenticationText;
return null;
}
@Override