Forum: Ruby on Rails Rails and Windows Active Directory Authentication?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D8a73413e857b19edefc61b826d2cf32?d=identicon&s=25 Mike (Guest)
on 2006-02-21 19:16
(Received via mailing list)
Hello All, I know there is a component for integrating LDAP with Rails
but
is anyone doing any Windows Active Directory Authentication to a Rails
app?

I am rebuilding a site that was constructed out of asp and I would like
to
rebuild/improve it via rails. On the requirements side I will need to
communicate with Active Directory and I will be required to use MSSQL
for
the database. Can anyone point me towards some tutorials, examples etc.
where I can see how others are tackling issues with bringing Rails into
an
MS dominant enterprise. I may be able to convince the managers to allow
me
to bring in a server that's configured with Linux, Lighty and FCGI or
SCGI
but I will still need to contend with AD Authentication and legacy data
stored on several MSSQL servers. Any guidance will be much appreciated.

I need to log in via AD and then set  various session variables that
will/can be used throughout a users session. Any examples?

Thank you!
E0c987f680cd640c14912ebfbf0f0f07?d=identicon&s=25 unknown (Guest)
on 2006-02-21 19:43
(Received via mailing list)
> On the requirements side I will need to
> communicate with Active Directory and I will be required to use MSSQL for
> the database. Can anyone point me towards some tutorials, examples etc.
> where I can see how others are tackling issues with bringing Rails into an
> MS dominant enterprise.

For MS AD authentication I am currently using:
  * Installed ruby-ldap
  * Installed login_generator gem and let the generator build its basic
setup
  * Modified the generated user model:
        require 'ldap'
        require 'ldap/control'

        class User
          def self.authenticate(username, password)
            return false if username.to_s.size == 0
            return false if password.to_s.size == 0

            conn = LDAP::Conn.new("<AD SERVER NAME>", 389)

            conn.set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, 3 )

            begin
              conn.simple_bind(username, password)
            rescue
              return false
            end

            return conn.bound?
          end
        end

For access to MSSQL (from rails on Linux), I did use:
  * Installed and configured ODBC on the Linux box to connect to MS SQL
  * Used an adapted ActiveRecord connection adapter:
        # odbc_adapter.rb -- ActiveRecord adapter for ODBC
        #
        # adapted from:
        #   sqlserver_adapter.rb -- ActiveRecord adapter for Microsoft
SQL Server
        #
        #   Author: Joey Gibson <joey@joeygibson.com>
        #   Date:   10/14/2004
        #
        #   Modifications: DeLynn Berry <delynnb@megastarfinancial.com>
        #   Date: 3/22/2005
25e11a00a89683f7e01e425a1a6e305c?d=identicon&s=25 Wilson Bilkovich (Guest)
on 2006-02-21 23:40
(Received via mailing list)
On 2/21/06, brabuhr@gmail.com <brabuhr@gmail.com> wrote:
> > On the requirements side I will need to
> > communicate with Active Directory and I will be required to use MSSQL for
> > the database. Can anyone point me towards some tutorials, examples etc.
> > where I can see how others are tackling issues with bringing Rails into an
> > MS dominant enterprise.
>
> For MS AD authentication I am currently using:
>   * Installed ruby-ldap
>   * Installed login_generator gem and let the generator build its basic setup

You're doing this from Linux, right?  To my knowledge, Ruby/LDAP still
doesn't work on Windows.  With the help of the maintainer, I finally
managed to make it build, but it instantly segfaults the interpreter
when you touch it in any way.
E0c987f680cd640c14912ebfbf0f0f07?d=identicon&s=25 unknown (Guest)
on 2006-02-22 00:08
(Received via mailing list)
> > For MS AD authentication I am currently using:
> >   * Installed ruby-ldap
> >   * Installed login_generator gem and let the generator build its basic setup
>
> You're doing this from Linux, right?  To my knowledge, Ruby/LDAP still
> doesn't work on Windows.  With the help of the maintainer, I finally
> managed to make it build, but it instantly segfaults the interpreter
> when you touch it in any way.

Yes, Linux.
This topic is locked and can not be replied to.