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
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to