Sha256: 969f76460ae09aa69f5feb66e88bc241cdfb3445c53fb2600e90473d7f03b632

Contents?: true

Size: 690 Bytes

Versions: 2

Compression:

Stored size: 690 Bytes

Contents

require ::File.dirname(__FILE__) + '/cerberus'
use Rack::Session::Cookie

map '/' do
  run lambda {|env|
    body = "<html><head><title>Cerberus</title></head><body>This page is public, so you can see it. But what happens if you want to see a <a href='/secret'>Secret Page</a>? Nevertheless, I can give you access:<br /><br />Login: <b>mario</b><br />Pass: <b>bros</b></body></html>"
    [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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rack-cerberus-0.1.0 example.ru
rack-cerberus-0.0.1 example.ru