redis-actionpack 5.0.2 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/auto-assign-issues.yml +2 -0
- data/.gitignore +2 -1
- data/.travis.yml +24 -22
- data/Appraisals +23 -0
- data/CHANGELOG.md +252 -0
- data/CODEOWNERS +1 -0
- data/Gemfile +8 -1
- data/README.md +34 -5
- data/bin/bundler-version-options.rb +1 -0
- data/gemfiles/rails_5.0.x.gemfile +16 -0
- data/gemfiles/rails_5.1.x.gemfile +16 -0
- data/gemfiles/rails_5.2.x.gemfile +16 -0
- data/gemfiles/rails_6.0.x.gemfile +16 -0
- data/lib/action_dispatch/middleware/session/redis_store.rb +27 -7
- data/lib/redis/actionpack/version.rb +1 -1
- data/redis-actionpack.gemspec +5 -14
- data/test/dummy/app/controllers/test_controller.rb +4 -0
- data/test/dummy/app/views/test/get_session_id.html.erb +0 -0
- data/test/dummy/app/views/test/get_session_value.html.erb +1 -0
- data/test/dummy/config/routes.rb +3 -1
- data/test/gemfiles/{Gemfile.rails-5.0.x → Gemfile.rails-6.0.x} +1 -2
- data/test/integration/redis_store_integration_test.rb +23 -0
- metadata +30 -107
- data/test/gemfiles/Gemfile.rails-4.0.x +0 -10
- data/test/gemfiles/Gemfile.rails-4.1.x +0 -10
- data/test/gemfiles/Gemfile.rails-4.2.x +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ffc2d2ea9d57234131426d376aa94d658e2cf707cde8e7144dcff4fef3939b11
|
4
|
+
data.tar.gz: b2a9f00678e5e34e4821ab1f718783db3d4eee0d164dcf7b6f1eb8a6e864a442
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3cee21add22e6d2391a46db594203328dcafac71168d923faffac6da024aecab243d7f39ee3a3591dec78c1154618a5d98ba0ac1e60a91e353d8d47dc5d99ca
|
7
|
+
data.tar.gz: aa76e0b1f6bfadcc472f52481df23013f51a5678a8f3f736c669b87ca51047d8a2bd690fc12a2471e842561e90c24adf79feb0399adeec42eb87f01d3975b0d1
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,31 +1,33 @@
|
|
1
1
|
language: ruby
|
2
2
|
before_install: gem install bundler
|
3
|
-
script:
|
3
|
+
script: bundle exec rake
|
4
4
|
rvm:
|
5
|
-
-
|
6
|
-
- 2.
|
7
|
-
- 2.
|
8
|
-
- 2.
|
9
|
-
- 2.
|
5
|
+
- 2.3
|
6
|
+
- 2.4
|
7
|
+
- 2.5
|
8
|
+
- 2.6
|
9
|
+
- 2.7
|
10
10
|
- ruby-head
|
11
|
-
|
11
|
+
- jruby-head
|
12
12
|
gemfile:
|
13
|
-
-
|
14
|
-
-
|
15
|
-
-
|
16
|
-
-
|
17
|
-
|
13
|
+
- gemfiles/rails_5.0.x.gemfile
|
14
|
+
- gemfiles/rails_5.1.x.gemfile
|
15
|
+
- gemfiles/rails_5.2.x.gemfile
|
16
|
+
- gemfiles/rails_6.0.x.gemfile
|
18
17
|
matrix:
|
19
18
|
exclude:
|
20
|
-
- rvm:
|
21
|
-
gemfile:
|
22
|
-
- rvm: 2.
|
23
|
-
gemfile:
|
24
|
-
- rvm: 2.1
|
25
|
-
gemfile: test/gemfiles/Gemfile.rails-5.0.x
|
26
|
-
- rvm: ruby-head
|
27
|
-
gemfile: test/gemfiles/Gemfile.rails-4.0.x
|
28
|
-
- rvm: ruby-head
|
29
|
-
gemfile: test/gemfiles/Gemfile.rails-4.1.x
|
19
|
+
- rvm: 2.3
|
20
|
+
gemfile: gemfiles/rails_6.0.x.gemfile
|
21
|
+
- rvm: 2.4
|
22
|
+
gemfile: gemfiles/rails_6.0.x.gemfile
|
30
23
|
allow_failures:
|
31
24
|
- rvm: ruby-head
|
25
|
+
- rvm: jruby-head
|
26
|
+
deploy:
|
27
|
+
provider: rubygems
|
28
|
+
api_key:
|
29
|
+
secure: edRiCZPzp3pqBQn3hjeG5WqUNf0eEb8/Ea2VY0jJfQfOHxOYJSATkpdZ5xxOL1YIefk7ERUURY3dKwS/qdSIF2h954QPeOChLTlSaWtFjSNAZIAhH7Ks4vN/q1i7JAWtJRCBOtHlAe9AJj7CvHpUsry3+oHsJ+gXaaA9lntbheE=
|
30
|
+
gem: redis-actionpack
|
31
|
+
on:
|
32
|
+
tags: true
|
33
|
+
repo: redis-store/redis-actionpack
|
data/Appraisals
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
appraise 'rails-5.0.x' do
|
2
|
+
gem 'redis-store'
|
3
|
+
gem 'redis-rack'
|
4
|
+
gem 'actionpack', '~> 5.0.0'
|
5
|
+
end
|
6
|
+
|
7
|
+
appraise 'rails-5.1.x' do
|
8
|
+
gem 'redis-store'
|
9
|
+
gem 'redis-rack'
|
10
|
+
gem 'actionpack', '~> 5.1.0'
|
11
|
+
end
|
12
|
+
|
13
|
+
appraise 'rails-5.2.x' do
|
14
|
+
gem 'redis-store'
|
15
|
+
gem 'redis-rack'
|
16
|
+
gem 'actionpack', '~> 5.1.0'
|
17
|
+
end
|
18
|
+
|
19
|
+
appraise 'rails-6.0.x' do
|
20
|
+
gem 'redis-store'
|
21
|
+
gem 'redis-rack'
|
22
|
+
gem 'actionpack', '~> 6.0.0'
|
23
|
+
end
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,252 @@
|
|
1
|
+
v5.2.0 (2020-01-13)
|
2
|
+
--------------------------------------------------------------------------------
|
3
|
+
|
4
|
+
* Require latest version of redis-rack
|
5
|
+
Tom Scott
|
6
|
+
|
7
|
+
* Update version to v5.2.0 final
|
8
|
+
Tom Scott
|
9
|
+
|
10
|
+
* Fix for rack 2.0.8 (#28)
|
11
|
+
|
12
|
+
* Fix for rack 2.0.8
|
13
|
+
* add new redis-rack for tests
|
14
|
+
* add new ruby 2.7 for tests
|
15
|
+
Alexey Vasiliev
|
16
|
+
|
17
|
+
* v5.2.0.pre: Support Signed/Encrypted Cookies
|
18
|
+
Tom Scott
|
19
|
+
|
20
|
+
* Update README with info about signed cookies
|
21
|
+
Tom Scott
|
22
|
+
|
23
|
+
* Support Signed and Encrypted Cookie Storage (#27)
|
24
|
+
|
25
|
+
With the `:signed` option passed into the Redis session store, you can
|
26
|
+
now ensure that sessions will be set up in the browser using a
|
27
|
+
signed/encrypted cookie. This prevents user tampering by changing their
|
28
|
+
session ID or the data within the cookie.
|
29
|
+
|
30
|
+
Closes #21
|
31
|
+
Tom Scott
|
32
|
+
|
33
|
+
v5.1.0
|
34
|
+
--------------------------------------------------------------------------------
|
35
|
+
|
36
|
+
* Add appraisal to test on multiple versions of Rails (#18)
|
37
|
+
|
38
|
+
Update the build configuration to exclude older versions we no longer support and use Appraisal to test against multiple gemfiles/rubies in CI.
|
39
|
+
|
40
|
+
* Remove old gemfiles
|
41
|
+
* Update appraisal gemfiles
|
42
|
+
* Exclude some builds
|
43
|
+
* Install bundler on older versions of Ruby
|
44
|
+
* Prevent updating bundler to a non-compatible version
|
45
|
+
* Remove lockfiles from the repo
|
46
|
+
* Drop support for old versions of Rails & Ruby
|
47
|
+
* Automatically assign issues to @tubbo when they are created
|
48
|
+
Tom Scott
|
49
|
+
|
50
|
+
* Reduce build scope to only support Rails 5 & 6
|
51
|
+
Tom Scott
|
52
|
+
|
53
|
+
* v5.1.0: Support Rails 6
|
54
|
+
Tom Scott
|
55
|
+
|
56
|
+
* Bump max version constraint on actionpack (#25)
|
57
|
+
|
58
|
+
This change allows this gem to work with Rails 6.
|
59
|
+
Arjun Radhakrishnan
|
60
|
+
|
61
|
+
* Fix build
|
62
|
+
Tom Scott
|
63
|
+
|
64
|
+
* README: Use SVG badges
|
65
|
+
Olle Jonsson
|
66
|
+
|
67
|
+
* Gemspec: Drop EOL'd property rubyforge_project
|
68
|
+
Olle Jonsson
|
69
|
+
|
70
|
+
* Loosen Bundler dependency
|
71
|
+
Tom Scott
|
72
|
+
|
73
|
+
* Update testing matrix
|
74
|
+
Tom Scott
|
75
|
+
|
76
|
+
* Automatically release to RubyGems when new tags are pushed to GitHub
|
77
|
+
Tom Scott
|
78
|
+
|
79
|
+
* Add code owners
|
80
|
+
Tom Scott
|
81
|
+
|
82
|
+
* Clarify usage of gem in the README
|
83
|
+
Tom Scott
|
84
|
+
|
85
|
+
* Fix rails 4 build failure
|
86
|
+
Tom Scott
|
87
|
+
|
88
|
+
* Don't always use local testing gem
|
89
|
+
Tom Scott
|
90
|
+
|
91
|
+
v5.0.2
|
92
|
+
--------------------------------------------------------------------------------
|
93
|
+
|
94
|
+
* v5.0.2: Loosen dependencies to work with new minor redis-store versions
|
95
|
+
Tom Scott
|
96
|
+
|
97
|
+
* Update class name in README
|
98
|
+
Tom Scott
|
99
|
+
|
100
|
+
* Loosen redis-store dependency
|
101
|
+
Tom Scott
|
102
|
+
|
103
|
+
* Update tests to remove deprecation warnings
|
104
|
+
Tom Scott
|
105
|
+
|
106
|
+
* Remove testing code from Gemfile
|
107
|
+
Tom Scott
|
108
|
+
|
109
|
+
v5.0.1
|
110
|
+
--------------------------------------------------------------------------------
|
111
|
+
|
112
|
+
* Release v5.0.1
|
113
|
+
Tom Scott
|
114
|
+
|
115
|
+
* Respect cookie options in setting cookie with session ID
|
116
|
+
Michael Dawson
|
117
|
+
|
118
|
+
* Update tests and gemfiles to work on all supported versions.
|
119
|
+
|
120
|
+
Do not depend on pre-release versions of gems.
|
121
|
+
|
122
|
+
Move tests to use minitest-rails to alleviate some of the dependency hell.
|
123
|
+
|
124
|
+
Remove version_test.rb because that's dumb.
|
125
|
+
Connor Shea
|
126
|
+
|
127
|
+
v5.0.0
|
128
|
+
--------------------------------------------------------------------------------
|
129
|
+
|
130
|
+
* Update README.md (#12)
|
131
|
+
Nicolas
|
132
|
+
|
133
|
+
* Bump to 5.0.0
|
134
|
+
Ryan Bigg
|
135
|
+
|
136
|
+
* Fix gem dependency versions
|
137
|
+
Tom Scott
|
138
|
+
|
139
|
+
* Pre-Release of v5.0.0
|
140
|
+
Tom Scott
|
141
|
+
|
142
|
+
* Disable rbx-19mode on Travis CI
|
143
|
+
|
144
|
+
This syntax is no longer supported by Travis, so we aren't getting
|
145
|
+
reliable builds and thus must disable its use, at least for now. We were
|
146
|
+
getting problems on the Rails 4.0 and 4.1 Gemfiles.
|
147
|
+
|
148
|
+
More information is available at
|
149
|
+
https://travis-ci.org/redis-store/redis-actionpack/builds/112702496
|
150
|
+
Tom Scott
|
151
|
+
|
152
|
+
* exclue jruby-19 from rails5
|
153
|
+
Marc Roberts
|
154
|
+
|
155
|
+
* bump ruby 2.2 version in travis, rails5 need at least 2.2.4
|
156
|
+
Marc Roberts
|
157
|
+
|
158
|
+
* env is already an ActionDispatch::Request in rails5
|
159
|
+
Marc Roberts
|
160
|
+
|
161
|
+
* specify version of minitest-spec-rails
|
162
|
+
Marc Roberts
|
163
|
+
|
164
|
+
* need all of rails in gemfile for rails5
|
165
|
+
Marc Roberts
|
166
|
+
|
167
|
+
* use redis-store from github until a new gem is cut
|
168
|
+
Marc Roberts
|
169
|
+
|
170
|
+
* prevent rails5 deprecation warnings
|
171
|
+
Marc Roberts
|
172
|
+
|
173
|
+
* don't use mini_backtrace for now, incompatible with rails5
|
174
|
+
Marc Roberts
|
175
|
+
|
176
|
+
* bump rails5 gem version up to beta3
|
177
|
+
Marc Roberts
|
178
|
+
|
179
|
+
* use redis-rack via github for rails 5.0
|
180
|
+
Marc Roberts
|
181
|
+
|
182
|
+
* use minitest-spec-rails for consistency
|
183
|
+
Marc Roberts
|
184
|
+
|
185
|
+
* Merge remote-tracking branch 'upstream/master'
|
186
|
+
Miles Matthias
|
187
|
+
|
188
|
+
* update mini_specunit to minitest-spec-rails
|
189
|
+
Marc Roberts
|
190
|
+
|
191
|
+
* ignore .lock files in gemfiles
|
192
|
+
Marc Roberts
|
193
|
+
|
194
|
+
* correct gemfiles names in travis excludes
|
195
|
+
Marc Roberts
|
196
|
+
|
197
|
+
* fix gemspec path in gemfiles
|
198
|
+
Marc Roberts
|
199
|
+
|
200
|
+
* add multiple gemfiles for rails 4.0, 4.1, 4.2 and 5
|
201
|
+
Marc Roberts
|
202
|
+
|
203
|
+
* remove 1.9, add 2.1/2.2 rubies to travis
|
204
|
+
Marc Roberts
|
205
|
+
|
206
|
+
* Loosen dependancy on actionpack to support Rails 5
|
207
|
+
Marc Roberts
|
208
|
+
|
209
|
+
* travis ci add before_install
|
210
|
+
shiro16
|
211
|
+
|
212
|
+
* fixed travis.yml
|
213
|
+
shiro16
|
214
|
+
|
215
|
+
* travis ci add Ruby 2.1 and 2.2, 2.3.0
|
216
|
+
shiro16
|
217
|
+
|
218
|
+
* ignore stdout, file resulted from running tests
|
219
|
+
Miles Matthias
|
220
|
+
|
221
|
+
* Revert "Update README.md"
|
222
|
+
|
223
|
+
This reverts commit a4c7f94ed6283b28a34079b5a4917897d6a2b77d.
|
224
|
+
Ryan Bigg
|
225
|
+
|
226
|
+
* Update README.md
|
227
|
+
Ryan Bigg
|
228
|
+
|
229
|
+
* These silly version tests
|
230
|
+
Ryan Bigg
|
231
|
+
|
232
|
+
v4.0.1
|
233
|
+
--------------------------------------------------------------------------------
|
234
|
+
G
|
235
|
+
* Bump to 4.0.1
|
236
|
+
Ryan Bigg
|
237
|
+
|
238
|
+
* support the same values for domain as rails' session stores usually do
|
239
|
+
|
240
|
+
* needed to change the tests based on test in rails, so the options for the session store could be changed per test
|
241
|
+
|
242
|
+
Fixes #2
|
243
|
+
Michael Reinsch
|
244
|
+
|
245
|
+
v4.0.0
|
246
|
+
--------------------------------------------------------------------------------
|
247
|
+
|
248
|
+
* Enable CI
|
249
|
+
Luca Guidi
|
250
|
+
|
251
|
+
* Move from jodosha/redis-store
|
252
|
+
Luca Guidi
|
data/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @tubbo
|
data/Gemfile
CHANGED
@@ -1,3 +1,10 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
gemspec
|
3
|
-
|
3
|
+
|
4
|
+
gem 'rake', '>= 12.3.3'
|
5
|
+
gem 'bundler', '~> 2.1'
|
6
|
+
gem 'mocha', '~> 0.14.0', require: 'mocha/setup'
|
7
|
+
gem 'tzinfo', '~> 1.2'
|
8
|
+
gem 'appraisal', '~> 2.2'
|
9
|
+
gem 'redis-store-testing', github: 'redis-store/testing'
|
10
|
+
gem 'minitest-rails'
|
data/README.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
__`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.
|
4
4
|
|
5
|
+
For guidelines on using our underlying cache store, see the main [redis-store readme](https://github.com/redis-store/redis-store).
|
6
|
+
|
7
|
+
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).
|
8
|
+
|
9
|
+
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!
|
10
|
+
|
5
11
|
## Installation
|
6
12
|
|
7
13
|
```ruby
|
@@ -11,12 +17,35 @@ gem 'redis-actionpack'
|
|
11
17
|
|
12
18
|
## Usage
|
13
19
|
|
14
|
-
If you are using redis-store with Rails,
|
20
|
+
If you are using redis-store with Rails, head on over to the
|
21
|
+
[redis-rails README](https://github.com/redis-store/redis-rails#session-storage) to
|
22
|
+
learn how to integrate this gem into your Rails application.
|
23
|
+
|
24
|
+
For standalone usage:
|
15
25
|
|
16
26
|
```ruby
|
17
|
-
ActionController::Base.
|
27
|
+
ActionController::Base.session_store = :redis_store,
|
28
|
+
servers: %w(redis://localhost:6379/0/session),
|
29
|
+
expire_after: 90.minutes,
|
30
|
+
key: '_my_application_session',
|
31
|
+
threadsafe: false,
|
32
|
+
secure: true
|
18
33
|
```
|
19
34
|
|
35
|
+
A brief run-down of these options...
|
36
|
+
|
37
|
+
- **servers** is an Array of Redis server URLs that we will attempt to find
|
38
|
+
data from.
|
39
|
+
- **expire_after** is the default TTL of session keys. This is also set
|
40
|
+
as the expiry time of any cookies generated by the session store.
|
41
|
+
- **key** is the name of the cookie on the client side
|
42
|
+
- **threadsafe** is for applications that run on multiple instances. Set
|
43
|
+
this to `false` if you want to disable the global mutex lock on
|
44
|
+
session data. It's `true` by default, meaning the mutex will be
|
45
|
+
enabled.
|
46
|
+
- **secure** ensures HTTP cookies are transferred from server to client
|
47
|
+
on a secure (HTTPS) connection
|
48
|
+
|
20
49
|
## Running tests
|
21
50
|
|
22
51
|
```shell
|
@@ -31,9 +60,9 @@ If you are on **Snow Leopard** you have to run `env ARCHFLAGS="-arch x86_64" bun
|
|
31
60
|
|
32
61
|
## Status
|
33
62
|
|
34
|
-
[![Gem Version](https://badge.fury.io/rb/redis-actionpack.
|
35
|
-
[![Build Status](https://secure.travis-ci.org/redis-store/redis-actionpack.
|
36
|
-
[![Code Climate](https://codeclimate.com/github/redis-store/redis-actionpack.
|
63
|
+
[![Gem Version](https://badge.fury.io/rb/redis-actionpack.svg)](http://badge.fury.io/rb/redis-actionpack)
|
64
|
+
[![Build Status](https://secure.travis-ci.org/redis-store/redis-actionpack.svg?branch=master)](http://travis-ci.org/redis-store/redis-actionpack?branch=master)
|
65
|
+
[![Code Climate](https://codeclimate.com/github/redis-store/redis-actionpack.svg)](https://codeclimate.com/github/redis-store/redis-actionpack)
|
37
66
|
|
38
67
|
## Copyright
|
39
68
|
|
@@ -0,0 +1 @@
|
|
1
|
+
puts '-v 1.13.1' if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new('2.3.0')
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rake", ">= 12.3.3"
|
6
|
+
gem "bundler", "~> 2.1"
|
7
|
+
gem "mocha", "~> 0.14.0", require: "mocha/setup"
|
8
|
+
gem "tzinfo", "~> 1.2"
|
9
|
+
gem "appraisal", "~> 2.2"
|
10
|
+
gem "redis-store-testing", github: "redis-store/testing"
|
11
|
+
gem "minitest-rails"
|
12
|
+
gem "redis-store"
|
13
|
+
gem "redis-rack"
|
14
|
+
gem "actionpack", "~> 5.0.0"
|
15
|
+
|
16
|
+
gemspec path: "../"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rake", ">= 12.3.3"
|
6
|
+
gem "bundler", "~> 2.1"
|
7
|
+
gem "mocha", "~> 0.14.0", require: "mocha/setup"
|
8
|
+
gem "tzinfo", "~> 1.2"
|
9
|
+
gem "appraisal", "~> 2.2"
|
10
|
+
gem "redis-store-testing", github: "redis-store/testing"
|
11
|
+
gem "minitest-rails"
|
12
|
+
gem "redis-store"
|
13
|
+
gem "redis-rack"
|
14
|
+
gem "actionpack", "~> 5.1.0"
|
15
|
+
|
16
|
+
gemspec path: "../"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rake", ">= 12.3.3"
|
6
|
+
gem "bundler", "~> 2.1"
|
7
|
+
gem "mocha", "~> 0.14.0", require: "mocha/setup"
|
8
|
+
gem "tzinfo", "~> 1.2"
|
9
|
+
gem "appraisal", "~> 2.2"
|
10
|
+
gem "redis-store-testing", github: "redis-store/testing"
|
11
|
+
gem "minitest-rails"
|
12
|
+
gem "redis-store"
|
13
|
+
gem "redis-rack"
|
14
|
+
gem "actionpack", "~> 5.1.0"
|
15
|
+
|
16
|
+
gemspec path: "../"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rake", ">= 12.3.3"
|
6
|
+
gem "bundler", "~> 2.1"
|
7
|
+
gem "mocha", "~> 0.14.0", require: "mocha/setup"
|
8
|
+
gem "tzinfo", "~> 1.2"
|
9
|
+
gem "appraisal", "~> 2.2"
|
10
|
+
gem "redis-store-testing", github: "redis-store/testing"
|
11
|
+
gem "minitest-rails"
|
12
|
+
gem "redis-store"
|
13
|
+
gem "redis-rack"
|
14
|
+
gem "actionpack", "~> 6.0.0"
|
15
|
+
|
16
|
+
gemspec path: "../"
|
@@ -1,9 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'redis-store'
|
2
4
|
require 'redis-rack'
|
3
5
|
require 'action_dispatch/middleware/session/abstract_store'
|
4
6
|
|
5
7
|
module ActionDispatch
|
6
8
|
module Session
|
9
|
+
# Session storage in Redis, using +Redis::Rack+ as a basis.
|
7
10
|
class RedisStore < Rack::Session::Redis
|
8
11
|
include Compatibility
|
9
12
|
include StaleSessionCheck
|
@@ -15,20 +18,37 @@ module ActionDispatch
|
|
15
18
|
super
|
16
19
|
end
|
17
20
|
|
21
|
+
def generate_sid
|
22
|
+
Rack::Session::SessionId.new(super)
|
23
|
+
end
|
24
|
+
|
18
25
|
private
|
19
26
|
|
20
|
-
def set_cookie(env,
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
request
|
27
|
+
def set_cookie(env, _session_id, cookie)
|
28
|
+
request = wrap_in_request(env)
|
29
|
+
cookie_jar(request)[key] = cookie.merge(cookie_options)
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_cookie(request)
|
33
|
+
cookie_jar(request)[key]
|
34
|
+
end
|
35
|
+
|
36
|
+
def wrap_in_request(env)
|
37
|
+
return env if env.is_a?(ActionDispatch::Request)
|
38
|
+
ActionDispatch::Request.new(env)
|
27
39
|
end
|
28
40
|
|
29
41
|
def cookie_options
|
30
42
|
@default_options.slice(:httponly, :secure)
|
31
43
|
end
|
44
|
+
|
45
|
+
def cookie_jar(request)
|
46
|
+
if @default_options[:signed]
|
47
|
+
request.cookie_jar.signed_or_encrypted
|
48
|
+
else
|
49
|
+
request.cookie_jar
|
50
|
+
end
|
51
|
+
end
|
32
52
|
end
|
33
53
|
end
|
34
54
|
end
|
data/redis-actionpack.gemspec
CHANGED
@@ -9,25 +9,16 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.email = ['me@lucaguidi.com']
|
10
10
|
s.homepage = 'http://redis-store.org/redis-actionpack'
|
11
11
|
s.summary = %q{Redis session store for ActionPack}
|
12
|
-
s.description =
|
12
|
+
s.description = "#{s.summary}. Used for storing the Rails session in Redis."
|
13
13
|
s.license = 'MIT'
|
14
14
|
|
15
|
-
s.rubyforge_project = 'redis-actionpack'
|
16
|
-
|
17
15
|
s.files = `git ls-files`.split("\n")
|
18
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
-
s.executables =
|
17
|
+
s.executables = []
|
20
18
|
s.require_paths = ['lib']
|
19
|
+
s.required_ruby_version = '>= 2.3.0'
|
21
20
|
|
22
21
|
s.add_runtime_dependency 'redis-store', '>= 1.1.0', '< 2'
|
23
|
-
s.add_runtime_dependency 'redis-rack', '>= 1', '< 3'
|
24
|
-
s.add_runtime_dependency 'actionpack', '>=
|
25
|
-
|
26
|
-
s.add_development_dependency 'rake', '~> 10'
|
27
|
-
s.add_development_dependency 'bundler', '~> 1.3'
|
28
|
-
s.add_development_dependency 'mocha', '~> 0.14.0'
|
29
|
-
s.add_development_dependency 'minitest-rails'
|
30
|
-
s.add_development_dependency 'tzinfo'
|
31
|
-
# s.add_development_dependency 'mini_backtrace'
|
32
|
-
s.add_development_dependency 'redis-store-testing'
|
22
|
+
s.add_runtime_dependency 'redis-rack', '>= 2.1.0', '< 3'
|
23
|
+
s.add_runtime_dependency 'actionpack', '>= 5', '< 8'
|
33
24
|
end
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>hello world</h1>
|
data/test/dummy/config/routes.rb
CHANGED
@@ -69,6 +69,20 @@ class RedisStoreIntegrationTest < ::ActionDispatch::IntegrationTest
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
+
test "should set a signed cookie when the 'signed' option is set" do
|
73
|
+
with_test_route_set(signed: true) do
|
74
|
+
https!
|
75
|
+
|
76
|
+
get '/set_session_value'
|
77
|
+
assert_response :success
|
78
|
+
|
79
|
+
cookie = cookies.instance_variable_get('@cookies').first
|
80
|
+
|
81
|
+
assert_includes cookie.raw, '_session_id='
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
|
72
86
|
test "should set a http-only cookie by default" do
|
73
87
|
with_test_route_set do
|
74
88
|
get '/set_session_value'
|
@@ -238,8 +252,17 @@ class RedisStoreIntegrationTest < ::ActionDispatch::IntegrationTest
|
|
238
252
|
def initialize(routes, &blk)
|
239
253
|
@routes = routes
|
240
254
|
@stack = ActionDispatch::MiddlewareStack.new(&blk).build(@routes)
|
255
|
+
@secret = SecureRandom.hex
|
256
|
+
@key_generator = ActiveSupport::CachingKeyGenerator.new(
|
257
|
+
ActiveSupport::KeyGenerator.new(@secret, iterations: 2)
|
258
|
+
)
|
241
259
|
end
|
242
260
|
def call(env)
|
261
|
+
env[ActionDispatch::Cookies::GENERATOR_KEY] = @key_generator
|
262
|
+
env[ActionDispatch::Cookies::SIGNED_COOKIE_SALT] = SecureRandom.hex
|
263
|
+
if defined? ActionDispatch::Cookies::COOKIES_ROTATIONS
|
264
|
+
env[ActionDispatch::Cookies::COOKIES_ROTATIONS] = ActiveSupport::Messages::RotationConfiguration.new
|
265
|
+
end
|
243
266
|
@stack.call(env)
|
244
267
|
end
|
245
268
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-actionpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0
|
4
|
+
version: 5.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-store
|
@@ -36,7 +36,7 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: 2.1.0
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '3'
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
49
|
+
version: 2.1.0
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '3'
|
@@ -56,117 +56,43 @@ dependencies:
|
|
56
56
|
requirements:
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '
|
59
|
+
version: '5'
|
60
60
|
- - "<"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
62
|
+
version: '8'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '5'
|
70
70
|
- - "<"
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: '
|
73
|
-
|
74
|
-
|
75
|
-
requirement: !ruby/object:Gem::Requirement
|
76
|
-
requirements:
|
77
|
-
- - "~>"
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: '10'
|
80
|
-
type: :development
|
81
|
-
prerelease: false
|
82
|
-
version_requirements: !ruby/object:Gem::Requirement
|
83
|
-
requirements:
|
84
|
-
- - "~>"
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: '10'
|
87
|
-
- !ruby/object:Gem::Dependency
|
88
|
-
name: bundler
|
89
|
-
requirement: !ruby/object:Gem::Requirement
|
90
|
-
requirements:
|
91
|
-
- - "~>"
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '1.3'
|
94
|
-
type: :development
|
95
|
-
prerelease: false
|
96
|
-
version_requirements: !ruby/object:Gem::Requirement
|
97
|
-
requirements:
|
98
|
-
- - "~>"
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
version: '1.3'
|
101
|
-
- !ruby/object:Gem::Dependency
|
102
|
-
name: mocha
|
103
|
-
requirement: !ruby/object:Gem::Requirement
|
104
|
-
requirements:
|
105
|
-
- - "~>"
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
version: 0.14.0
|
108
|
-
type: :development
|
109
|
-
prerelease: false
|
110
|
-
version_requirements: !ruby/object:Gem::Requirement
|
111
|
-
requirements:
|
112
|
-
- - "~>"
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
version: 0.14.0
|
115
|
-
- !ruby/object:Gem::Dependency
|
116
|
-
name: minitest-rails
|
117
|
-
requirement: !ruby/object:Gem::Requirement
|
118
|
-
requirements:
|
119
|
-
- - ">="
|
120
|
-
- !ruby/object:Gem::Version
|
121
|
-
version: '0'
|
122
|
-
type: :development
|
123
|
-
prerelease: false
|
124
|
-
version_requirements: !ruby/object:Gem::Requirement
|
125
|
-
requirements:
|
126
|
-
- - ">="
|
127
|
-
- !ruby/object:Gem::Version
|
128
|
-
version: '0'
|
129
|
-
- !ruby/object:Gem::Dependency
|
130
|
-
name: tzinfo
|
131
|
-
requirement: !ruby/object:Gem::Requirement
|
132
|
-
requirements:
|
133
|
-
- - ">="
|
134
|
-
- !ruby/object:Gem::Version
|
135
|
-
version: '0'
|
136
|
-
type: :development
|
137
|
-
prerelease: false
|
138
|
-
version_requirements: !ruby/object:Gem::Requirement
|
139
|
-
requirements:
|
140
|
-
- - ">="
|
141
|
-
- !ruby/object:Gem::Version
|
142
|
-
version: '0'
|
143
|
-
- !ruby/object:Gem::Dependency
|
144
|
-
name: redis-store-testing
|
145
|
-
requirement: !ruby/object:Gem::Requirement
|
146
|
-
requirements:
|
147
|
-
- - ">="
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: '0'
|
150
|
-
type: :development
|
151
|
-
prerelease: false
|
152
|
-
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
requirements:
|
154
|
-
- - ">="
|
155
|
-
- !ruby/object:Gem::Version
|
156
|
-
version: '0'
|
157
|
-
description: Redis session store for ActionPack
|
72
|
+
version: '8'
|
73
|
+
description: Redis session store for ActionPack. Used for storing the Rails session
|
74
|
+
in Redis.
|
158
75
|
email:
|
159
76
|
- me@lucaguidi.com
|
160
77
|
executables: []
|
161
78
|
extensions: []
|
162
79
|
extra_rdoc_files: []
|
163
80
|
files:
|
81
|
+
- ".github/auto-assign-issues.yml"
|
164
82
|
- ".gitignore"
|
165
83
|
- ".travis.yml"
|
84
|
+
- Appraisals
|
85
|
+
- CHANGELOG.md
|
86
|
+
- CODEOWNERS
|
166
87
|
- Gemfile
|
167
88
|
- MIT-LICENSE
|
168
89
|
- README.md
|
169
90
|
- Rakefile
|
91
|
+
- bin/bundler-version-options.rb
|
92
|
+
- gemfiles/rails_5.0.x.gemfile
|
93
|
+
- gemfiles/rails_5.1.x.gemfile
|
94
|
+
- gemfiles/rails_5.2.x.gemfile
|
95
|
+
- gemfiles/rails_6.0.x.gemfile
|
170
96
|
- lib/action_dispatch/middleware/session/redis_store.rb
|
171
97
|
- lib/redis-actionpack.rb
|
172
98
|
- lib/redis/actionpack/version.rb
|
@@ -174,6 +100,8 @@ files:
|
|
174
100
|
- test/dummy/.gitignore
|
175
101
|
- test/dummy/Rakefile
|
176
102
|
- test/dummy/app/controllers/test_controller.rb
|
103
|
+
- test/dummy/app/views/test/get_session_id.html.erb
|
104
|
+
- test/dummy/app/views/test/get_session_value.html.erb
|
177
105
|
- test/dummy/config.ru
|
178
106
|
- test/dummy/config/application.rb
|
179
107
|
- test/dummy/config/boot.rb
|
@@ -181,17 +109,14 @@ files:
|
|
181
109
|
- test/dummy/config/routes.rb
|
182
110
|
- test/dummy/script/rails
|
183
111
|
- test/fixtures/session_autoload_test/session_autoload_test/foo.rb
|
184
|
-
- test/gemfiles/Gemfile.rails-
|
185
|
-
- test/gemfiles/Gemfile.rails-4.1.x
|
186
|
-
- test/gemfiles/Gemfile.rails-4.2.x
|
187
|
-
- test/gemfiles/Gemfile.rails-5.0.x
|
112
|
+
- test/gemfiles/Gemfile.rails-6.0.x
|
188
113
|
- test/integration/redis_store_integration_test.rb
|
189
114
|
- test/test_helper.rb
|
190
115
|
homepage: http://redis-store.org/redis-actionpack
|
191
116
|
licenses:
|
192
117
|
- MIT
|
193
118
|
metadata: {}
|
194
|
-
post_install_message:
|
119
|
+
post_install_message:
|
195
120
|
rdoc_options: []
|
196
121
|
require_paths:
|
197
122
|
- lib
|
@@ -199,22 +124,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
124
|
requirements:
|
200
125
|
- - ">="
|
201
126
|
- !ruby/object:Gem::Version
|
202
|
-
version:
|
127
|
+
version: 2.3.0
|
203
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
129
|
requirements:
|
205
130
|
- - ">="
|
206
131
|
- !ruby/object:Gem::Version
|
207
132
|
version: '0'
|
208
133
|
requirements: []
|
209
|
-
|
210
|
-
|
211
|
-
signing_key:
|
134
|
+
rubygems_version: 3.2.11
|
135
|
+
signing_key:
|
212
136
|
specification_version: 4
|
213
137
|
summary: Redis session store for ActionPack
|
214
138
|
test_files:
|
215
139
|
- test/dummy/.gitignore
|
216
140
|
- test/dummy/Rakefile
|
217
141
|
- test/dummy/app/controllers/test_controller.rb
|
142
|
+
- test/dummy/app/views/test/get_session_id.html.erb
|
143
|
+
- test/dummy/app/views/test/get_session_value.html.erb
|
218
144
|
- test/dummy/config.ru
|
219
145
|
- test/dummy/config/application.rb
|
220
146
|
- test/dummy/config/boot.rb
|
@@ -222,9 +148,6 @@ test_files:
|
|
222
148
|
- test/dummy/config/routes.rb
|
223
149
|
- test/dummy/script/rails
|
224
150
|
- test/fixtures/session_autoload_test/session_autoload_test/foo.rb
|
225
|
-
- test/gemfiles/Gemfile.rails-
|
226
|
-
- test/gemfiles/Gemfile.rails-4.1.x
|
227
|
-
- test/gemfiles/Gemfile.rails-4.2.x
|
228
|
-
- test/gemfiles/Gemfile.rails-5.0.x
|
151
|
+
- test/gemfiles/Gemfile.rails-6.0.x
|
229
152
|
- test/integration/redis_store_integration_test.rb
|
230
153
|
- test/test_helper.rb
|