multi_session 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/generators/templates/multi_session.rb +3 -0
- data/lib/multi_session.rb +3 -0
- data/lib/multi_session/session.rb +4 -2
- data/lib/multi_session/version.rb +1 -1
- data/spec/dummy/config/initializers/multi_session.rb +3 -0
- data/spec/requests/multi_session_spec.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 968316d7433d4cb697127a2eb4259963fdb7906dfbeae0a62fdc2fd8b24c050f
|
4
|
+
data.tar.gz: b0dc08f5da761fde6a3efc921d178dc0ce9f08ece64700670c5376be95f4169c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5db43e18b72f05c9ef6531c73cb8e4df7304fb59924cc38653c3c1639e517a1b911a0a2fb1f4abc24feb352a3f765339f173ea701ea19f793375fb9fc74d70e4
|
7
|
+
data.tar.gz: dc1fbfb3cf451ce563c1e8bedb97691b416319dc1b1821970b9488063a06b83ba5694bbd653057e0bdd701ca1cf67687c780d2b60b63f922d6cd1a630338eed2
|
data/README.md
CHANGED
@@ -70,6 +70,7 @@ For the current version `multi_session`, there these are the configuration value
|
|
70
70
|
| Config option | Type | Description |
|
71
71
|
|---------------------------------------|-------------------------|-------------------------------------------------------|
|
72
72
|
| `expires` | ActiveSupport::Duration | expiration period for `multi_session` cookies/values |
|
73
|
+
| `domain` | String/Symbol/Array | domain for the `multi_session` cookies |
|
73
74
|
| `authenticated_encrypted_cookie_salt` | String | Salt used to derive key for GCM encryption |
|
74
75
|
| `credentials_strategy` | String/Symbol | Strategy for managing credentials. |
|
75
76
|
|
@@ -89,6 +90,9 @@ MultiSession.setup do |config|
|
|
89
90
|
# Uncomment to force multi_session cookies to expire after a period of time
|
90
91
|
config.expires = 30.minutes
|
91
92
|
|
93
|
+
# Uncomment to change the domain of the multi_session cookies
|
94
|
+
# config.domain = nil
|
95
|
+
|
92
96
|
# Salt used to derive key for GCM encryption. Default value is 'multi session authenticated encrypted cookie'
|
93
97
|
config.authenticated_encrypted_cookie_salt = 'my multi session salt value'
|
94
98
|
|
@@ -2,6 +2,9 @@ MultiSession.setup do |config|
|
|
2
2
|
# Uncomment to force multi_session cookies to expire after a period of time
|
3
3
|
# config.expires = 30.minutes
|
4
4
|
|
5
|
+
# Uncomment to change the domain of the multi_session cookies
|
6
|
+
# config.domain = nil
|
7
|
+
|
5
8
|
# Salt used to derive key for GCM encryption. Default value is 'multi session authenticated encrypted cookie'
|
6
9
|
# config.authenticated_encrypted_cookie_salt = 'multi session authenticated encrypted cookie'
|
7
10
|
|
data/lib/multi_session.rb
CHANGED
@@ -28,8 +28,10 @@ module MultiSession
|
|
28
28
|
end
|
29
29
|
|
30
30
|
raise ActionDispatch::Cookies::CookieOverflow if encrypted_and_signed_value.bytesize > ActionDispatch::Cookies::MAX_COOKIE_SIZE
|
31
|
-
|
32
|
-
|
31
|
+
multi_session_cookie = { value: encrypted_and_signed_value }
|
32
|
+
multi_session_cookie.merge!({ expires: MultiSession.expires}) if MultiSession.expires.present?
|
33
|
+
multi_session_cookie.merge!({ domain: MultiSession.domain }) if MultiSession.domain.present?
|
34
|
+
@cookies[key.to_s] = multi_session_cookie
|
33
35
|
nil
|
34
36
|
end
|
35
37
|
|
@@ -2,6 +2,9 @@ MultiSession.setup do |config|
|
|
2
2
|
# Uncomment to force multi_session cookies to expire after a period of time
|
3
3
|
# config.expires = 30.minutes
|
4
4
|
|
5
|
+
# Uncomment to change the domain of the multi_session cookies
|
6
|
+
# config.domain = nil
|
7
|
+
|
5
8
|
# Salt used to derive key for GCM encryption. Default value is 'multi session authenticated encrypted cookie'
|
6
9
|
# config.authenticated_encrypted_cookie_salt = 'multi session authenticated encrypted cookie'
|
7
10
|
|
@@ -37,4 +37,15 @@ RSpec.describe 'multi_session', type: :request do
|
|
37
37
|
|
38
38
|
expect(aaaa_cookie_string).to include(expire_string)
|
39
39
|
end
|
40
|
+
|
41
|
+
it 'can set the domain of session cookies' do
|
42
|
+
domain = '.somedomain.com'
|
43
|
+
MultiSession.setup do |config|
|
44
|
+
config.domain = domain
|
45
|
+
end
|
46
|
+
get '/encrypt_multi_sessions', params: { session_values: { aaaa: 'alpha' }}
|
47
|
+
aaaa_cookie_string = response.headers['Set-Cookie'].split("\n").select{ |str| str.include?('aaaa=')}.first
|
48
|
+
domain_string = "domain=#{domain}"
|
49
|
+
expect(aaaa_cookie_string).to include(domain_string)
|
50
|
+
end
|
40
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_session
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Huber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|