added null check in sasl response verifier

This commit is contained in:
Daniel Gultsch 2015-07-10 12:16:30 +02:00
parent 7eac30d1f4
commit 492e387482

View File

@ -185,7 +185,7 @@ public class ScramSha1 extends SaslMechanism {
case RESPONSE_SENT: case RESPONSE_SENT:
final String clientCalculatedServerFinalMessage = "v=" + final String clientCalculatedServerFinalMessage = "v=" +
Base64.encodeToString(serverSignature, Base64.NO_WRAP); Base64.encodeToString(serverSignature, Base64.NO_WRAP);
if (!clientCalculatedServerFinalMessage.equals(new String(Base64.decode(challenge, Base64.DEFAULT)))) { if (challenge == null || !clientCalculatedServerFinalMessage.equals(new String(Base64.decode(challenge, Base64.DEFAULT)))) {
throw new AuthenticationException("Server final message does not match calculated final message"); throw new AuthenticationException("Server final message does not match calculated final message");
} }
state = State.VALID_SERVER_RESPONSE; state = State.VALID_SERVER_RESPONSE;