Esempio n. 1
0
        /// <summary>
        ///   Authenticates the client to the server using the XOAUTH mechanism.
        /// </summary>
        /// <param name = "key">The XOAUTH authetication key.</param>
        /// <returns>Returns true on success, false otherwise.</returns>
        public bool AuthenticateXOAuth(string key)
        {
            var authenticator = new ImapAuthenticator(this);

            IsAuthenticated = authenticator.AuthenticateXOAuth(key);
            return(IsAuthenticated);
        }
Esempio n. 2
0
        /// <summary>
        ///   Authenticates the client to the server using the best supported SASL mechanism.
        /// </summary>
        /// <param name = "credentials">The user credentials.</param>
        /// <param name = "mechanic">The SASL mechanism to use. This param is optional and can be left blank (0x0000), if done so, the best fitting mechanism will be chosen automatically.</param>
        /// <returns>Returns true on success, false otherwise.</returns>
        public bool Authenticate(NetworkCredential credentials, SaslMechanics mechanic = (SaslMechanics)0x0000)
        {
            var authenticator = new ImapAuthenticator(this);

            if (mechanic != 0x0000)
            {
                IsAuthenticated = authenticator.Authenticate(credentials, mechanic);
                return(IsAuthenticated);
            }

            IsAuthenticated = authenticator.CanAuthenticate
                                  ? authenticator.Authenticate(credentials)
                                  : InvokeManualSaslAuthenticationRequired(credentials, this);

            return(IsAuthenticated);
        }
Esempio n. 3
0
 /// <summary>
 ///   Authenticates the client to the server using the XOAUTH mechanism.
 /// </summary>
 /// <param name = "key">The XOAUTH authetication key.</param>
 /// <returns>Returns true on success, false otherwise.</returns>
 public bool AuthenticateXOAuth(string key)
 {
     var authenticator = new ImapAuthenticator(this);
     IsAuthenticated = authenticator.AuthenticateXOAuth(key);
     return IsAuthenticated;
 }
Esempio n. 4
0
        /// <summary>
        ///   Authenticates the client to the server using the best supported SASL mechanism.
        /// </summary>
        /// <param name = "credentials">The user credentials.</param>
        /// <param name = "mechanic">The SASL mechanism to use. This param is optional and can be left blank (0x0000), if done so, the best fitting mechanism will be chosen automatically.</param>
        /// <returns>Returns true on success, false otherwise.</returns>
        public bool Authenticate(NetworkCredential credentials, SaslMechanics mechanic = (SaslMechanics) 0x0000)
        {
            var authenticator = new ImapAuthenticator(this);
            if (mechanic != 0x0000) {
                IsAuthenticated = authenticator.Authenticate(credentials, mechanic);
                return IsAuthenticated;
            }

            IsAuthenticated = authenticator.CanAuthenticate
                                  ? authenticator.Authenticate(credentials)
                                  : InvokeManualSaslAuthenticationRequired(credentials, this);

            return IsAuthenticated;
        }