fridge 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c01604ddabbbd9a954e9fe73e1567aa0232509c30ed09e7694315131e0402abf
4
- data.tar.gz: fd4199b0194b7a63e7062c630dc9bb58c75eab607e27ebf13d24fe001a654c40
3
+ metadata.gz: f2d340550f97b33c430967cef5b8de4a59b73acfdd5a1ce62ad3ee7d17a6f8c9
4
+ data.tar.gz: 06a758734a6b6e668043c3bffe2cf350495325dfdab4f73948e2788f97d5c89d
5
5
  SHA512:
6
- metadata.gz: 2df7422238fac73bb4263af3af697d049b8ae870ed4c1610c40fdde3bcfd422b0cf8ac5f92a3889201b2aec5d222cda04fc49f5ee1797f6a0a2e3ea615094cb7
7
- data.tar.gz: e11293fdad80f5a7dfa6f6538b244f67ed59fc8e9867dde34c49c1067555936881b4d7b0de9f0ab5910a2a57b6d68dec0bd76462c888f7531c12ccdd6beb5d47
6
+ metadata.gz: d8b53167a69aaf39d60b4abbe6ad347968efddc1b2333dc12136b730600d65ab0c72fc8c7416d190b33fc55ce3571d8b98cbf1322c7a0eddd46c46517114cc0c
7
+ data.tar.gz: 0632f0de72e4654663256000e201568745697a05170e49191d31598a9a5bd2f6158871379253bee1302d3b10ebf76c5a6b84d2baae803cf8fd935bb4324a47b3
@@ -126,7 +126,11 @@ module Fridge
126
126
  end
127
127
 
128
128
  def auth_domain
129
- Aptible::Auth.configuration.root_url.sub(%r{^https?://}, '')
129
+ domain = URI.parse(Aptible::Auth.configuration.root_url).host
130
+
131
+ # On localhost we fall back to the default setting b/c browsers won't set
132
+ # cookies if localhost is named
133
+ domain == 'localhost' ? :all : domain
130
134
  rescue StandardError
131
135
  'auth.aptible.com'
132
136
  end
@@ -1,3 +1,3 @@
1
1
  module Fridge
2
- VERSION = '0.4.3'.freeze
2
+ VERSION = '0.4.4'.freeze
3
3
  end
@@ -215,5 +215,25 @@ describe Fridge::RailsHelpers do
215
215
  expect(options[:domain]).to eq 'auth.aptible.com'
216
216
  expect(options[:foobar]).to eq true
217
217
  end
218
+
219
+ it 'restricts cookies to the specific subdomain' do
220
+ auth = class_double('Aptible::Auth').as_stubbed_const
221
+ allow(auth).to receive_message_chain(:configuration, :root_url) do
222
+ 'https://auth-bob.aptible-sandbox.com'
223
+ end
224
+
225
+ options = controller.fridge_cookie_options
226
+ expect(options[:domain]).to eq 'auth-bob.aptible-sandbox.com'
227
+ end
228
+
229
+ it 'handles local development using defaults' do
230
+ auth = class_double('Aptible::Auth').as_stubbed_const
231
+ allow(auth).to receive_message_chain(:configuration, :root_url) do
232
+ 'https://localhost:4000'
233
+ end
234
+
235
+ options = controller.fridge_cookie_options
236
+ expect(options[:domain]).to eq :all
237
+ end
218
238
  end
219
239
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fridge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Macreery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-26 00:00:00.000000000 Z
11
+ date: 2021-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config