Sha256: 3d2f4b2aa462323e047b1b8c8b729fe5d865911b25978cca24ff64fc0b9b1d0e

Contents?: true

Size: 648 Bytes

Versions: 6

Compression:

Stored size: 648 Bytes

Contents

module Warden
  module CookieSession
    class DefaultWrapper

      def initialize(klass = nil)
        @klass = klass
      end

      def serialize_record(record)
        # like in https://github.com/plataformatec/devise/blob/master/lib/devise/models/authenticatable.rb
        [record.to_key, record.authenticatable_salt]
      end

      def fetch_record(key)
        @klass.find(key.first)
      end

      def validate_record(record, salt)
        # like in https://github.com/plataformatec/devise/blob/master/lib/devise/models/authenticatable.rb
        record if record && record.authenticatable_salt == salt
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
warden_cookie_session-0.1.2.19275 lib/warden/cookie_session/default_wrapper.rb
warden_cookie_session-0.1.2.19269 lib/warden/cookie_session/default_wrapper.rb
warden_cookie_session-0.1.2.19245 lib/warden/cookie_session/default_wrapper.rb
warden_cookie_session-0.1.2.19222 lib/warden/cookie_session/default_wrapper.rb
warden_cookie_session-0.1.1.19161 lib/warden/cookie_session/default_wrapper.rb
warden_cookie_session-0.1.1.18842 lib/warden/cookie_session/default_wrapper.rb