<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -5,7 +5,7 @@ require 'openid/store/filesystem'
 
 module Chowder
   class Base &lt; Sinatra::Base
-    enable :sessions
+    disable :raise_errors
 
     LOGIN_VIEW = &lt;&lt;-HTML
       &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
@@ -38,9 +38,14 @@ module Chowder
       &lt;/body&gt;&lt;/html&gt;
     HTML
 
-    # Override this until in Sinatra supports it. See
-    # http://sinatra.lighthouseapp.com/projects/9779/tickets/160
-    def initialize(app=nil, *args, &amp;block)
+    def self.new(app=nil, args={}, &amp;block)
+      builder = Rack::Builder.new
+      builder.use Rack::Session::Cookie, :secret =&gt; args[:secret]
+      builder.run super
+      builder.to_app
+    end
+
+    def initialize(app=nil, args={}, &amp;block)
       @app = app
       @middleware = OpenStruct.new(:args =&gt; args, :block =&gt; block)
     end</diff>
      <filename>lib/chowder.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,6 +5,12 @@ class MyApp &lt; Sinatra::Base
     redirect '/login' unless session[:current_user]
     &quot;protected area&quot;
   end
+
+  get '/alternate_path' do
+    session[:return_to] = '/alternate_path'
+    redirect '/login' unless session[:current_user]
+    &quot;alternate protected area&quot;
+  end
 end
 
 module ChowderTest
@@ -17,20 +23,24 @@ class TestBasic &lt; Test::Unit::TestCase
     Chowder::Basic.set :environment, :test
 
     @app = Rack::Builder.new {
-      use Chowder::Basic do |login, password|
+      use Chowder::Basic, :secret =&gt; 'shhhh' do |login, password|
         login == &quot;harry&quot; &amp;&amp; password == &quot;clam&quot;
       end
       run MyApp
     }
   end
 
+  def login!
+    post '/login', :login =&gt; 'harry', :password =&gt; 'clam'
+  end
+
   def test_shows_login_page
     get '/login'
     assert_match /Login/, last_response.body
   end
 
   def test_redirects_on_authentication_success
-    post '/login', :login =&gt; 'harry', 'password' =&gt; 'clam'
+    login!
     assert_equal 302, last_response.status
     assert_equal '/', last_response.headers['Location']
   end
@@ -42,14 +52,15 @@ class TestBasic &lt; Test::Unit::TestCase
   end
 
   def test_redirects_to_specified_URL_after_login
-    post '/login', {:login =&gt; 'harry', 'password' =&gt; 'clam'},
-      &quot;rack.session&quot; =&gt; {:return_to =&gt; '/awesome_place'}
+    get '/alternate_path'
+    login!
     assert_equal 302, last_response.status
-    assert_equal '/awesome_place', last_response.headers['Location']
+    assert_equal '/alternate_path', last_response.headers['Location']
   end
 
   def test_allows_authenticated_users
-    get '/', {}, &quot;rack.session&quot; =&gt; {:current_user =&gt; &quot;harry&quot;}
+    login!
+    get '/', {}
     assert_equal &quot;protected area&quot;, last_response.body
   end
 </diff>
      <filename>test/test_basic.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a631347b0c06c592eefa89e431bdfe0f088ff3a1</id>
    </parent>
  </parents>
  <author>
    <name>Sam Merritt</name>
    <email>spam@andcheese.org</email>
  </author>
  <url>http://github.com/ichverstehe/chowder/commit/cadf61ffe932c6d26a6d9d820b592d052248a4fd</url>
  <id>cadf61ffe932c6d26a6d9d820b592d052248a4fd</id>
  <committed-date>2009-10-27T18:02:01-07:00</committed-date>
  <authored-date>2009-10-27T18:01:58-07:00</authored-date>
  <message>Check integrity of session cookie</message>
  <tree>0b9a070c7de0cc3478b0431963b68c7fdd417a6c</tree>
  <committer>
    <name>Sam Merritt</name>
    <email>spam@andcheese.org</email>
  </committer>
</commit>
