/// <summary> /// Authenticates the specified connection. /// </summary> /// <param name="connection">The connection.</param> /// <exception cref="System.Security.Authentication.AuthenticationException"></exception> private void Authenticate(IConnection connection) { if (!connection.IsAuthenticated) { if (_saslMechanism != null) { var result = _saslMechanism.Authenticate(connection); if (result) { Log.Debug( m => m("Authenticated {0} using {1} - {2}.", _saslMechanism.Username, _saslMechanism.GetType(), _identity)); connection.IsAuthenticated = true; } else { Log.Debug( m => m("Could not authenticate {0} using {1} - {2}.", _saslMechanism.Username, _saslMechanism.GetType(), _identity)); throw new AuthenticationException(_saslMechanism.Username); } } } }
private void Authenticate(IConnection connection) { if (_saslMechanism != null) { var result = _saslMechanism.Authenticate(connection); if (result) { connection.IsAuthenticated = true; } else { throw new AuthenticationException(_saslMechanism.Username); } } }