Sha256: ea4c1131515df1d5b8d854ad9682dd371a9e886b78c29b0610a2562c223eaf44
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
require 'warden' require 'warden/cookie_session/version' require 'warden/cookie_session/default_wrapper' require 'warden/cookie_session/configuration' require 'warden/cookie_session/strategy' module Warden module CookieSession class << self attr_accessor :config end self.config ||= Warden::CookieSession::Configuration.new class << self def configure self.config ||= Warden::CookieSession::Configuration.new yield(config) setup_warden(config) end def setup_warden(config) Warden::Strategies.add(:cookie_session, Warden::CookieSession::Strategy) Warden::Manager.after_set_user do |user, auth, _opts| encrypted_cookie = Warden::CookieSession::Strategy.encrypted_cookie(auth.cookies) encrypted_cookie.put(config.serialize_record(user)) end Warden::Manager.before_logout do |_user, auth, _opts| encrypted_cookie = Warden::CookieSession::Strategy.encrypted_cookie(auth.cookies) encrypted_cookie.clear end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
warden_cookie_session-0.1.0.18558 | lib/warden/cookie_session.rb |
warden_cookie_session-0.1.0.18557 | lib/warden/cookie_session.rb |