}
// OK, let's go trough the authentication process.
try
{
// The authentication process may require a series of challenge-responses
CRLFTerminatedReader reader = sess.getReader();
String response = authHandler.auth(commandString);
if (response != null)
{
// challenge-response iteration
sess.sendResponse(response);
}
while (response != null)
{
String clientInput = reader.readLine();
if (clientInput.trim().equals(AUTH_CANCEL_COMMAND))
{
// RFC 2554 explicitly states this:
sess.sendResponse("501 Authentication canceled by client.");
return;