multi_session 1.1.2 → 1.1.3

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: a322fc88af7d9e2bd2d78890eb8b1b8c5dcb7a88e507e483307dd5e0e7496c34
4
- data.tar.gz: cc6d3967a80f57e985d5e433ee7ce5decbc2d4a6bd6b367a8c2a73e36fa2b1d9
3
+ metadata.gz: 968316d7433d4cb697127a2eb4259963fdb7906dfbeae0a62fdc2fd8b24c050f
4
+ data.tar.gz: b0dc08f5da761fde6a3efc921d178dc0ce9f08ece64700670c5376be95f4169c
5
5
  SHA512:
6
- metadata.gz: 3218f0adb548595c4cae01a439c22438846e6274da0e7cd5f60d01f8fd8a9a6a868b55f739e956d71cde6ff7330bb870d60cc80c921153b2d5e904757e41decf
7
- data.tar.gz: 67555d4b3b344dc263f1efa62a311b6b767fd4013ed401b9c15b7aee633e699e952b27ff2f7cafa6e9394bc8518930edb25f1d99fd6c2fa69ec755cba8769e36
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
@@ -9,6 +9,9 @@ module MultiSession
9
9
  mattr_accessor :expires
10
10
  @@expires = nil
11
11
 
12
+ mattr_accessor :domain
13
+ @@domain = nil
14
+
12
15
  mattr_accessor :credentials_strategy
13
16
  @@credentials_strategy = nil
14
17
 
@@ -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
- @cookies[key.to_s] = {value: encrypted_and_signed_value}.merge(MultiSession.expires.present? ? {expires: MultiSession.expires} : {})
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
 
@@ -1,3 +1,3 @@
1
1
  module MultiSession
2
- VERSION = '1.1.2'
2
+ VERSION = '1.1.3'
3
3
  end
@@ -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.2
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: 2018-11-15 00:00:00.000000000 Z
11
+ date: 2019-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails