require ::File.dirname(__FILE__) + '/cerberus' use Rack::Session::Cookie, :secret => 'change_me' F = ::File 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', :fg_color => 'red', :css_location => '/css'} 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 map '/css' do run lambda {|env| path = F.expand_path('./example.css') [200, {'Content-Type' => 'text/css', "Last-Modified" => F.mtime(path).httpdate, "Content-Length" => F.size?(path).to_s}, [F.read(path)]] } end