auth_master 0.0.8 → 0.0.10

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: 465dc1614e4aa11f48ee2d631c43a1ca81926f2395704c070c8af60665b57cf4
4
- data.tar.gz: 862a7ead9a245e5b6535f0ba6c27a08bb64281c870e2c0ccabde922cec66dd51
3
+ metadata.gz: f5b595e57c445d5be892deb1a562ffcee119832fc6c13ac8d7787f51701885ca
4
+ data.tar.gz: 9b225df7392f7d2124bfa5f6dfd472095e59f318beab883688c4b09eabd69d00
5
5
  SHA512:
6
- metadata.gz: 652d11d74a8903c6fde096eeb2ee81a8a84413f7b2300fb9f9e4485b6c2afe0a8446c3c76e5f9502bb4b87921796bad250ea44bf96351bd40baa960251cc2f01
7
- data.tar.gz: 494987f3d79d807b29030913cfd379897b49f92395d1f3f34113fd9a19edb21b6da514c93aad1d53eaefccb6e128dd4ec92df2a544537720a9587e73b1295b95
6
+ metadata.gz: 4a038fe71e626f995c536808eeebd4aab5e68aa365ed1940f5d013227e411879ec155ff1d8a069dd63d91e2fe18616ab11e5f39b6ce2c9c568675a0ca2e9a59b
7
+ data.tar.gz: fcd4fc93039ac69c689d00e83aa1bf830ee442f27e1ea05d162146071a1393db553f9e4af0d89ec562c64e76c683cc54e06f4b22a58e6f69d33821a9746278df
@@ -21,6 +21,7 @@ module AuthMaster::CurrentConcern
21
21
  return if !target.persisted?
22
22
 
23
23
  uuid = auth_master_session_id_generator
24
+ target_class = target.respond_to?(:auth_master_config_class) ? target.auth_master_config_class : target.class
24
25
  session[auth_master_session_key(target.class)] = uuid
25
26
 
26
27
  AuthMaster::PrepareTokenOperation.call!(target, uuid:, purpose:)
@@ -35,6 +36,13 @@ module AuthMaster::CurrentConcern
35
36
  session.delete(auth_master_session_key(target_class))
36
37
  session[auth_master_target_session_key(target_class)] = auth_master_session.id
37
38
 
39
+ auth_master_session.target
40
+ end
41
+
42
+ def auth_master_login_as!(target)
43
+ auth_master_session = AuthMaster::LoginOperation.call!(target, uuid: auth_master_session_id_generator)
44
+ session[auth_master_target_session_key(target.class)] = auth_master_session.id
45
+
38
46
  true
39
47
  end
40
48
 
@@ -32,7 +32,8 @@ module AuthMaster
32
32
  return target if target.is_a? Symbol
33
33
  return target.to_sym if target.is_a? String
34
34
 
35
- target.class.to_s.underscore.to_sym
35
+ target_class_name = target.respond_to?(:auth_master_config_class) ? target.auth_master_config_class : target.class
36
+ target_class_name.to_s.underscore.to_sym
36
37
  end
37
38
 
38
39
  def config_for(target, name)
@@ -0,0 +1,10 @@
1
+ module AuthMaster
2
+ class LoginOperation < AuthMaster::AbstractOperation
3
+ def self.call!(target, uuid:)
4
+ auth_master_session = AuthMaster::SessionService.create!(target, uuid:, force: true)
5
+ AuthMaster::SessionService.activate!(auth_master_session)
6
+
7
+ auth_master_session
8
+ end
9
+ end
10
+ end
@@ -5,10 +5,9 @@ module AuthMaster
5
5
  extend AuthMaster::Config
6
6
 
7
7
  class << self
8
- def create!(target, uuid:)
9
- return if !allow_creation?(target)
10
-
11
- AuthMaster::Session.create!(target:, id: uuid)
8
+ def create!(target, uuid:, force: false)
9
+ # return unless force || allow_creation?(target)
10
+ AuthMaster::Session.create!(target:, id: uuid) if force || allow_creation?(target)
12
11
  end
13
12
 
14
13
  def inactive_find(id)
@@ -1,3 +1,3 @@
1
1
  module AuthMaster
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.10"
3
3
  end
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.8
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - vickodin
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-17 00:00:00.000000000 Z
10
+ date: 2025-05-18 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -65,6 +65,7 @@ files:
65
65
  - app/operations/auth_master/abstract_operation.rb
66
66
  - app/operations/auth_master/check_link_operation.rb
67
67
  - app/operations/auth_master/login_by_token_operation.rb
68
+ - app/operations/auth_master/login_operation.rb
68
69
  - app/operations/auth_master/logout_operation.rb
69
70
  - app/operations/auth_master/prepare_token_operation.rb
70
71
  - app/operations/auth_master/send_link_operation.rb