# Password Protecting Documents with Rails Authentication

**URL:** <https://www.ruby-forum.com/t/password-protecting-documents-with-rails-authentication/81815>\
**Category:** Rails\
**Created:** [January 15, 2007, 9:27am UTC](https://www.ruby-forum.com/t/password-protecting-documents-with-rails-authentication/81815 "2007-01-15T09:27:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrpunkin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b5a626/32.png) [@mrpunkin](https://www.ruby-forum.com/u/mrpunkin)\
**Post date:** [January 15, 2007, 9:27am UTC](https://www.ruby-forum.com/t/password-protecting-documents-with-rails-authentication/81815/1 "2007-01-15T09:27:37Z")

</div>

Hello all,

I’m working on a project which involves users uploading and downloading  
documents. I am using the file\_column plugin to do this.

The file\_column device stores the documents in the public folder, in the  
folder documents. What I would like to do is require that a user be  
authorized before they download a document from that directory. What  
suggestions do you have on the best way to go about this?

My thought is to create a controller that intercepts all requests for  
that directory, and then if the user is logged in it will allow the  
download by passing the data manually. I really wish there were a more  
elegant method, however.

Thanks

---

<div class="post-metadata">

**Author:** ![mrpunkin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b5a626/32.png) [@mrpunkin](https://www.ruby-forum.com/u/mrpunkin)\
**Post date:** [January 15, 2007, 12:51pm UTC](https://www.ruby-forum.com/t/password-protecting-documents-with-rails-authentication/81815/2 "2007-01-15T12:51:04Z")

</div>

Helo Bryan,

If you are using lighttpd then check out

[http://trac.lighttpd.net/trac/wiki/Docs%3AModSecDownload](http://trac.lighttpd.net/trac/wiki/Docs%3AModSecDownload)

I used it for image download website successfully. It is  
straightforward.

Good luck  
Gokhan A.  
[www.sylow.net](http://www.sylow.net)

Bryan C. wrote:

> Hello all,
> 
> I’m working on a project which involves users uploading and downloading  
> documents. I am using the file\_column plugin to do this.
> 
> The file\_column device stores the documents in the public folder, in the  
> folder documents. What I would like to do is require that a user be  
> authorized before they download a document from that directory. What  
> suggestions do you have on the best way to go about this?
> 
> My thought is to create a controller that intercepts all requests for  
> that directory, and then if the user is logged in it will allow the  
> download by passing the data manually. I really wish there were a more  
> elegant method, however.
> 
> Thanks

---

<div class="post-metadata">

**Author:** ![mrpunkin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b5a626/32.png) [@mrpunkin](https://www.ruby-forum.com/u/mrpunkin)\
**Post date:** [January 19, 2007, 4:30pm UTC](https://www.ruby-forum.com/t/password-protecting-documents-with-rails-authentication/81815/3 "2007-01-19T16:30:20Z")

</div>

Hey,

There is a bit of discussion about this on this post:  
[http://groups.google.co.uk/group/rubyonrails-talk/browse\_thread/thread/9b94c53a6733e596/f3d5aa3a8beb82c4?lnk=gst&q=protect+files+directory&rnum=1&hl=en#f3d5aa3a8beb82c4](http://groups.google.co.uk/group/rubyonrails-talk/browse_thread/thread/9b94c53a6733e596/f3d5aa3a8beb82c4?lnk=gst&q=protect+files+directory&rnum=1&hl=en#f3d5aa3a8beb82c4)

Steve
