MailBee.NET Objects 4.0

SaslMethod.CreateNextClientAnswer Method 

When overridden in a derived class, generates client's next answer in the authentication protocol exchange series.

public abstract void CreateNextClientAnswer();

Remarks

This method must implement SASL authentication mechanism as generating answer to the server challenge. The server challenge must be read from ServerChallenge property. The resulting answer must be put in ClientAnswer property value.

If SASL mechanism being implemented requires more than one client answer in the series, Stage property can be read and modified by this method in order to keep track of the authentication protocol exchange progress.

Example

This sample shows CreateNextClientAnswer implementation for SASL PLAIN authentication method.

[C#]
public override void CreateNextClientAnswer()
{
    switch (Stage)
    {
        case 0:
            ClientAnswer = ClientAnswerEncoding.GetBytes("\0" + AccountName + "\0" + Password);
            Stage++;
            break;
    }
}
[Visual Basic]
Public Overloads Overrides Sub CreateNextClientAnswer()
    Select Case Stage
        Case 0
            ClientAnswer = ClientAnswerEncoding.GetBytes(String.Format("\0{0}\0{1}", AccountName, Password))
            Stage += 1
    End Select
End Sub

See Also

SaslMethod Class | MailBee Namespace