apiaryio/protected-s3 — pull request #2 by XVincentX (2014-08-23 14:49:03+00:00)
Title: Solving issue #1

Actually when you have to login for an unauthenticated request, you get redirected to the default bucket page, losing your original URL.

To solve this, I have removed the old authentication check and replaced with **connect_ensure_login** that will take care of save original requested resource into a cookie, and pop it back once you're logged in.

Usually I do not like to store this kind of information into session. To be honest, I do not like session at all.
My preferred approach is, according to WS-* protocols suite, to append the original returnUrl into a query string parameter and work on that one.
However, since the application is already using the session [here](https://github.com/XVincentX/protected-s3/blob/master/app.coffee#L26-L28), it would be a waste of resource implement that kind of mechanism.

It has been deployed for test [here](http://protected-s3.herokuapp.com), and looks like working now.

V.