Sha256: 5f2a88c4e69474b039924dd2986df0f59b8201df5e8f33574fdfbece23902f78

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

module DeviseCasAuthenticatable
  module SingleSignOut
    module Strategies
      class RedisCache < Base
        include ::DeviseCasAuthenticatable::SingleSignOut::DestroySession

        def store_session_id_for_index(session_index, session_id)
          logger.debug("Storing #{session_id} for index #{session_index}")
          current_session_store.instance_variable_get(:@pool).set(
            cache_key(session_index),
            session_id
          )
        end
        def find_session_id_by_index(session_index)
          sid = current_session_store.instance_variable_get(:@pool).get(cache_key(session_index))
          logger.debug("Found session id #{sid} for index #{session_index}") if sid
          sid
        end
        def delete_session_index(session_index)
          logger.debug("Deleting index #{session_index}")
          destroy_session_by_id(session_index)
        end

        private
        def cache_key(session_index)
          "devise_cas_authenticatable:#{session_index}"
        end
      end
    end
  end
end

::DeviseCasAuthenticatable::SingleSignOut::Strategies.add(:redis_cache, DeviseCasAuthenticatable::SingleSignOut::Strategies::RedisCache )

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
devise_cas_authenticatable-1.10.3 lib/devise_cas_authenticatable/single_sign_out/strategies/redis_cache.rb
devise_cas_authenticatable-1.10.2 lib/devise_cas_authenticatable/single_sign_out/strategies/redis_cache.rb