apiphobic-authorization 1.4.0 → 1.5.0

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: e58d17605d7ccccd2b7c4f269a0a2e9ce436b823eb932239c0c9fc2e3ae52638
4
- data.tar.gz: 6af62fc6a6a279ff1a5d35a93cd47f03ddeb35bd7dc5881a78878d7770d772b3
3
+ metadata.gz: 3ea83f219faa3fde9a7f400699da72998120e0d566d02e3a110da2e503030f90
4
+ data.tar.gz: e25f16488e4565a6466d39436f3f2dc497e5fb8ccd2b0fe2dedb520c8a525238
5
5
  SHA512:
6
- metadata.gz: a685c43659747f19cec61d5638b0eb31f585a9f22994180728853269975d302a13dece220a24b863e832ee353e2014b3cd54c05472ab51438c905554c1f873c3
7
- data.tar.gz: a12292dfd3e72c1f31bbf12510a9635baabc480ebd4e592b4fd94df310115055cad435ede3d371d8e22e40ea396ce6eabab28aa2588178a81690324bf22a83db
6
+ metadata.gz: 9535e821c18f7e8d81972db0cc8ac7d0e04bcb783aa3aa817e3b4ded028687318b60dd34df6d03b8195ff1d7e917cb01a90080a395fab168f3516da13d2ec1e1
7
+ data.tar.gz: 30377b4f59ce2cfa8b44ff0913efde6e3a4b0c10b2f40a51a5b388a541defc67d72df2506cdae2c90a29968c8d4691aaadd4386a313276a5d5cfe61c8ba37806
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -7,15 +7,15 @@ class Authorizer
7
7
  :parameters,
8
8
  :resource,
9
9
  :token,
10
- :user
10
+ :audience
11
11
 
12
12
  # rubocop:disable Metrics/ParameterLists
13
- def initialize(action:, token:, user:, issuer:, parameters:, resource:, **other)
13
+ def initialize(action:, token:, audience:, issuer:, parameters:, resource:, **other)
14
14
  self.action = action
15
- self.token = token
16
- self.user = user
15
+ self.audience = audience
17
16
  self.parameters = parameters
18
17
  self.resource = resource
18
+ self.token = token
19
19
 
20
20
  other.each do |name, value|
21
21
  public_send("#{name}=", value)
@@ -23,6 +23,8 @@ class Authorizer
23
23
  end
24
24
  # rubocop:enable Metrics/ParameterLists
25
25
 
26
+ alias user audience
27
+
26
28
  def able_to_index?
27
29
  false
28
30
  end
@@ -12,9 +12,9 @@ class Parameters
12
12
  using ::AppleCore::Refinements::DeepDup
13
13
 
14
14
  attr_accessor :action,
15
+ :audience,
15
16
  :parameters,
16
- :token,
17
- :user
17
+ :token
18
18
 
19
19
  attr_writer :authorized_attributes,
20
20
  :authorized_filters,
@@ -24,11 +24,11 @@ class Parameters
24
24
  :ignored_attributes
25
25
 
26
26
  # rubocop:disable Metrics/ParameterLists
27
- def initialize(action:, token:, user:, issuer:, parameters:, **other)
27
+ def initialize(action:, token:, audience:, issuer:, parameters:, **other)
28
28
  self.action = action
29
+ self.audience = audience
29
30
  self.parameters = parameters.deep_dup
30
31
  self.token = token
31
- self.user = user
32
32
 
33
33
  other.each do |name, value|
34
34
  public_send("#{name}=", value)
@@ -36,6 +36,8 @@ class Parameters
36
36
  end
37
37
  # rubocop:enable Metrics/ParameterLists
38
38
 
39
+ alias user audience
40
+
39
41
  def authorized_parameters
