# Authentication and Authorization

**URL:** <https://www.ruby-forum.com/t/authentication-and-authorization/91001>\
**Category:** Rails\
**Created:** [April 3, 2007, 6:30pm UTC](https://www.ruby-forum.com/t/authentication-and-authorization/91001 "2007-04-03T18:30:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 3, 2007, 6:30pm UTC](https://www.ruby-forum.com/t/authentication-and-authorization/91001/1 "2007-04-03T18:30:39Z")

</div>

Hi!

I have a question about authentication and authorization. I would  
like to authenticate users through apache, and pass their username  
across into rails. In rails, I have a table in my database called  
‘people’, a table called ‘groups’, and a table called ‘results’. I  
would like rails to look up the group\_id in the people table, and  
filter rows in the ‘results’ table based on the group\_id. I also have  
a ‘group\_id’ in the results table.

So, for example, if my login name was ‘bob’ and my group was ‘hr’  
with a group id of ‘1’, it would have ‘bob’ and ‘1’ in the people  
table, ‘1’ ‘hr’ in the group table, and ‘1’ in the results table.  
Then, when bob logs in, he would see just ‘hr’ information from the  
results table.

I was hoping somebody could recommend something or a ‘howto’ to do  
this. I stumbled upon some authentication programs, but it seems like  
they are either too advanced or either allow or deny somebody.

Thanks in advanced…

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 3, 2007, 6:36pm UTC](https://www.ruby-forum.com/t/authentication-and-authorization/91001/2 "2007-04-03T18:36:39Z")

</div>

Check out Coda Hale’s Simple HTTP Auth plugin. You should be able to  
accomplish what you want with it.

[http://blog.codahale.com/2006/05/11/basic-http-authentication-with-rails-simple\_http\_auth/](http://blog.codahale.com/2006/05/11/basic-http-authentication-with-rails-simple_http_auth/)
