rack-screen-door
Rack middleware for simple question and answer authorization.
This can be useful to add a thin veneer around website to help it stay semi-private, e.g., during the development stages.
WARNING: This is really poor security. Think of it as a...well...screen door.
Install
gem install rack-screen-door
Usage
For a Rack-based environment like Sinatra:
require 'rack/screen_door'
use Rack::ScreenDoor 'secret answer'
For Rails 3.x:
require 'rack/screen_door'
config.middleware.use Rack::ScreenDoor 'secret answer'
Additional options can be supplied:
use Rack::ScreenDoor 'secret answer',
:salt => 'some server-side secret',
:template_path => 'path/to/my_screen_door.html.erb',
:cookie_key => 'my_cookie_name',
:cookie_hash => { :domain => '.example.org', :secure => true },
:expires => 1.year,
:bypass_if => lambda { |request| request.path == '/safe_area' }
See default_template.html.erb as an example template file.