redis-actionpack-5.2.0/0000755000004100000410000000000013632731113014766 5ustar www-datawww-dataredis-actionpack-5.2.0/.travis.yml0000644000004100000410000000143613632731113017103 0ustar www-datawww-datalanguage: ruby before_install: gem install bundler script: bundle exec rake rvm: - 2.3 - 2.4 - 2.5 - 2.6 - 2.7 - ruby-head - jruby-head gemfile: - gemfiles/rails_5.0.x.gemfile - gemfiles/rails_5.1.x.gemfile - gemfiles/rails_5.2.x.gemfile - gemfiles/rails_6.0.x.gemfile matrix: exclude: - rvm: 2.3 gemfile: gemfiles/rails_6.0.x.gemfile - rvm: 2.4 gemfile: gemfiles/rails_6.0.x.gemfile allow_failures: - rvm: ruby-head - rvm: jruby-head deploy: provider: rubygems api_key: secure: edRiCZPzp3pqBQn3hjeG5WqUNf0eEb8/Ea2VY0jJfQfOHxOYJSATkpdZ5xxOL1YIefk7ERUURY3dKwS/qdSIF2h954QPeOChLTlSaWtFjSNAZIAhH7Ks4vN/q1i7JAWtJRCBOtHlAe9AJj7CvHpUsry3+oHsJ+gXaaA9lntbheE= gem: redis-actionpack on: tags: true repo: redis-store/redis-actionpack redis-actionpack-5.2.0/test/0000755000004100000410000000000013632731113015745 5ustar www-datawww-dataredis-actionpack-5.2.0/test/fixtures/0000755000004100000410000000000013632731113017616 5ustar www-datawww-dataredis-actionpack-5.2.0/test/fixtures/session_autoload_test/0000755000004100000410000000000013632731113024230 5ustar www-datawww-dataredis-actionpack-5.2.0/test/fixtures/session_autoload_test/session_autoload_test/0000755000004100000410000000000013632731113030642 5ustar www-datawww-dataredis-actionpack-5.2.0/test/fixtures/session_autoload_test/session_autoload_test/foo.rb0000644000004100000410000000025513632731113031754 0ustar www-datawww-datamodule SessionAutoloadTest class Foo def initialize(bar='baz') @bar = bar end def inspect "#<#{self.class} bar:#{@bar.inspect}>" end end end redis-actionpack-5.2.0/test/gemfiles/0000755000004100000410000000000013632731113017540 5ustar www-datawww-dataredis-actionpack-5.2.0/test/gemfiles/Gemfile.rails-6.0.x0000644000004100000410000000026413632731113022715 0ustar www-datawww-datasource 'https://rubygems.org' gemspec :path => './../..' gem 'redis-store' gem 'redis-rack', github: 'redis-store/redis-rack' gem 'actionpack', '~> 6.0.0' gem 'minitest-rails' redis-actionpack-5.2.0/test/dummy/0000755000004100000410000000000013632731113017100 5ustar www-datawww-dataredis-actionpack-5.2.0/test/dummy/config.ru0000644000004100000410000000023313632731113020713 0ustar www-datawww-data# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run Dummy::Application redis-actionpack-5.2.0/test/dummy/.gitignore0000644000004100000410000000000613632731113021064 0ustar www-datawww-datalog/* redis-actionpack-5.2.0/test/dummy/script/0000755000004100000410000000000013632731113020404 5ustar www-datawww-dataredis-actionpack-5.2.0/test/dummy/script/rails0000755000004100000410000000044713632731113021451 0ustar www-datawww-data#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands' redis-actionpack-5.2.0/test/dummy/app/0000755000004100000410000000000013632731113017660 5ustar www-datawww-dataredis-actionpack-5.2.0/test/dummy/app/controllers/0000755000004100000410000000000013632731113022226 5ustar www-datawww-dataredis-actionpack-5.2.0/test/dummy/app/controllers/test_controller.rb0000644000004100000410000000134113632731113025774 0ustar www-datawww-dataclass TestController < ActionController::Base def no_session_access head :ok end def set_session_value session[:foo] = "bar" head :ok end def set_session_value_with_expiry request.session_options[:expire_after] = 1.second set_session_value end def set_serialized_session_value session[:foo] = SessionAutoloadTest::Foo.new head :ok end def get_session_value render plain: "foo: #{session[:foo].inspect}" end def get_session_id session_id = request.session_options[:id] || cookies["_session_id"] render plain: session_id end def call_reset_session session[:bar] reset_session session[:bar] = "baz" head :ok end def rescue_action(e) raise end end redis-actionpack-5.2.0/test/dummy/app/views/0000755000004100000410000000000013632731113021015 5ustar www-datawww-dataredis-actionpack-5.2.0/test/dummy/app/views/test/0000755000004100000410000000000013632731113021774 5ustar www-datawww-dataredis-actionpack-5.2.0/test/dummy/app/views/test/get_session_id.html.erb0000644000004100000410000000000013632731113026415 0ustar www-datawww-dataredis-actionpack-5.2.0/test/dummy/app/views/test/get_session_value.html.erb0000644000004100000410000000002513632731113027144 0ustar www-datawww-data

