Sha256: 7826994d7c275c7099582de699ab3f6d980489bad3a2e3dae4caa9eb56589ed6
Contents?: true
Size: 798 Bytes
Versions: 2
Compression:
Stored size: 798 Bytes
Contents
# rubocop:disable Lint/HandleExceptions begin require 'warden' rescue LoadError end # rubocop:enable Lint/HandleExceptions require 'rails/session_cookie/app' module Rails module SessionCookie # This mini rack app helps setting warden session cookie class WardenApp < App def initialize(user, session_options = nil, scope = :user) auth_session_options = session_options || rails_app.config.session_options serializer = Warden::SessionSerializer.new({}) key = serializer.key_for(scope) value = serializer.store(user, scope) auth_app = proc { |env| env[Rails::SessionCookie::RACK_SESSION][key] = value [200, {}, []] } @app = with_middlewares(auth_app, auth_session_options) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails-session_cookie-0.2.2 | lib/rails/session_cookie/warden_app.rb |
rails-session_cookie-0.2.1 | lib/rails/session_cookie/warden_app.rb |