# Invalid binding information

**URL:** <https://www.ruby-forum.com/t/invalid-binding-information/172122>\
**Category:** Rails\
**Created:** [July 15, 2009, 7:38am UTC](https://www.ruby-forum.com/t/invalid-binding-information/172122 "2009-07-15T07:38:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mushi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5fc32e/32.png) [@mushi](https://www.ruby-forum.com/u/mushi)\
**Post date:** [July 15, 2009, 7:38am UTC](https://www.ruby-forum.com/t/invalid-binding-information/172122/1 "2009-07-15T07:38:43Z")

</div>

Hello everyone  
i am working on a web application where i need to authenticate our  
company user’s with our active directory/ldap server.

i am using ruby-net-ldap gem for that purpose and getting the following  
error

Net::LDAP::LdapError in LoginController#authenticate  
“invalid binding information”

# Application Trace

/home/mubashir/.gem/ruby/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb:1097:in  
`bind' /home/mubashir/.gem/ruby/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb:701:in`bind’  
/home/mubashir/mis/lib/ldap\_connect.rb:9:in `authenticate' /home/mubashir/mis/app/controllers/login_controller.rb:10:in`authenticate’

=====================================================================  
Here is the flow of my program  
i ve put ldap\_connect.rb in my lib folder with the following code

require ‘net/ldap’  
module LDAP  
def self.authenticate(user, password)  
if user == “” || password == “”  
return false  
end  
ldap\_con = Net::LDAP.new({:host =\> ‘203.155.2.3’,  
:auth=\>{:method=\>:simple,:username =\> user,:password =\>  
password } } )  
return true if ldap\_con.bind  
return false  
end  
end

And in my login controller in have put the following method

def authenticate  
if session[:person] == LDAP.authenticate(params[:login][:name],  
params[:login][:password])  
session[:username]=params[:login][:name]  
redirect\_to :controller =\> ‘application’  
else  
flash[:notice] = “Login failed!”  
redirect\_to :action =\> “index”  
end  
end

WOuld any body help me, how i can solve this issue.

Thanks
