# File lib/omniauth/strategies/ldap/adaptor.rb, line 79
            def bind(options={})
              connect(options) unless connecting?
              begin
                    @bind_tried = true

                    bind_dn = (options[:bind_dn] || @bind_dn).to_s
                    try_sasl = options.has_key?(:try_sasl) ? options[:try_sasl] : @try_sasl
                    if options.has_key?(:allow_anonymous)
          allow_anonymous = options[:allow_anonymous]
        else
          allow_anonymous = @allow_anonymous
        end
            # Rough bind loop:
            # Attempt 1: SASL if available
            # Attempt 2: SIMPLE with credentials if password block
                        # Attempt 3: SIMPLE ANONYMOUS if 1 and 2 fail and allow anonymous is set to true            
            if try_sasl and sasl_bind(bind_dn, options)
                puts "bound with sasl"
            elsif simple_bind(bind_dn, options)
                puts "bound with simple"
                                                elsif allow_anonymous and bind_as_anonymous(options)
                                                        puts "bound as anonymous"
            else
              message = yield if block_given?
              message ||= ('All authentication methods for %s exhausted.') % target
              raise AuthenticationError, message
            end
    
            @bound = true
              rescue Net::LDAP::LdapError
                raise AuthenticationError, $!.message
              end
            end