I am trying to authenticate user against Windows 2003 AD. This is what I
have found so far, but what ever I do I get error:
#<LDAP::ResultError: Invalid credentials>
This is my source code, which I picked sowhere on net:
require “ldap”
Provides access to authenticate user from LDAP using the user provided
def initialize (host = LDAP_HOST, version = PROTOCOL_VERSION)
super( host, LDAP_PORT )
set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, version )
return self
end
Bind with the user supplied information
def bind(mydn, pass)
dn = “uid=” + mydn + “,” + PEOPLE_DN
super( dn, pass )
end
end
#** user.rb **
Takes user login name and password and connects to LDAP
def login(login, password)
if password == ‘’
return false
end
begin
conn = MyLDAP.new.bind(login, password)
rescue => e
puts e.inspect
return false
end
return conn.bound?
conn.unbind
end
puts login(‘myusr’,‘mypwd’)
Is there anything that needs to bo be set on Windows server?
On Fri, Oct 24, 2008 at 6:15 AM, F. Senault [email protected] wrote:
Well, it’s not always simple. With an OpenLDAP setup :
(Shmuel (Seymour J.) Metz in NANAE)
I was having trouble authenticating against 2003 in the past. I fixed
it by
submitting the full email address for the account as the login. I
believe
it has to be in the form of [email protected]
–
“Hey brother Christian with your high and mighty errand, Your actions
speak
so loud, I can’t hear a word you’re saying.”
I was having trouble authenticating against 2003 in the past. I fixed it by
submitting the full email address for the account as the login. I believe
it has to be in the form of [email protected]
(Technically not email address, but UPN; which is generally what I use
instead of DN when working in AD-land.) I don’t have the net-ldap
code I am currently using handy, but here was an older example with
ruby-ldap:
Sorry Damjan, I didn’t read your first message closely enough. Had I
noticed you weren’t using net-ldap I would have suggested you do so. It
works great for me with all things AD and LDAP (all things I’ve done
anyway).