How do I use a custom cookie session serializer in Rack?
- by Damien Wilson
Hello SO.
I'm currently integrating Warden into a new Rack application I'm building. I'd like to implement a recent patch to Rack that allows me to specify how sessions are serialized; specifically, I'd like to use Rack::Session::Cookie::Identity as the session processor.
Unfortunately, the documentation is a little unclear as to what syntax I should use to configure Rack::Session::Cookie in my rackup file, can anyone here tell me what I'm doing wrong?
config.ru
require 'my_sinatra_app'
app = self
use Rack::Session::Cookie.new(app, Rack::Session::Cookie::Identity.new), {:key => "auth_token"}
use Warden::Manager do |warden| # Must come AFTER Rack::Session
warden.default_strategies :password
warden.failure_app Jelli::Auth.run!
end
run MySinatraApp
error message from thin
!! Unexpected error while processing request: undefined method `new' for #<Rack::Session::Cookie:0x00000110124128>
PS: I'm using bundler to manage my gem dependencies and I've likewise included rack's master branch as the desired version.
Update: As suggested in the comments below, I have read the documentation; sadly the suggested syntax in the docs is not working.
Update: Still no luck on my end; offering up a bounty to whoever can help me figure this out.