auth_master 0.0.4 → 0.0.5
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/app/controllers/auth_master/sessions_controller.rb +12 -0
- data/app/models/auth_master/session.rb +1 -1
- data/app/operations/auth_master/logout_operation.rb +10 -0
- data/app/services/auth_master/session_service.rb +5 -0
- data/config/routes.rb +7 -9
- data/lib/auth_master/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af811daf24f09f98a0a9c93aa4eba5f7fbebafe0a08f1fc68f3ce11491de2c14
|
4
|
+
data.tar.gz: 90418adf94d7341733371256330cb504c956aac0b358d4b1b323a5a220220056
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f5fe2fc28562f1128a3f41e9a783b6b7983dac6753215d69629d3faea0ebf5148bde172f8afbe634a188825cd3422584179cf1b903f09ed74618f6224dbfa9b
|
7
|
+
data.tar.gz: fae32da2226266542bb294e57f925b86ab5d29a50073ee23fa6d394b91066b5cb606bb1d357b7e260ea93c94039e381fff8e50589d0f44e139e771c78be70e0d
|
@@ -35,6 +35,18 @@ module AuthMaster
|
|
35
35
|
session.delete(session_key)
|
36
36
|
session[target_session_key] = auth_master_session.id
|
37
37
|
|
38
|
+
# TODO: Use config for
|
39
|
+
# a) session key;
|
40
|
+
# b) default redirect path
|
41
|
+
saved_path = session.delete("redirect_to")
|
42
|
+
redirect_to(saved_path || "/")
|
43
|
+
end
|
44
|
+
|
45
|
+
def destroy
|
46
|
+
auth_master_session_id = session.delete(target_session_key)
|
47
|
+
AuthMaster::LogoutOperation.call!(auth_master_session_id)
|
48
|
+
|
49
|
+
# TODO: Use config for redirect_path
|
38
50
|
redirect_to("/")
|
39
51
|
end
|
40
52
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module AuthMaster
|
2
|
+
class LogoutOperation < AuthMaster::AbstractOperation
|
3
|
+
def self.call!(auth_master_session_id)
|
4
|
+
auth_master_session = AuthMaster::Session.active.find_by(id: auth_master_session_id)
|
5
|
+
return if auth_master_session.blank?
|
6
|
+
|
7
|
+
AuthMaster::SessionService.logout!(auth_master_session)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -16,8 +16,13 @@ module AuthMaster
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def activate!(auth_master_session)
|
19
|
+
# TODO: Save IP Address, User Agent, etc
|
19
20
|
auth_master_session.active!
|
21
|
+
end
|
22
|
+
|
23
|
+
def logout!(auth_master_session)
|
20
24
|
# TODO: Save IP Address, User Agent, etc
|
25
|
+
auth_master_session.logout!
|
21
26
|
end
|
22
27
|
|
23
28
|
private
|
data/config/routes.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
AuthMaster::Engine.routes.draw do
|
2
|
-
get
|
3
|
-
post
|
4
|
-
|
5
|
-
get
|
6
|
-
|
7
|
-
get
|
8
|
-
|
9
|
-
|
10
|
-
get "/:target/denied", to: "sessions#denied", as: :auth_master_denied
|
2
|
+
get "/:target/login", to: "sessions#new", as: :auth_master_login
|
3
|
+
post "/:target/login", to: "sessions#create"
|
4
|
+
get "/:target/sent", to: "sessions#sent", as: :auth_master_sent
|
5
|
+
get "/:target/link", to: "sessions#link", as: :auth_master_link
|
6
|
+
post "/:target/link", to: "sessions#activate"
|
7
|
+
get "/:target/denied", to: "sessions#denied", as: :auth_master_denied
|
8
|
+
delete "/:target/logout", to: "sessions#destroy", as: :auth_master_logout
|
11
9
|
end
|
data/lib/auth_master/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auth_master
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vickodin
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-03-
|
10
|
+
date: 2025-03-30 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rails
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- app/models/auth_master/session.rb
|
65
65
|
- app/operations/auth_master/abstract_operation.rb
|
66
66
|
- app/operations/auth_master/check_link_operation.rb
|
67
|
+
- app/operations/auth_master/logout_operation.rb
|
67
68
|
- app/operations/auth_master/send_link_operation.rb
|
68
69
|
- app/services/auth_master/session_service.rb
|
69
70
|
- app/views/auth_master/sessions/link.html.erb
|