hello world

redis-actionpack-5.2.0/test/dummy/Rakefile0000644000004100000410000000041613632731113020546 0ustar www-datawww-data#!/usr/bin/env rake # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) Dummy::Application.load_tasks redis-actionpack-5.2.0/test/dummy/config/0000755000004100000410000000000013632731113020345 5ustar www-datawww-dataredis-actionpack-5.2.0/test/dummy/config/boot.rb0000644000004100000410000000035413632731113021637 0ustar www-datawww-datarequire 'rubygems' gemfile = File.expand_path('../../../../Gemfile', __FILE__) if File.exist?(gemfile) ENV['BUNDLE_GEMFILE'] = gemfile require 'bundler' Bundler.setup end $:.unshift File.expand_path('../../../../lib', __FILE__) redis-actionpack-5.2.0/test/dummy/config/routes.rb0000644000004100000410000000011513632731113022210 0ustar www-datawww-dataDummy::Application.routes.draw do get ':action', :to => TestController end redis-actionpack-5.2.0/test/dummy/config/application.rb0000644000004100000410000000146213632731113023200 0ustar www-datawww-datarequire File.expand_path('../boot', __FILE__) require "action_controller/railtie" Bundler.require module Dummy class Application < Rails::Application # Disable class caching for session auto-load test config.cache_classes = false config.eager_load = false # Show full error reports and disable caching config.consider_all_requests_local = true config.action_controller.perform_caching = false # Raise exceptions instead of rendering exception templates config.action_dispatch.show_exceptions = false # Disable request forgery protection in test environment config.action_controller.allow_forgery_protection = false # Print deprecation notices to the stderr config.active_support.deprecation = :stderr config.secret_key_base = 'secret' end end redis-actionpack-5.2.0/test/dummy/config/environment.rb0000644000004100000410000000022513632731113023235 0ustar www-datawww-data# Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails application Dummy::Application.initialize! redis-actionpack-5.2.0/test/integration/0000755000004100000410000000000013632731113020270 5ustar www-datawww-dataredis-actionpack-5.2.0/test/integration/redis_store_integration_test.rb0000644000004100000410000002105313632731113026602 0ustar www-datawww-datarequire 'test_helper' class RedisStoreIntegrationTest < ::ActionDispatch::IntegrationTest SessionKey = '_session_id' SessionSecret = 'b3c631c314c0bbca50c1b2843150fe33' test "reads the data" do with_test_route_set do get '/set_session_value' assert_response :success assert cookies['_session_id'].present? get '/get_session_value' assert_response :success assert_equal response.body, 'foo: "bar"' end end test "should get nil session value" do with_test_route_set do get '/get_session_value' assert_response :success assert_equal 'foo: nil', response.body end end test "should delete the data after session reset" do with_test_route_set do get '/set_session_value' assert_response :success assert cookies['_session_id'].present? session_cookie = cookies.send(:hash_for)['_session_id'] get '/call_reset_session' assert_response :success assert !headers['Set-Cookie'].blank? cookies << session_cookie get '/get_session_value' assert_response :success assert_equal 'foo: nil', response.body end end test "should set a non-secure cookie by default" do with_test_route_set do https! get '/set_session_value' assert_response :success cookie = cookies.instance_variable_get('@cookies').first assert !cookie.secure? end end test "should set a secure cookie when the 'secure' option is set" do with_test_route_set(secure: true) do https! get '/set_session_value' assert_response :success cookie = cookies.instance_variable_get('@cookies').first assert cookie.secure? end end test "should set a signed cookie when the 'signed' option is set" do with_test_route_set(signed: true) do https! get '/set_session_value' assert_response :success cookie = cookies.instance_variable_get('@cookies').first assert_includes cookie.raw, '_session_id=' end end test "should set a http-only cookie by default" do with_test_route_set do get '/set_session_value' assert_response :success cookie = cookies.instance_variable_get('@cookies').first options = cookie.instance_variable_get('@options') assert options.key?('HttpOnly') end end test "should set a non-http-only cookie when the 'httponlty' option is set to false" do with_test_route_set(httponly: false) do get '/set_session_value' assert_response :success cookie = cookies.instance_variable_get('@cookies').first options = cookie.instance_variable_get('@options') assert !options.key?('HttpOnly') end end test "should not send cookies on write, not read" do with_test_route_set do get '/get_session_value' assert_response :success assert_equal 'foo: nil', response.body assert cookies['_session_id'].nil? end end test "should set session value after session reset" do with_test_route_set do get '/set_session_value' assert_response :success assert cookies['_session_id'].present? session_id = cookies['_session_id'] get '/call_reset_session' assert_response :success assert !headers['Set-Cookie'].blank? get '/get_session_value' assert_response :success assert_equal 'foo: nil', response.body get '/get_session_id' assert_response :success assert(response.body != session_id) end end test "should be able to read session id without accessing the session hash" do with_test_route_set do get '/set_session_value' assert_response :success assert cookies['_session_id'].present? session_id = cookies['_session_id'] get '/get_session_id' assert_response :success assert_equal response.body, session_id end end test "should auto-load unloaded class" do with_test_route_set do with_autoload_path "session_autoload_test" do get '/set_serialized_session_value' assert_response :success assert cookies['_session_id'].present? end with_autoload_path "session_autoload_test" do get '/get_session_id' assert_response :success end with_autoload_path "session_autoload_test" do get '/get_session_value' assert_response :success assert_equal response.body, 'foo: #' end end end test "should not resend the cookie again if session_id cookie is already exists" do with_test_route_set do get '/set_session_value' assert_response :success assert cookies['_session_id'].present? get '/get_session_value' assert_response :success assert headers['Set-Cookie'].nil? end end test "should prevent session fixation" do with_test_route_set do get '/get_session_value' assert_response :success assert_equal 'foo: nil', response.body session_id = cookies['_session_id'] reset! get '/set_session_value', headers: { _session_id: session_id } assert_response :success assert(cookies['_session_id'] != session_id) end end test "should write the data with expiration time" do with_test_route_set do get '/set_session_value_with_expiry' assert_response :success get '/get_session_value' assert_response :success assert_equal response.body, 'foo: "bar"' sleep 1 get '/get_session_value' assert_response :success assert_equal 'foo: nil', response.body end end test "session store with explicit domain" do with_test_route_set(:domain => "example.es") do get '/set_session_value' assert_match(/domain=example\.es/, headers['Set-Cookie']) headers['Set-Cookie'] end end test "session store without domain" do with_test_route_set do get '/set_session_value' assert_no_match(/domain\=/, headers['Set-Cookie']) end end test "session store with nil domain" do with_test_route_set(:domain => nil) do get '/set_session_value' assert_no_match(/domain\=/, headers['Set-Cookie']) end end test "session store with all domains" do with_test_route_set(:domain => :all) do get '/set_session_value' assert_match(/domain=\.example\.com/, headers['Set-Cookie']) end end private # from actionpack/test/abstract_unit.rb class RoutedRackApp attr_reader :routes def initialize(routes, &blk) @routes = routes @stack = ActionDispatch::MiddlewareStack.new(&blk).build(@routes) @secret = SecureRandom.hex @key_generator = ActiveSupport::CachingKeyGenerator.new( ActiveSupport::KeyGenerator.new(@secret, iterations: 2) ) end def call(env) env[ActionDispatch::Cookies::GENERATOR_KEY] = @key_generator env[ActionDispatch::Cookies::SIGNED_COOKIE_SALT] = SecureRandom.hex if defined? ActionDispatch::Cookies::COOKIES_ROTATIONS env[ActionDispatch::Cookies::COOKIES_ROTATIONS] = ActiveSupport::Messages::RotationConfiguration.new end @stack.call(env) end end # from actionpack/test/abstract_unit.rb def self.build_app(routes = nil) RoutedRackApp.new(routes || ActionDispatch::Routing::RouteSet.new) do |middleware| middleware.use ActionDispatch::DebugExceptions middleware.use ActionDispatch::Callbacks # middleware.use ActionDispatch::ParamsParser middleware.use ActionDispatch::Cookies middleware.use ActionDispatch::Flash middleware.use Rack::Head yield(middleware) if block_given? end end # from actionpack/test/dispatch/session/cookie_store_test.rb def with_test_route_set(options = {}) with_routing do |set| set.draw do get :no_session_access, to: 'test#no_session_access' get :set_session_value, to: 'test#set_session_value' get :set_session_value_with_expiry, to: 'test#set_session_value_with_expiry' get :set_serialized_session_value, to: 'test#set_serialized_session_value' get :get_session_value, to: 'test#get_session_value' get :get_session_id, to: 'test#get_session_id' get :call_reset_session, to: 'test#call_reset_session' end options = { :key => SessionKey }.merge!(options) @app = self.class.build_app(set) do |middleware| middleware.use ActionDispatch::Session::RedisStore, options end yield end end end redis-actionpack-5.2.0/test/test_helper.rb0000644000004100000410000000122013632731113020603 0ustar www-datawww-datarequire 'bundler/setup' require 'minitest/autorun' require 'active_support/core_ext/numeric/time' ENV["RAILS_ENV"] = "test" require File.expand_path("../dummy/config/environment.rb", __FILE__) require "rails/test_help" Rails.backtrace_cleaner.remove_silencers! def with_autoload_path(path) path = File.join(File.dirname(__FILE__), "fixtures", path) if ActiveSupport::Dependencies.autoload_paths.include?(path) yield else begin ActiveSupport::Dependencies.autoload_paths << path yield ensure ActiveSupport::Dependencies.autoload_paths.reject! {|p| p == path} ActiveSupport::Dependencies.clear end end end redis-actionpack-5.2.0/CODEOWNERS0000644000004100000410000000001113632731113016351 0ustar www-datawww-data* @tubbo redis-actionpack-5.2.0/README.md0000644000004100000410000000533313632731113016251 0ustar www-datawww-data# Redis stores for ActionPack __`redis-actionpack`__ provides a session store for __ActionPack__, specifically for __ActionDispatch__. See the main [redis-store readme](https://github.com/redis-store/redis-store) for general guidelines. For guidelines on using our underlying cache store, see the main [redis-store readme](https://github.com/redis-store/redis-store). For information on how to use this library in a Rails app, see the [documentation for redis-rails](https://github.com/redis-store/redis-rails). If, for some reason, you're using `ActionDispatch` and not in a Rails app, read on to learn how to install/use this gem by itself! ## Installation ```ruby # Gemfile gem 'redis-actionpack' ``` ## Usage If you are using redis-store with Rails, head on over to the [redis-rails README](https://github.com/redis-store/redis-rails#session-storage) to learn how to integrate this gem into your Rails application. For standalone usage: ```ruby ActionController::Base.session_store = :redis_store, servers: %w(redis://localhost:6379/0/session), expire_after: 90.minutes, key: '_my_application_session', threadsafe: false, signed: true, secure: true ``` A brief run-down of these options... - **servers** is an Array of Redis server URLs that we will attempt to find data from. - **expire_after** is the default TTL of session keys. This is also set as the expiry time of any cookies generated by the session store. - **key** is the name of the cookie on the client side - **threadsafe** is for applications that run on multiple instances. Set this to `false` if you want to disable the global mutex lock on session data. It's `true` by default, meaning the mutex will be enabled. - **signed** uses signed/encrypted cookies to store the local session on a client machine, preventing a malicious user from tampering with its contents. - **secure** ensures HTTP cookies are transferred from server to client on a secure (HTTPS) connection ## Running tests ```shell gem install bundler git clone git://github.com/redis-store/redis-actionpack.git cd redis-actionpack bundle install bundle exec rake ``` If you are on **Snow Leopard** you have to run `env ARCHFLAGS="-arch x86_64" bundle exec rake` ## Status [![Gem Version](https://badge.fury.io/rb/redis-actionpack.svg)](http://badge.fury.io/rb/redis-actionpack) [![Build Status](https://secure.travis-ci.org/redis-store/redis-actionpack.svg?branch=master)](http://travis-ci.org/redis-store/redis-actionpack?branch=master) [![Code Climate](https://codeclimate.com/github/redis-store/redis-actionpack.svg)](https://codeclimate.com/github/redis-store/redis-actionpack) ## Copyright 2009 - 2013 Luca Guidi - [http://lucaguidi.com](http://lucaguidi.com), released under the MIT license redis-actionpack-5.2.0/bin/0000755000004100000410000000000013632731113015536 5ustar www-datawww-dataredis-actionpack-5.2.0/bin/bundler-version-options.rb0000644000004100000410000000012013632731113022663 0ustar www-datawww-dataputs '-v 1.13.1' if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new('2.3.0') redis-actionpack-5.2.0/gemfiles/0000755000004100000410000000000013632731113016561 5ustar www-datawww-dataredis-actionpack-5.2.0/gemfiles/rails_6.0.x.gemfile0000644000004100000410000000023413632731113022055 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "redis-store" gem "redis-rack" gem "actionpack", "~> 6.0.0" gemspec path: "../" redis-actionpack-5.2.0/gemfiles/rails_5.0.x.gemfile0000644000004100000410000000023413632731113022054 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "redis-store" gem "redis-rack" gem "actionpack", "~> 5.0.0" gemspec path: "../" redis-actionpack-5.2.0/gemfiles/rails_5.1.x.gemfile0000644000004100000410000000023413632731113022055 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "redis-store" gem "redis-rack" gem "actionpack", "~> 5.1.0" gemspec path: "../" redis-actionpack-5.2.0/gemfiles/rails_5.2.x.gemfile0000644000004100000410000000023413632731113022056 0ustar www-datawww-data# This file was generated by Appraisal source "https://rubygems.org" gem "redis-store" gem "redis-rack" gem "actionpack", "~> 5.1.0" gemspec path: "../" redis-actionpack-5.2.0/CHANGELOG.md0000644000004100000410000001336213632731113016604 0ustar www-datawww-datav5.2.0 (2020-01-13) -------------------------------------------------------------------------------- * Require latest version of redis-rack Tom Scott * Update version to v5.2.0 final Tom Scott * Fix for rack 2.0.8 (#28) * Fix for rack 2.0.8 * add new redis-rack for tests * add new ruby 2.7 for tests Alexey Vasiliev * v5.2.0.pre: Support Signed/Encrypted Cookies Tom Scott * Update README with info about signed cookies Tom Scott * Support Signed and Encrypted Cookie Storage (#27) With the `:signed` option passed into the Redis session store, you can now ensure that sessions will be set up in the browser using a signed/encrypted cookie. This prevents user tampering by changing their session ID or the data within the cookie. Closes #21 Tom Scott v5.1.0 -------------------------------------------------------------------------------- * Add appraisal to test on multiple versions of Rails (#18) Update the build configuration to exclude older versions we no longer support and use Appraisal to test against multiple gemfiles/rubies in CI. * Remove old gemfiles * Update appraisal gemfiles * Exclude some builds * Install bundler on older versions of Ruby * Prevent updating bundler to a non-compatible version * Remove lockfiles from the repo * Drop support for old versions of Rails & Ruby * Automatically assign issues to @tubbo when they are created Tom Scott * Reduce build scope to only support Rails 5 & 6 Tom Scott * v5.1.0: Support Rails 6 Tom Scott * Bump max version constraint on actionpack (#25) This change allows this gem to work with Rails 6. Arjun Radhakrishnan * Fix build Tom Scott * README: Use SVG badges Olle Jonsson * Gemspec: Drop EOL'd property rubyforge_project Olle Jonsson * Loosen Bundler dependency Tom Scott * Update testing matrix Tom Scott * Automatically release to RubyGems when new tags are pushed to GitHub Tom Scott * Add code owners Tom Scott * Clarify usage of gem in the README Tom Scott * Fix rails 4 build failure Tom Scott * Don't always use local testing gem Tom Scott v5.0.2 -------------------------------------------------------------------------------- * v5.0.2: Loosen dependencies to work with new minor redis-store versions Tom Scott * Update class name in README Tom Scott * Loosen redis-store dependency Tom Scott * Update tests to remove deprecation warnings Tom Scott * Remove testing code from Gemfile Tom Scott v5.0.1 -------------------------------------------------------------------------------- * Release v5.0.1 Tom Scott * Respect cookie options in setting cookie with session ID Michael Dawson * Update tests and gemfiles to work on all supported versions. Do not depend on pre-release versions of gems. Move tests to use minitest-rails to alleviate some of the dependency hell. Remove version_test.rb because that's dumb. Connor Shea v5.0.0 -------------------------------------------------------------------------------- * Update README.md (#12) Nicolas * Bump to 5.0.0 Ryan Bigg * Fix gem dependency versions Tom Scott * Pre-Release of v5.0.0 Tom Scott * Disable rbx-19mode on Travis CI This syntax is no longer supported by Travis, so we aren't getting reliable builds and thus must disable its use, at least for now. We were getting problems on the Rails 4.0 and 4.1 Gemfiles. More information is available at https://travis-ci.org/redis-store/redis-actionpack/builds/112702496 Tom Scott * exclue jruby-19 from rails5 Marc Roberts * bump ruby 2.2 version in travis, rails5 need at least 2.2.4 Marc Roberts * env is already an ActionDispatch::Request in rails5 Marc Roberts * specify version of minitest-spec-rails Marc Roberts * need all of rails in gemfile for rails5 Marc Roberts * use redis-store from github until a new gem is cut Marc Roberts * prevent rails5 deprecation warnings Marc Roberts * don't use mini_backtrace for now, incompatible with rails5 Marc Roberts * bump rails5 gem version up to beta3 Marc Roberts * use redis-rack via github for rails 5.0 Marc Roberts * use minitest-spec-rails for consistency Marc Roberts * Merge remote-tracking branch 'upstream/master' Miles Matthias * update mini_specunit to minitest-spec-rails Marc Roberts * ignore .lock files in gemfiles Marc Roberts * correct gemfiles names in travis excludes Marc Roberts * fix gemspec path in gemfiles Marc Roberts * add multiple gemfiles for rails 4.0, 4.1, 4.2 and 5 Marc Roberts * remove 1.9, add 2.1/2.2 rubies to travis Marc Roberts * Loosen dependancy on actionpack to support Rails 5 Marc Roberts * travis ci add before_install shiro16 * fixed travis.yml shiro16 * travis ci add Ruby 2.1 and 2.2, 2.3.0 shiro16 * ignore stdout, file resulted from running tests Miles Matthias * Revert "Update README.md" This reverts commit a4c7f94ed6283b28a34079b5a4917897d6a2b77d. Ryan Bigg * Update README.md Ryan Bigg * These silly version tests Ryan Bigg v4.0.1 -------------------------------------------------------------------------------- G * Bump to 4.0.1 Ryan Bigg * support the same values for domain as rails' session stores usually do * needed to change the tests based on test in rails, so the options for the session store could be changed per test Fixes #2 Michael Reinsch v4.0.0 -------------------------------------------------------------------------------- * Enable CI Luca Guidi * Move from jodosha/redis-store Luca Guidi redis-actionpack-5.2.0/Appraisals0000644000004100000410000000062313632731113017011 0ustar www-datawww-dataappraise 'rails-5.0.x' do gem 'redis-store' gem 'redis-rack' gem 'actionpack', '~> 5.0.0' end appraise 'rails-5.1.x' do gem 'redis-store' gem 'redis-rack' gem 'actionpack', '~> 5.1.0' end appraise 'rails-5.2.x' do gem 'redis-store' gem 'redis-rack' gem 'actionpack', '~> 5.1.0' end appraise 'rails-6.0.x' do gem 'redis-store' gem 'redis-rack' gem 'actionpack', '~> 6.0.0' end redis-actionpack-5.2.0/.gitignore0000644000004100000410000000007713632731113016762 0ustar www-datawww-dataGemfile.lock gemfiles/*.lock *.gem tmp/ stdout gemfiles/vendor redis-actionpack-5.2.0/Rakefile0000644000004100000410000000014713632731113016435 0ustar www-datawww-datarequire 'bundler/setup' require 'rake' require 'bundler/gem_tasks' require 'redis-store/testing/tasks' redis-actionpack-5.2.0/lib/0000755000004100000410000000000013632731113015534 5ustar www-datawww-dataredis-actionpack-5.2.0/lib/action_dispatch/0000755000004100000410000000000013632731113020670 5ustar www-datawww-dataredis-actionpack-5.2.0/lib/action_dispatch/middleware/0000755000004100000410000000000013632731113023005 5ustar www-datawww-dataredis-actionpack-5.2.0/lib/action_dispatch/middleware/session/0000755000004100000410000000000013632731113024470 5ustar www-datawww-dataredis-actionpack-5.2.0/lib/action_dispatch/middleware/session/redis_store.rb0000644000004100000410000000237013632731113027341 0ustar www-datawww-data# frozen_string_literal: true require 'redis-store' require 'redis-rack' require 'action_dispatch/middleware/session/abstract_store' module ActionDispatch module Session # Session storage in Redis, using +Redis::Rack+ as a basis. class RedisStore < Rack::Session::Redis include Compatibility include StaleSessionCheck include SessionObject def initialize(app, options = {}) options = options.dup options[:redis_server] ||= options[:servers] super end def generate_sid Rack::Session::SessionId.new(super) end private def set_cookie(env, _session_id, cookie) request = wrap_in_request(env) cookie_jar(request)[key] = cookie.merge(cookie_options) end def get_cookie(request) cookie_jar(request)[key] end def wrap_in_request(env) return env if env.is_a?(ActionDispatch::Request) ActionDispatch::Request.new(env) end def cookie_options @default_options.slice(:httponly, :secure) end def cookie_jar(request) if @default_options[:signed] request.cookie_jar.signed_or_encrypted else request.cookie_jar end end end end end redis-actionpack-5.2.0/lib/redis-actionpack.rb0000644000004100000410000000021013632731113021272 0ustar www-datawww-datarequire 'redis-store' require 'action_pack' require 'redis/actionpack/version' require 'action_dispatch/middleware/session/redis_store' redis-actionpack-5.2.0/lib/redis/0000755000004100000410000000000013632731113016642 5ustar www-datawww-dataredis-actionpack-5.2.0/lib/redis/actionpack/0000755000004100000410000000000013632731113020756 5ustar www-datawww-dataredis-actionpack-5.2.0/lib/redis/actionpack/version.rb0000644000004100000410000000010013632731113022757 0ustar www-datawww-dataclass Redis module ActionPack VERSION = '5.2.0' end end redis-actionpack-5.2.0/Gemfile0000644000004100000410000000041113632731113016255 0ustar www-datawww-datasource 'https://rubygems.org' gemspec gem "rake", "~> 10.5" gem "bundler", "~> 2.1" gem "mocha", "~> 0.14.0" gem "minitest-rails", "~> 6.0" gem "tzinfo", "~> 1.2" gem "appraisal", "~> 2.2" gem "redis-store-testing", github: 'redis-store/testing', branch: 'v0.0.3' redis-actionpack-5.2.0/redis-actionpack.gemspec0000644000004100000410000000160713632731113021557 0ustar www-datawww-data# -*- encoding: utf-8 -*- $:.push File.expand_path('../lib', __FILE__) require 'redis/actionpack/version' Gem::Specification.new do |s| s.name = 'redis-actionpack' s.version = Redis::ActionPack::VERSION s.authors = ['Luca Guidi'] s.email = ['me@lucaguidi.com'] s.homepage = 'http://redis-store.org/redis-actionpack' s.summary = %q{Redis session store for ActionPack} s.description = "#{s.summary}. Used for storing the Rails session in Redis." s.license = 'MIT' s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = [] s.require_paths = ['lib'] s.required_ruby_version = '>= 2.3.0' s.add_runtime_dependency 'redis-store', '>= 1.1.0', '< 2' s.add_runtime_dependency 'redis-rack', '>= 2.1.0', '< 3' s.add_runtime_dependency 'actionpack', '>= 5', '< 7' end redis-actionpack-5.2.0/.github/0000755000004100000410000000000013632731113016326 5ustar www-datawww-dataredis-actionpack-5.2.0/.github/auto-assign-issues.yml0000644000004100000410000000002513632731113022611 0ustar www-datawww-dataassignees: - tubbo redis-actionpack-5.2.0/MIT-LICENSE0000644000004100000410000000204513632731113016423 0ustar www-datawww-dataCopyright (c) 2009 - 2011 Luca Guidi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.