C# Class MailKit.Security.SaslMechanism

A SASL authentication mechanism.
Authenticating via a SASL mechanism may be a multi-step process. To determine if the mechanism has completed the necessary steps to authentication, check the IsAuthenticated after each call to Challenge(string).
Mostrar archivo Open project: jstedfast/MailKit

Public Properties

Property Type Description
AuthMechanismRank string[]

Public Methods

Method Description
Challenge ( string token ) : string

Decodes the base64-encoded server challenge and returns the next challenge response encoded in base64.

Decodes the base64-encoded server challenge and returns the next challenge response encoded in base64.

Create ( string mechanism, Uri uri, ICredentials credentials ) : SaslMechanism

Create an instance of the specified SASL mechanism using the uri and credentials.

If unsure that a particular SASL mechanism is supported, you should first call IsSupported.

Create ( string mechanism, Uri uri, Portable.Text.Encoding encoding, ICredentials credentials ) : SaslMechanism

Create an instance of the specified SASL mechanism using the uri and credentials.

If unsure that a particular SASL mechanism is supported, you should first call IsSupported.

IsSupported ( string mechanism ) : bool

Determines if the specified SASL mechanism is supported by MailKit.

Use this method to make sure that a SASL mechanism is supported before calling Create(string,Uri,ICredentials).

Reset ( ) : void

Resets the state of the SASL mechanism.

Resets the state of the SASL mechanism.

SaslPrep ( string s ) : string

Prepares the user name or password string.

Prepares a user name or password string according to the rules of rfc4013.

Protected Methods

Method Description
Challenge ( byte token, int startIndex, int length ) : byte[]

Parses the server's challenge token and returns the next challenge response.

Parses the server's challenge token and returns the next challenge response.

SaslMechanism ( Uri uri, ICredentials credentials ) : System

Initializes a new instance of the MailKit.Security.SaslMechanism class.

Creates a new SASL context.

Private Methods

Method Description
IsCommonlyMappedToNothing ( char c ) : bool

Determines if the character is commonly mapped to nothing.

This list was obtained from http://tools.ietf.org/html/rfc3454#appendix-B.1

IsNonAsciiSpace ( char c ) : bool

Determines if the character is a non-ASCII space.

This list was obtained from http://tools.ietf.org/html/rfc3454#appendix-C.1.2

IsProhibited ( string s, int index ) : bool

Determines if the character is prohibited.

This list was obtained from http://tools.ietf.org/html/rfc3454#appendix-C.3

Method Details

Challenge() protected abstract method

Parses the server's challenge token and returns the next challenge response.
Parses the server's challenge token and returns the next challenge response.
/// The SASL mechanism is already authenticated. /// /// THe SASL mechanism does not support SASL-IR. /// /// An error has occurred while parsing the server's challenge token. ///
protected abstract Challenge ( byte token, int startIndex, int length ) : byte[]
token byte The server's challenge token.
startIndex int The index into the token specifying where the server's challenge begins.
length int The length of the server's challenge.
return byte[]

Challenge() public method

Decodes the base64-encoded server challenge and returns the next challenge response encoded in base64.
Decodes the base64-encoded server challenge and returns the next challenge response encoded in base64.
/// The SASL mechanism is already authenticated. /// /// THe SASL mechanism does not support SASL-IR. /// /// An error has occurred while parsing the server's challenge token. ///
public Challenge ( string token ) : string
token string The server's base64-encoded challenge token.
return string

Create() public static method

Create an instance of the specified SASL mechanism using the uri and credentials.
If unsure that a particular SASL mechanism is supported, you should first call IsSupported.
/// is null. /// -or- /// is null. /// -or- /// is null. ///
public static Create ( string mechanism, Uri uri, ICredentials credentials ) : SaslMechanism
mechanism string The name of the SASL mechanism.
uri System.Uri The URI of the service to authenticate against.
credentials ICredentials The user's credentials.
return SaslMechanism

Create() public static method

Create an instance of the specified SASL mechanism using the uri and credentials.
If unsure that a particular SASL mechanism is supported, you should first call IsSupported.
/// is null. /// -or- /// is null. /// -or- /// is null. /// -or- /// is null. ///
public static Create ( string mechanism, Uri uri, Portable.Text.Encoding encoding, ICredentials credentials ) : SaslMechanism
mechanism string The name of the SASL mechanism.
uri System.Uri The URI of the service to authenticate against.
encoding Portable.Text.Encoding The text encoding to use for the credentials.
credentials ICredentials The user's credentials.
return SaslMechanism

IsSupported() public static method

Determines if the specified SASL mechanism is supported by MailKit.
Use this method to make sure that a SASL mechanism is supported before calling Create(string,Uri,ICredentials).
/// is null. ///
public static IsSupported ( string mechanism ) : bool
mechanism string The name of the SASL mechanism.
return bool

Reset() public method

Resets the state of the SASL mechanism.
Resets the state of the SASL mechanism.
public Reset ( ) : void
return void

SaslMechanism() protected method

Initializes a new instance of the MailKit.Security.SaslMechanism class.
Creates a new SASL context.
/// is null. /// -or- /// is null. ///
protected SaslMechanism ( Uri uri, ICredentials credentials ) : System
uri System.Uri The URI of the service.
credentials ICredentials The user's credentials.
return System

SaslPrep() public static method

Prepares the user name or password string.
Prepares a user name or password string according to the rules of rfc4013.
/// is null. /// /// contains prohibited characters. ///
public static SaslPrep ( string s ) : string
s string The string to prepare.
return string

Property Details

AuthMechanismRank public_oe static_oe property

The supported authentication mechanisms in order of strongest to weakest.
Used by the various clients when authenticating via SASL to determine which order the SASL mechanisms supported by the server should be tried.
public static string[] AuthMechanismRank
return string[]