Sha256: a7de50fde03f7f22cf5eac3e996a3f4476a41d308bf72c48d2fdd43cf31512a5
Contents?: true
Size: 1.1 KB
Versions: 5
Compression:
Stored size: 1.1 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), auth.request.domain) end Warden::Manager.before_logout do |_user, auth, _opts| encrypted_cookie = Warden::CookieSession::Strategy.encrypted_cookie(auth.cookies) encrypted_cookie.clear(auth.request.domain) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems