Ejemplo n.º 1
0
        public static SMTPResponse HandleResponse(SMTPTransaction transaction, string decodedReponse, IAuthMethod method)
        {
            string challenge;

            if (!method.ProcessResponse(transaction, decodedReponse, out challenge))
            {
                return(new SMTPResponse(SMTPStatusCode.AuthFailed, challenge != null ? new[] { challenge } : new string[0]));
            }

            if (challenge != null)
            {
                transaction.StartDataMode(DataLineHandler, s => DataHandler(transaction, s, method));

                return(new SMTPResponse(SMTPStatusCode.AuthContinue, Base64Encode(challenge)));
            }

            transaction.SetProperty("Authenticated", true, true);

            return(new SMTPResponse(SMTPStatusCode.AuthSuccess));
        }