require ::File.dirname(__FILE__) + '/cerberus'
use Rack::Session::Cookie
map '/' do
run lambda {|env|
body = <<-EOB.strip
Cerberus
This page is public, so you can see it. But what happens if you want to see a Secret Page? Nevertheless, I can give you access:
Login: mario
Pass: bros
EOB
[200, {'Content-Type' => 'text/html'}, body]
}
end
map '/secret' do
use Cerberus, {:company_name => 'Nintendo'} do |login,pass|
[login,pass]==['mario','bros']
end
run lambda {|env|
[200, {'Content-Type' => 'text/plain'}, 'Welcome back Mario. Your Credit Card number is: 9292']
}
end