<commit_before>module DeviseCasAuthenticatable
  module SingleSignOut
    module SetSession
      def set_session_with_storage(env, sid, session_data)
        if session_data['cas_last_valid_ticket_store']
          ::DeviseCasAuthenticatable::SingleSignOut::Strategies.current_strategy.store_session_id_for_index(session_data['cas_last_valid_ticket'], sid)
          session_data['cas_last_valid_ticket_store'] = nil
        end

        set_session_without_storage(env, sid, session_data)
      end
    end
  end
end

if defined?(ActionDispatch)
  # Need to make a small extension to rails to expose the session_store to our controllers
  require 'action_dispatch/middleware/session/abstract_store'
  ActionDispatch::Session::AbstractStore.class_eval do
    def prepare_with_session_store!(env)
      prepare_without_session_store!(env)
      env[:session_store] = self
    end
    alias_method_chain :prepare!, :session_store
  end
end

require 'devise_cas_authenticatable/single_sign_out/session_store/redis'<commit_msg>Don't require the Redis store here; it will be required up the chain if applicable<commit_after>module DeviseCasAuthenticatable
  module SingleSignOut
    module SetSession
      def set_session_with_storage(env, sid, session_data)
        if session_data['cas_last_valid_ticket_store']
          ::DeviseCasAuthenticatable::SingleSignOut::Strategies.current_strategy.store_session_id_for_index(session_data['cas_last_valid_ticket'], sid)
          session_data['cas_last_valid_ticket_store'] = nil
        end

        set_session_without_storage(env, sid, session_data)
      end
    end
  end
end

if defined?(ActionDispatch)
  # Need to make a small extension to rails to expose the session_store to our controllers
  require 'action_dispatch/middleware/session/abstract_store'
  ActionDispatch::Session::AbstractStore.class_eval do
    def prepare_with_session_store!(env)
      prepare_without_session_store!(env)
      env[:session_store] = self
    end
    alias_method_chain :prepare!, :session_store
  end
end

{'fraction_non_alphanumeric': 0.06506849315068493, 'fraction_numerical': 0.0, 'mean_word_length': 4.77683615819209, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5706874', 'n_tokens_mistral': 614, 'n_tokens_neox': 595, 'n_words': 127}