rack-session-encryptedcookie 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/rack/session/encryptedcookie.rb +6 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 20a985038cce0ec8777178fa640877da054950dae638e46fb512744a623055ad
|
4
|
+
data.tar.gz: 23e63d5458bb6969f1e276fd92b69efc4f932d34719c33b41635eda512e2f0b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 375797277f24ed3406ae4fbcc3d2f62fa5870627b187e053be8734d92eb6df5f3d33f2274652fe64fa44a6aaaf345375eda414c3468e25ed8f92fb5d97b952a0
|
7
|
+
data.tar.gz: eba1aa2255876561c63768f561c9ea039be9cdf089e08d8dc376427581cc1842901cb4b6cbe5677ec6aee0958d70a7975a5ee5090b162a9d367029704250617c
|
@@ -27,6 +27,10 @@ module Session
|
|
27
27
|
# @option opts [String] :key Encryption key for the data
|
28
28
|
# @option opts [Integer] :tag_len Tag length (for GCM/CCM ciphers)
|
29
29
|
# @option opts [Boolean] :clear_cookies Clear response cookies
|
30
|
+
#
|
31
|
+
# If :domain is nil, the Host header from the request will be
|
32
|
+
# used to determine the domain sent for the cookie.
|
33
|
+
#
|
30
34
|
def initialize(app, opts={})
|
31
35
|
@app = app
|
32
36
|
@hash = {}
|
@@ -76,6 +80,7 @@ module Session
|
|
76
80
|
def load_session(env)
|
77
81
|
@hash.clear unless @hash.empty?
|
78
82
|
r = Rack::Request.new(env)
|
83
|
+
@opts[:domain] ||= r.host
|
79
84
|
cookie = r.cookies[@opts[:cookie_name]]
|
80
85
|
return if cookie.nil?
|
81
86
|
@hash = Marshal.load(cipher(:decrypt, cookie)) rescue {}
|
@@ -88,7 +93,7 @@ module Session
|
|
88
93
|
def save_session(r)
|
89
94
|
return r if !r.is_a?(Array) || (r.is_a?(Array) && r[0] == -1)
|
90
95
|
|
91
|
-
unless @hash.empty?
|
96
|
+
unless @hash.empty?
|
92
97
|
data = cipher(:encrypt, Marshal.dump(@hash)) rescue nil
|
93
98
|
c = {
|
94
99
|
value: data,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-session-encryptedcookie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Hentenaar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
83
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.6
|
84
|
+
rubygems_version: 2.7.6
|
85
85
|
signing_key:
|
86
86
|
specification_version: 4
|
87
87
|
summary: Encrypted session middleware for Rack
|