multi_session_store 0.2.3 → 0.2.4
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4300243252df6e9c90b1432e2063d202009467f7ddc9a598ce1fdbaf25e4ad1
|
4
|
+
data.tar.gz: 7e1c9b49d42ba1bae75d7ebf67e2a45faea75e7d5a195b35e0facfe296a7425d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '069e1432d811f474a43d6309c1c7a6b719291eb4d2facb74b1f96212d89a519cd6d3e92b0814f5893028cf0b03b531b0634802e700a6a6f73d07323127801916'
|
7
|
+
data.tar.gz: 6e7164dc18adb76b6f1861b351904384bece8b9ecb35c2d77d2b38f8d979a598cf6428c602b7d2a5b8351e8d872cc98998df7c53d23275a53b578a40ec04e735
|
data/lib/multi_session_store.rb
CHANGED
@@ -9,10 +9,11 @@ module ActionDispatch
|
|
9
9
|
module Session
|
10
10
|
class MultiSessionStore < AbstractStore
|
11
11
|
DEFAULT_SESSION_EXPIRATION = 24 * 60 * 60
|
12
|
+
DEFAULT_PARAM_NAME = 'subsession_id'.freeze
|
12
13
|
|
13
14
|
def initialize(app, options = {})
|
14
15
|
options[:expire_after] ||= DEFAULT_SESSION_EXPIRATION
|
15
|
-
options[:param_name] ||=
|
16
|
+
options[:param_name] ||= DEFAULT_PARAM_NAME
|
16
17
|
options[:serializer] ||= JSON
|
17
18
|
@redis = options[:redis]
|
18
19
|
@param_name = options[:param_name]
|
@@ -9,12 +9,23 @@ module MultiSessionStore
|
|
9
9
|
|
10
10
|
def call(env)
|
11
11
|
request = Rack::Request.new(env)
|
12
|
-
|
12
|
+
set_subsession_id_from_header(request)
|
13
|
+
generate_subsession_id_if_needed(request)
|
13
14
|
@app.call(env)
|
14
15
|
end
|
15
16
|
|
16
17
|
private
|
17
18
|
|
19
|
+
SUBSESSION_ID_HEADER = 'HTTP_X_SUBSESSIONID'.freeze
|
20
|
+
|
21
|
+
def set_subsession_id_from_header(request)
|
22
|
+
request.update_param 'subsession_id', request.get_header(SUBSESSION_ID_HEADER) if request.has_header?(SUBSESSION_ID_HEADER)
|
23
|
+
end
|
24
|
+
|
25
|
+
def generate_subsession_id_if_needed(request)
|
26
|
+
request.update_param 'subsession_id', new_subsession_id if subsession_id_is_needed?(request)
|
27
|
+
end
|
28
|
+
|
18
29
|
def new_subsession_id
|
19
30
|
SecureRandom.hex
|
20
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_session_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emarsys Smart Insight developers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|