This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
LICENSE | ||
| |
README.rdoc | ||
| |
Rakefile | ||
| |
VERSION.yml | ||
| |
authentication-needed-san.gemspec | ||
| |
lib/ | ||
| |
rails/ | ||
| |
test/ |
README.rdoc
AuthenticationNeededSan
A thin wrapper around the Rails ‘flash’ object, to assist in redirecting a user ‘back’ to the page she originally requested.
For more info see the AuthenticationNeededSan class documentation.
Example
Consider an application which uses the authorization-san plugin. The ApplicationController would look something like the following:
class ApplicationController < ActionController::Base
# If nobody was logged in and this resource is not accessable by all,
# request authentication. Otherwise reply that the resource is forbidden.
def access_forbidden
# If the user is logged in and still can't view the page, we have to tell
# them access is forbidden.
if !@authenticated.nil?
send_response_document :forbidden
else
authentication_needed!
end
end
def when_authentication_needed
redirect_to new_session_url
end
end
Then from your sessions controller redirect the user back to the page she requested or the default one:
class SessionsController < ApplicationController
def create
# login code...
finish_authentication_needed! or redirect_to(root_url)
end
end
The authorization-san plugin is available at: github.com/Fingertips/authorization-san








