authie 4.0.0.rc4 → 4.0.0.rc5
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 +4 -4
- data/lib/authie/controller_delegate.rb +13 -6
- data/lib/authie/controller_extension.rb +3 -1
- data/lib/authie/session.rb +0 -1
- 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: 1d9373c828cdac9b7663eb05db6954ff069f5e6d8164d64c8dcf5fd165ca0d09
|
4
|
+
data.tar.gz: c4b98e9bb20edce2539761806affda87fd4d56082b7c9e956842424cac8a6e27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b90a45ff82b29992deec7c2e7c09604a3a569bdfbe099ba2f7be26989c9bd91417b7446d7ea2d8ad0f85f55d42d9ed9356a203dc239e88f568ccf64cb4faa363
|
7
|
+
data.tar.gz: 9c66674049a1a8c36389faa84764b296f7879d59b5cdd3c6bc7b06946874ffec6fec23cd1194a0b68367391237814938a1de19db0ef7958af005d7a9ce2d66ef
|
@@ -36,18 +36,25 @@ module Authie
|
|
36
36
|
proposed_browser_id
|
37
37
|
end
|
38
38
|
|
39
|
-
#
|
40
|
-
#
|
41
|
-
# it will reteurn false if there is no session/not logged in. It is safe to run this on
|
42
|
-
# all requests even if there is no session.
|
39
|
+
# Validate the auth session to ensure that it is current validate and raise an error if it
|
40
|
+
# is not suitable for use.
|
43
41
|
#
|
44
42
|
# @return [Authie::Session, false]
|
45
|
-
def
|
46
|
-
return auth_session.
|
43
|
+
def validate_auth_session
|
44
|
+
return auth_session.validate if logged_in?
|
47
45
|
|
48
46
|
false
|
49
47
|
end
|
50
48
|
|
49
|
+
# Touch the session to update details on the latest activity.
|
50
|
+
#
|
51
|
+
# @return [Authie::Session, false]
|
52
|
+
def touch_auth_session
|
53
|
+
yield if block_given?
|
54
|
+
ensure
|
55
|
+
auth_session.touch if logged_in?
|
56
|
+
end
|
57
|
+
|
51
58
|
# Return the user for the currently logged in user or nil if no user is logged in
|
52
59
|
#
|
53
60
|
# @return [ActiveRecord::Base, nil]
|
@@ -7,9 +7,11 @@ module Authie
|
|
7
7
|
class << self
|
8
8
|
def included(base)
|
9
9
|
base.helper_method :logged_in?, :current_user, :auth_session
|
10
|
-
base.before_action :set_browser_id, :
|
10
|
+
base.before_action :set_browser_id, :validate_auth_session
|
11
|
+
base.around_action :touch_auth_session
|
11
12
|
|
12
13
|
base.delegate :set_browser_id, to: :auth_session_delegate
|
14
|
+
base.delegate :validate_auth_session, to: :auth_session_delegate
|
13
15
|
base.delegate :touch_auth_session, to: :auth_session_delegate
|
14
16
|
base.delegate :current_user, to: :auth_session_delegate
|
15
17
|
base.delegate :create_auth_session, to: :auth_session_delegate
|
data/lib/authie/session.rb
CHANGED
@@ -88,7 +88,6 @@ module Authie
|
|
88
88
|
# @raises [ActiveRecord::RecordInvalid]
|
89
89
|
# @return [Authie::Session]
|
90
90
|
def touch
|
91
|
-
validate
|
92
91
|
@session.last_activity_at = Time.now
|
93
92
|
@session.last_activity_ip = @controller.request.ip
|
94
93
|
@session.last_activity_path = @controller.request.path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.
|
4
|
+
version: 4.0.0.rc5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Cooke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|