Sha256: 6734bdd9e9c05daede9d584f002358eb4ff4cbd2bef6e02ec988f485deba791e
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
require 'warden/cookie_session/encrypted_cookie' class Warden::CookieSession::Strategy < ::Warden::Strategies::Base def valid? @key_salt = cookies[Warden::CookieSession.config.cookie] && encrypted_cookie.get.presence rescue StandardError => e logger.warn "Warden::CookieSession::Strategy#valid? failed: #{e}" logger.debug { e.backtrace } false end def store? false end def authenticate! key, salt = @key_salt || encrypted_cookie.get record = Warden::CookieSession.config.fetch_record(key) success!(record) if record && Warden::CookieSession.config.validate_record(record, salt) rescue StandardError => e logger.warn "Warden::CookieSession::Strategy failed: #{e}" fail!(e) logger.debug { e.backtrace } end def self.encrypted_cookie(cookies) Warden::CookieSession::EncryptedCookie.new( store: cookies, cookie: Warden::CookieSession.config.cookie, secret: Warden::CookieSession.config.secret ) end def encrypted_cookie @encrypted_cookie ||= Warden::CookieSession::Strategy.encrypted_cookie(cookies) end private def logger Warden::CookieSession.config.logger || Logger.new(nil) end end
Version data entries
3 entries across 3 versions & 1 rubygems