40
42
  @authorized_parameters || [
41
43
  :include,
@@ -9,18 +9,18 @@ class Scope
9
9
  using ::AppleCore::Refinements::String
10
10
 
11
11
  attr_accessor :action,
12
- :token,
13
- :user,
12
+ :audience,
14
13
  :raw_parameters,
15
- :scope_root
14
+ :scope_root,
15
+ :token
16
16
 
17
17
  # rubocop:disable Metrics/ParameterLists
18
- def initialize(action:, token:, user:, issuer:, parameters:, scope_root:, **other)
18
+ def initialize(action:, token:, audience:, issuer:, parameters:, scope_root:, **other)
19
19
  self.action = action
20
- self.token = token
21
- self.user = user
20
+ self.audience = audience
22
21
  self.raw_parameters = parameters
23
22
  self.scope_root = scope_root
23
+ self.token = token
24
24
 
25
25
  other.each do |name, value|
26
26
  public_send("#{name}=", value)
@@ -28,6 +28,8 @@ class Scope
28
28
  end
29
29
  # rubocop:enable Metrics/ParameterLists
30
30
 
31
+ alias user audience
32
+
31
33
  def user_scope
32
34
  scope_root.public_send("for_#{user_underscored_class_name}", scope_user_id)
33
35
  end
@@ -68,10 +68,10 @@ module Resource
68
68
  .class
69
69
  .authorizer_parameters_class
70
70
  .new(action: action_name,
71
- token: token,
72
- user: authorized_user,
71
+ audience: authorized_audience,
73
72
  issuer: authorized_issuer,
74
- parameters: params)
73
+ parameters: params,
74
+ token: token)
75
75
  .call
76
76
  end
77
77
 
@@ -84,11 +84,11 @@ module Resource
84
84
  .class
85
85
  .authorizer_scope_class
86
86
  .new(action: action_name,
87
- token: token,
88
- user: authorized_user,
87
+ audience: authorized_audience,
89
88
  issuer: authorized_issuer,
90
89
  parameters: authorized_parameters,
91
- scope_root: self.class.authorized_scope_root_class)
90
+ scope_root: self.class.authorized_scope_root_class,
91
+ token: token)
92
92
  .call
93
93
  end
94
94
 
@@ -103,11 +103,11 @@ module Resource
103
103
  .class
104
104
  .authorizer_class
105
105
  .new(action: action_name,
106
- token: token,
107
- user: authorized_user,
106
+ audience: authorized_audience,
108
107
  issuer: authorized_issuer,
109
108
  parameters: authorized_parameters,
110
- resource: authorized_resource&.processed)
109
+ resource: authorized_resource&.processed,
110
+ token: token)
111
111
  end
112
112
 
113
113
  def authorized_resource
@@ -129,8 +129,8 @@ module Resource
129
129
  parameters: authorized_parameters)
130
130
  end
131
131
 
132
- def authorized_user
133
- current_user
132
+ def authorized_audience
133
+ current_audience
134
134
  end
135
135
 
136
136
  def authorized_issuer
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Apiphobic
4
4
  module Authorization
5
- VERSION = '1.4.0'
5
+ VERSION = '1.5.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apiphobic-authorization
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thegranddesign
@@ -31,7 +31,7 @@ cert_chain:
31
31
  Y2GAoHKstmfIVhc4XHOPpmTd2o/C29O9oaRgjrkfQEhF/KvJ/PhoV5hvokzsCyI5
32
32
  iUeXPfvrGD/itYIBCgk+fnzyQQ4QtE5hTQaWQ3o2
33
33
  -----END CERTIFICATE-----
34
- date: 2018-07-09 00:00:00.000000000 Z
34
+ date: 2018-07-11 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: apiphobic-resource
metadata.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- d�s��w Vd]7h��3a��<�����硁,Q�,p/@�\���!�|�������Ă�I�"3=���Tc?Ӕ(
2
- �?R6�#?b|H���a�βԤ7�������, :.l<t�:�䚑��iOEpK�t_$�z"���8�Wsj G�'��h���o�`�ػ���gJU���:���F�S�^�^���["���i� 4k��}��l�g?�;BTD�~���dGfSq8����ې�%��Z�ّG�l����@�
1
+ ��&:w��Fpk�����3ݵ3��,��d8�3s�'�[��v��4��0���m��S�<���!�D�ԫ*��=T}gAW+�&���9��se4| Q�{�F�����:(����}lWho�;�$D�a�P����V��a��P4���̮͟�DE=��楩��5= ���C&2����$��j��Jne��
2
+ 43'A�|���|G���[���Ĕ2e���(݂�p��o��jUC�<�+3ߔ���