1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-23 04:57:58 +01:00

Do not base64 twice in SASL X-OAUTH2

Fixes SMACK-722.
This commit is contained in:
Florian Schmaus 2016-06-01 13:10:11 +02:00
parent df0f805feb
commit ac5d9d56c6

View file

@ -1,6 +1,6 @@
/**
*
* Copyright 2014-2015 Florian Schmaus
* Copyright 2014-2016 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -20,7 +20,6 @@ import javax.security.auth.callback.CallbackHandler;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.sasl.SASLMechanism;
import org.jivesoftware.smack.util.stringencoder.Base64;
/**
* The SASL X-OAUTH2 mechanism as described in <a
@ -72,8 +71,8 @@ public class SASLXOauth2Mechanism extends SASLMechanism {
@Override
protected byte[] getAuthenticationText() throws SmackException {
// base64("\0" + user_name + "\0" + oauth_token)
return Base64.encode(toBytes('\u0000' + authenticationId + '\u0000' + password));
// Note that base64 encoding is done in SASLMechanism for the bytes return by getAuthenticationText().
return toBytes('\u0000' + authenticationId + '\u0000' + password);
}
@Override