# Authentication question

**URL:** <https://www.ruby-forum.com/t/authentication-question/70539>\
**Category:** Rails\
**Created:** [September 29, 2006, 9:59pm UTC](https://www.ruby-forum.com/t/authentication-question/70539 "2006-09-29T21:59:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Moody](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc8723/32.png) [@John\_Moody](https://www.ruby-forum.com/u/John_Moody)\
**Post date:** [September 29, 2006, 9:59pm UTC](https://www.ruby-forum.com/t/authentication-question/70539/1 "2006-09-29T21:59:38Z")

</div>

I have a slightly odd need, and since I’m still somewhat new to Rails,  
I’d love your feedback.

My app has a set of public stuff, (which will live at  
[www.mydomain.com](http://www.mydomain.com)), a set of admin pages (which will live at  
[admin.mydomain.com](http://admin.mydomain.com)), and the bulk of the app, which will live at  
[subdomain.mydomain.com](http://subdomain.mydomain.com), where “subdomain” is chosen by the user when  
they sign up for my service. For the users, they’ll be authenticated  
against the combination of the subdomain and their supplied username  
and password - each subdomain has its own set of users which are not  
shared with other subdomains.

I’m trying to figure out how to set up my controllers and  
authentication code to make all of this work. My tentative approach is  
to use the Request Routing plugin to set up specific routes for “www”  
and “admin” subdomains, routing them to special controllers with  
special authentication strategies (none for www, separate user list for  
admin), then locking down all other controllers with a before\_filter to  
validate against both subdomain and username/PW.

Is this the right approach, or can someone point me to a more  
enlightened one?

- John
