# Authenticating users on different sources

**URL:** <https://www.ruby-forum.com/t/authenticating-users-on-different-sources/157179>\
**Category:** Rails\
**Created:** [January 8, 2009, 6:34am UTC](https://www.ruby-forum.com/t/authenticating-users-on-different-sources/157179 "2009-01-08T06:34:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtibu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jtibu](https://www.ruby-forum.com/u/jtibu)\
**Post date:** [January 8, 2009, 6:34am UTC](https://www.ruby-forum.com/t/authenticating-users-on-different-sources/157179/1 "2009-01-08T06:34:39Z")

</div>

Hi there folks!

I need to authenticate users on different sources (for instance, local  
database and Active Directory), and make registration (on local db)  
possible  
for users who don’t have an AD account…

For the db authentication, I have chosen restful\_authentication. This  
way,  
new users who are not part of the organization are able to register and  
use  
the application.

But for the AD auth, I don’t know how to implement it yet.

I thought about creating some additional methods on sessions controller  
to  
take care of this AD authentication process if the user selects the  
option  
of using it’s existing AD account on the login page.

Have anyone experimented this scenario?

If so, what tips do you have for me?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![jtibu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jtibu](https://www.ruby-forum.com/u/jtibu)\
**Post date:** [January 8, 2009, 9:47am UTC](https://www.ruby-forum.com/t/authenticating-users-on-different-sources/157179/2 "2009-01-08T09:47:23Z")

</div>

Hi,

I have implemented an application which can authenticate users against  
db  
auth or Active Directory based on the configuration set by the admin.  
But  
this works either one at a time, not both together.

For this all the methods for auth, signup etc had checks for AD/ DB and  
perform authentication appropriately.  
Please let me know if you need any more help

- NAYAK

On Thu, Jan 8, 2009 at 11:03 AM, JosÃ© Tiburcio Ribeiro N. \<

---

<div class="post-metadata">

**Author:** ![jtibu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jtibu](https://www.ruby-forum.com/u/jtibu)\
**Post date:** [January 8, 2009, 9:47am UTC](https://www.ruby-forum.com/t/authenticating-users-on-different-sources/157179/3 "2009-01-08T09:47:59Z")

</div>

Hi,

I have implemented an application which can authenticate users against  
db  
auth or Active Directory based on the configuration set by the admin.  
But  
this works either one at a time, not both together.

For this all the methods for auth, signup etc had checks for AD/ DB and  
perform authentication appropriately.  
Please let me know if you need any more help

- NAYAK

On Thu, Jan 8, 2009 at 11:03 AM, JosÃ© Tiburcio Ribeiro N. \<

---

<div class="post-metadata">

**Author:** ![jtibu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jtibu](https://www.ruby-forum.com/u/jtibu)\
**Post date:** [January 9, 2009, 7:30am UTC](https://www.ruby-forum.com/t/authenticating-users-on-different-sources/157179/4 "2009-01-09T07:30:14Z")

</div>

Hi,

Can you have two diferent login pages then, else you can do the same by  
first authenticating with DB if it fails only then with AD

NAYAK

On Fri, Jan 9, 2009 at 6:55 AM, JosÃ© Tiburcio Ribeiro N. \<  
removed\_email\_address@domain.invalid\> wrote:

> > For this all the methods for auth, signup etc had checks for AD/ DB and
> > 
> > > I need to authenticate users on different sources (for instance, local  
> > > to take care of this AD authentication process if the user selects the
> 
> >

–

- NAYAK

---

<div class="post-metadata">

**Author:** ![jtibu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jtibu](https://www.ruby-forum.com/u/jtibu)\
**Post date:** [January 9, 2009, 2:26am UTC](https://www.ruby-forum.com/t/authenticating-users-on-different-sources/157179/5 "2009-01-09T02:26:35Z")

</div>

Hi NAYAK!

Interesting, but I need both of them authenticating the same time.

The AD for the staff and other people of the organization, and db for  
people  
outside of the organization.

I will try something and if it works, I will post here.

Thanks for your response!
