zaikio-jwt_auth 2.4.0 → 2.4.1

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: 3f46dba4c35870df1d25710905ff3451588f23f1fa8d02e304d9555c6816319c
4
- data.tar.gz: 42124c9514465ee6bd6a7a069402730cd0049ec6c9be2fea0e6348107176be6b
3
+ metadata.gz: d747cb5921e0b8c6f7b9424d15add0cf5d0471ee01d6db77ec2bb82577db794e
4
+ data.tar.gz: a38ec5412d24766df3bc6dee455a59a2ab9326216988545ecdc614ab46b7426e
5
5
  SHA512:
6
- metadata.gz: '018c6eb5215993e066d7f4b080250df0f1e02788675c86ce6da62d75a378c7f96e0d63b7b94cd81dea5ecc01d7c0fda8775691fb90ca05ab250708e0dbb3a4ba'
7
- data.tar.gz: 0cfdfc49f7c07fb39c076b693371bff9cc444e3a39aeb740bb281208cb9acf9651e84ad77662bd871399cda5b2d2666a515b0c86b39bec5f75bc06b1184427c9
6
+ metadata.gz: a7f3053aef038da812f845c77ac2fd5fa132a7ee77dd0d0ef638e1b81ac1c635a713af36f9c682806a12b44e2bf221602814011c678c92c5a966b816422e903e
7
+ data.tar.gz: fd8660695b98ccdca7d20142a9066f2287285a5ddf836c360e504a250163e95d9b9e5f31b11b3856a3de75c403c287b9a882eba0a9b6b30f7fd4e4ab9d307b90
@@ -5,7 +5,7 @@ require "logger"
5
5
  module Zaikio
6
6
  module JWTAuth
7
7
  class DirectoryCache
8
- class UpdateJob < ::ActiveJob::Base
8
+ class UpdateJob < ::ActiveJob::Base # rubocop:disable Rails/ApplicationJob
9
9
  def perform(directory_path)
10
10
  DirectoryCache.fetch(directory_path)
11
11
  true # This job will always re-queue until it succeeds.
@@ -1,5 +1,5 @@
1
1
  module Zaikio
2
2
  module JWTAuth
3
- VERSION = "2.4.0".freeze
3
+ VERSION = "2.4.1".freeze
4
4
  end
5
5
  end
@@ -131,8 +131,8 @@ module Zaikio
131
131
 
132
132
  private
133
133
 
134
- def find_scope_configuration(scope_configurations)
135
- scope_configurations.find do |scope_configuration|
134
+ def find_scope_configurations(scope_configurations)
135
+ scope_configurations.select do |scope_configuration|
136
136
  action_matches = action_matches_config?(scope_configuration)
137
137
 
138
138
  if action_matches && scope_configuration[:if] && !instance_exec(&scope_configuration[:if])
@@ -169,21 +169,23 @@ module Zaikio
169
169
  end
170
170
 
171
171
  def show_error_if_authorize_by_jwt_scopes_fails(token_data)
172
- configuration = find_scope_configuration(self.class.authorize_by_jwt_scopes)
172
+ configurations = find_scope_configurations(self.class.authorize_by_jwt_scopes)
173
173
 
174
- return if token_data.scope_by_configurations?(
175
- configuration,
176
- action_name
177
- )
174
+ return if configurations.empty?
178
175
 
179
- details = nil
176
+ configuration = configurations.find do |scope_configuration|
177
+ token_data.scope_by_configurations?(
178
+ scope_configuration,
179
+ action_name
180
+ )
181
+ end
180
182
 
181
- if configuration
182
- required_scopes = required_scopes(token_data, configuration)
183
+ return if configuration
183
184
 
184
- details = "This endpoint requires one of the following scopes: #{required_scopes.join(', ')} but your " \
185
- "access token only includes the following scopes: #{token_data.scope.join(', ')} - #{DOCS_LINK}"
186
- end
185
+ required_scopes = required_scopes(token_data, configuration || configurations.first)
186
+
187
+ details = "This endpoint requires one of the following scopes: #{required_scopes.join(', ')} but your " \
188
+ "access token only includes the following scopes: #{token_data.scope.join(', ')} - #{DOCS_LINK}"
187
189
 
188
190
  render_error(["unpermitted_scope", details])
189
191
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zaikio-jwt_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - crispymtn
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-03-27 00:00:00.000000000 Z
13
+ date: 2023-05-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activejob