rack-session 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/session/abstract/id.rb +4 -3
- data/lib/rack/session/constants.rb +2 -1
- data/lib/rack/session/cookie.rb +7 -4
- data/lib/rack/session/version.rb +1 -1
- data/lib/rack/session.rb +5 -4
- metadata +17 -4
- data/lib/rack/session/memcache.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb2330b8031f50a3d80ca25857aac9db3636ed03d90aad824c8a191ec74cb4a3
|
4
|
+
data.tar.gz: 40323d8725c0a23f017d2017c29ee3abfa2fb811b13d12492d62e28e2a6b8274
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 227c65c2acd9f8f05d76a424200e2c151006fb37ef271fde09f4ac73abb5ef8fc91dd9accf75cc901e9d09bc1347a38990dbe590d8f017fa59a4cb67e1b70536
|
7
|
+
data.tar.gz: dc24af294baf201629cc0ddd362cbe614acda5408acdb48be12e00b1ba8d567ee69a6f2d831cbc35a3e7b389f06a44e2b2c65234143686e5ab4f5ce6dbe7eb94
|
@@ -11,6 +11,8 @@ require 'rack/constants'
|
|
11
11
|
require 'rack/request'
|
12
12
|
require 'rack/response'
|
13
13
|
|
14
|
+
require_relative '../constants'
|
15
|
+
|
14
16
|
module Rack
|
15
17
|
|
16
18
|
module Session
|
@@ -415,10 +417,9 @@ module Rack
|
|
415
417
|
# Sets the cookie back to the client with session id. We skip the cookie
|
416
418
|
# setting if the value didn't change (sid is the same) or expires was given.
|
417
419
|
|
418
|
-
def set_cookie(request,
|
420
|
+
def set_cookie(request, response, cookie)
|
419
421
|
if request.cookies[@key] != cookie[:value] || cookie[:expires]
|
420
|
-
|
421
|
-
Utils.add_cookie_to_header(res.set_cookie_header, @key, cookie)
|
422
|
+
response.set_cookie(@key, cookie)
|
422
423
|
end
|
423
424
|
end
|
424
425
|
|
data/lib/rack/session/cookie.rb
CHANGED
@@ -11,6 +11,7 @@ require 'rack/utils'
|
|
11
11
|
|
12
12
|
require_relative 'abstract/id'
|
13
13
|
require_relative 'encryptor'
|
14
|
+
require_relative 'constants'
|
14
15
|
|
15
16
|
module Rack
|
16
17
|
|
@@ -151,7 +152,8 @@ module Rack
|
|
151
152
|
attr_reader :coder, :encryptors
|
152
153
|
|
153
154
|
def initialize(app, options = {})
|
154
|
-
secrets
|
155
|
+
# support both :secrets and :secret for backwards compatibility
|
156
|
+
secrets = [*(options[:secrets] || options[:secret])]
|
155
157
|
|
156
158
|
encryptor_opts = {
|
157
159
|
purpose: options[:key], serialize_json: options[:serialize_json]
|
@@ -163,11 +165,12 @@ module Rack
|
|
163
165
|
Rack::Session::Encryptor.new secret, encryptor_opts
|
164
166
|
end
|
165
167
|
|
166
|
-
# If a legacy HMAC secret is present, initialize those features
|
167
|
-
|
168
|
+
# If a legacy HMAC secret is present, initialize those features.
|
169
|
+
# Fallback to :secret for backwards compatibility.
|
170
|
+
if options.has_key?(:legacy_hmac_secret) || options.has_key?(:secret)
|
168
171
|
@legacy_hmac = options.fetch(:legacy_hmac, 'SHA1')
|
169
172
|
|
170
|
-
@legacy_hmac_secret = options[:legacy_hmac_secret]
|
173
|
+
@legacy_hmac_secret = options[:legacy_hmac_secret] || options[:secret]
|
171
174
|
@legacy_hmac_coder = options.fetch(:legacy_hmac_coder, Base64::Marshal.new)
|
172
175
|
else
|
173
176
|
@legacy_hmac = false
|
data/lib/rack/session/version.rb
CHANGED
data/lib/rack/session.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
|
2
1
|
module Rack
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
module Session
|
3
|
+
autoload :Cookie, "rack/session/cookie"
|
4
|
+
autoload :Pool, "rack/session/pool"
|
5
|
+
autoload :Memcache, "rack/session/memcache"
|
6
|
+
end
|
6
7
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-session
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rack Contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rack
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: minitest
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -91,7 +105,6 @@ files:
|
|
91
105
|
- lib/rack/session/constants.rb
|
92
106
|
- lib/rack/session/cookie.rb
|
93
107
|
- lib/rack/session/encryptor.rb
|
94
|
-
- lib/rack/session/memcache.rb
|
95
108
|
- lib/rack/session/pool.rb
|
96
109
|
- lib/rack/session/version.rb
|
97
110
|
homepage: https://github.com/rack/rack-session
|
@@ -113,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
126
|
- !ruby/object:Gem::Version
|
114
127
|
version: '0'
|
115
128
|
requirements: []
|
116
|
-
rubygems_version: 3.
|
129
|
+
rubygems_version: 3.3.7
|
117
130
|
signing_key:
|
118
131
|
specification_version: 4
|
119
132
|
summary: A session implementation for Rack.
|