SaslMethod Class |
Namespace: MailBee
The SaslMethod type exposes the following members.
Name | Description | |
---|---|---|
SaslMethod | Initializes a new instance of the SaslMethod class |
Name | Description | |
---|---|---|
AccountDataIsPassword |
Designates if only the password must be set (password-only method).
| |
CreateNextClientAnswer |
When overridden in a derived class, generates client's next answer in the
authentication protocol exchange series.
| |
Dispose |
Disposes managed and unmananged resources used by the SASL mechanism.
| |
Dispose(Boolean) |
Actually disposes managed and unmananged resources used by the SASL mechanism.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetSaslID |
When overridden in a derived class, returns uppercase name of
a SASL method implemented by that class (such as "LOGIN", "NTLM", etc).
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
IsFipsCompliant |
Denotes if this authentication method is FIPS-compliant.
| |
IsSecure |
When overridden in a derived class, designates whether the implemented SASL mechanism
is secure or not.
| |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
RequiresCredentials |
Designates whether or not the implemented SASL mechanism can operate without user credentials
passed in AccountName and Password property values.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
AccountDomain |
Reserved for future use.
| |
AccountName |
Gets or sets a user account name on the mail server.
| |
ClientAnswer |
Gets or sets an array of bytes which represents a client answer to a server challenge.
| |
ClientAnswerEncoding |
Gets or sets an encoding of the client answer data.
| |
ExpectBase64Challenge |
Gets or sets the status of whether Base64-encoded data is expected in the pending
response from the server.
| |
Password |
Gets or sets a user account password on the mail server.
| |
ServerChallenge |
Gets or sets an array of bytes which represents a server challenge.
| |
ServerChallengeEncoding |
Gets or sets an encoding of the server challenge data.
| |
ServerName |
Gets the domain name of the mail server.
| |
ServiceName |
Gets the upper-case name of the protocol being used.
| |
Stage |
Gets or sets the current stage of the authentication protocol exchange.
| |
TargetName |
Gets the SPN (target name).
|
Instances of derived classes can be used with mailer classes such as Pop3, Imap or Smtp for employing non-standard login mechanisms.
Implementation of SASL authentication mechanism requires the developer to override the following methods:
Also, the developer can override RequiresCredentials method which returns true by default. This can be used for implementing an authentication method which can obtain user credentials itself and does not require AccountName and Password properties be set. For instance, MailBee implementation of NTLM method can obtain user credentials from the operating system when they are not supplied in AccountName and Password properties.// To use the code below, import MailBee namespaces at the top of your code using MailBee; using MailBee.Pop3Mail; // User-defined SASL LOGIN method implementation public class SaslLoginMethod : SaslMethod { public override string GetSaslID() { return "LOGIN"; } public override void CreateNextClientAnswer() { switch (Stage) { case 0: ClientAnswer = ClientAnswerEncoding.GetBytes(AccountName); Stage++; break; case 1: ClientAnswer = ClientAnswerEncoding.GetBytes(Password); Stage++; break; } } public override bool IsSecure() { return false; } } // User-defined SASL LOGIN method usage (put this code into an existing class of your application) Pop3 pop = new Pop3(); pop.Connect("mail.domain.com"); pop.Login("jdoe", "secret", AuthenticationMethods.SaslUserDefined, AuthenticationOptions.None, new SaslLoginMethod()); pop.Disconnect();