------art_3978_6404739.1190831446548
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 9/26/07, Arlen Christian Mart Cuss <celtic / sairyx.org> wrote:
>
>
> On Tue, 2007-09-25 at 04:06 +0900, Martin DeMello wrote:
>
> > Is there any ruby library that will let me authenticate against an
> > active directory server from a linux machine? I looked through the AD
> > gems but the documentation assumed that I knew what I was doing
> > already, and *seemed* to imply that I needed to be running this from a
> > windows box sitting in a windows domain.
>
>
>
> I recently had this problem.



Some users have found Net::LDAP simpler because it doesn't require the
installation of an outboard LDAP library. Here's how the equivalent solution
might look in Net::LDAP (as you said, "your schema may vary"):


require 'rubygems'
require 'net/ldap'

ldap  et::LDAP.new
ldap.host  our_server_ip_address
ldap.port  our_server_port # typically 389 or 3268 for A/D
ldap.auth "CNhn Smith,CNers,dcurcompany,dc", "a-password"

ldap.search(
            :filtersAMAccountNamehn Smith",
            :attributes:memberOf],
            :basecners,dcurcompany,dcą┐m",
           ) {|entry|
     p entry[:memberof]
}

------art_3978_6404739.1190831446548--