authie 3.3.1 → 3.3.2

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: 4351fb61c9e32ab9e4719b811ce293391275a3af0dc7d76972fecc4b10e755d8
4
- data.tar.gz: e7522427a422d28cb6a41e9cd4f932384f3408a4bc13b83e47909377d1cc783e
3
+ metadata.gz: d7e6e128785f1066cf922e408c6f28ae3ae3da8a6db98b3e51c4c74b7e43feb5
4
+ data.tar.gz: 35b6e941d8e107432b1249fc6c770009984daac729de967605144a0e79a493fc
5
5
  SHA512:
6
- metadata.gz: b1f52adcafa68d13fc43c4cd00a374f3f8d0ac83e234973dc862e77a4aab51505c847c528e3bf81576ae473481ecf8b7659acb7944dfc6d4caa8ff972cabe865
7
- data.tar.gz: ca2f130a5d8b671fce1026e8d7b2e327d2c9e9226768dcb466f69cdddac6dae64d7255eabfa636b97e13af4485062b16a2b0a338b202187c7c38181503b1a526
6
+ metadata.gz: d66e30a5133c29f904297c48b16c980362a87e8b6900ccf6528ec33cb3bd3a7007fac8dd62e9f84392b4af9db4fd674e2b03105c0ce65a00541bc8c9e8c2dbb9
7
+ data.tar.gz: dcf1015fa423bd07c8cd5b1fbab5125938006706c1e766ed30892359d2560a56df3a458dc15403538f9cc476ba887730a80ba07d1dc809cc40b508876df3ed88
@@ -87,9 +87,9 @@ module Authie
87
87
  end
88
88
 
89
89
  # Sets the cookie on the associated controller.
90
- def set_cookie!
90
+ def set_cookie!(value = self.temporary_token)
91
91
  cookies[:user_session] = {
92
- :value => self.temporary_token,
92
+ :value => value,
93
93
  :secure => controller.request.ssl?,
94
94
  :httponly => true,
95
95
  :expires => self.expires_at
@@ -98,6 +98,18 @@ module Authie
98
98
  true
99
99
  end
100
100
 
101
+ # Sets the cookie for the parent session on the associated controller.
102
+ def set_parent_cookie!
103
+ cookies[:parent_user_session] = {
104
+ :value => cookies[:user_session],
105
+ :secure => controller.request.ssl?,
106
+ :httponly => true,
107
+ :expires => self.expires_at
108
+ }
109
+ Authie.config.events.dispatch(:parent_session_cookie_updated, self)
110
+ true
111
+ end
112
+
101
113
  # Check the security of the session to ensure it can be used.
102
114
  def check_security!
103
115
  if controller
@@ -224,16 +236,18 @@ module Authie
224
236
 
225
237
  # Create a new session for impersonating for the given user
226
238
  def impersonate!(user)
239
+ set_parent_cookie!
227
240
  self.class.start(controller, :user => user, :parent => self)
228
241
  end
229
242
 
230
243
  # Revert back to the parent session
231
244
  def revert_to_parent!
232
- if self.parent
245
+ if self.parent && cookies[:parent_user_session]
233
246
  self.invalidate!
234
247
  self.parent.activate!
235
248
  self.parent.controller = self.controller
236
- self.parent.set_cookie!
249
+ self.parent.set_cookie!(cookies[:parent_user_session])
250
+ cookies.delete(:parent_user_session)
237
251
  self.parent
238
252
  else
239
253
  raise NoParentSessionForRevert, "Session does not have a parent therefore cannot be reverted."
@@ -1,3 +1,3 @@
1
1
  module Authie
2
- VERSION = '3.3.1'
2
+ VERSION = '3.3.2'
3
3
  end
metadata CHANGED
@@ -1,36 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authie
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.1
4
+ version: 3.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDZDCCAkygAwIBAgIBATANBgkqhkiG9w0BAQUFADA8MQswCQYDVQQDDAJtZTEZ
14
- MBcGCgmSJomT8ixkARkWCWFkYW1jb29rZTESMBAGCgmSJomT8ixkARkWAmlvMB4X
15
- DTE5MDUxNDEzNTIxM1oXDTIwMDUxMzEzNTIxM1owPDELMAkGA1UEAwwCbWUxGTAX
16
- BgoJkiaJk/IsZAEZFglhZGFtY29va2UxEjAQBgoJkiaJk/IsZAEZFgJpbzCCASIw
17
- DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMUohRlPw3iIOhWZq+qf5N1ATm1H
18
- 7gBO4TpsUrw/FL/+urFExzt1+4MPfiKjILge48vKpjoTfuZusRsOQebaFidOfmhk
19
- sEqa941CvN3OeUYARA53ORlmoLDLmdcrxq430+woFp4uuSYwim/2YQgIMdgiOTqs
20
- cHaM9yh/xUGMnH4lB9bBDNfggMmkSFb6P8Ax4rvdX3EVv5P58RHwHszd+UI4fyy9
21
- 0W143m6ntNmqena4ZOc7HtWtRyDHHXXzlGgmghKEZgOA+/LO53VHp+cM0JqB7lq5
22
- ZxN43fQrIT5yY9Dy7dRBeiDo53WNJPspa5soEivCBVYstMqfd+LGk/BnsyMCAwEA
23
- AaNxMG8wCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFGlRGerNfr6J
24
- Dprgl6DQ3kLvgVvPMBoGA1UdEQQTMBGBD21lQGFkYW1jb29rZS5pbzAaBgNVHRIE
25
- EzARgQ9tZUBhZGFtY29va2UuaW8wDQYJKoZIhvcNAQEFBQADggEBAK2TQPMeW9qh
26
- NDNoVbbplfSc8/uscSP2DfssCbhXQqeDfF2z+kQpxv8iAc++KTlotqOaX5A6RvLb
27
- NvuwMHPJRQJ2e8rbuN8Sh3tUjbkAEv3SFw4hqbKmtp0j2oKBU0dxHWNfp+5ulh2l
28
- UXnQAt4zg3v1hTD1VrwLqG/hyk9xAaWB38lEDBuPhLrDIdDJklg9bD1E2TUvoMrg
29
- L6TIbdP1TRrxINO1D9GzboR+OuWos7qMLBEEbjat/fQchYrW1KLcHIUCyrGkZTLm
30
- 3wUJNGnT5XYq+qvTqmjkTSTfdGvZCM63C6bGdN5CAyMokGOOatGqyCMAONolWnfC
31
- gm3t2GWWrxY=
32
- -----END CERTIFICATE-----
33
- date: 2019-10-01 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2020-09-25 00:00:00.000000000 Z
34
12
  dependencies:
35
13
  - !ruby/object:Gem::Dependency
36
14
  name: secure_random_string
@@ -90,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
68
  - !ruby/object:Gem::Version
91
69
  version: '0'
92
70
  requirements: []
93
- rubygems_version: 3.0.6
71
+ rubygems_version: 3.0.3
94
72
  signing_key:
95
73
  specification_version: 4
96
74
  summary: A Rails library for storing user sessions in a backend database
Binary file
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file