mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-09 10:19:41 +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:
parent
c5b7f14527
commit
f37682d980
5 changed files with 32 additions and 14 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue