ak4r 0.2.3 → 0.2.4
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/ak4r/middleware.rb +2 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 78438b5f45ef1980b47f4a9fb2f11d675e3a8224c17d394fb373c443a3060b41
|
|
4
|
+
data.tar.gz: 0f84d5a528f2f2d5d3af633867a7746e45e2d07d2d1a4c2a6be93cb9acded525
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d51f310266b2d15be1eccefffc346cd85ba003238cc3fe1be2841f7242ba003b3d1fdcda06145d2e8dbd32100c5879633431daaedace114a046ef34e3d92753
|
|
7
|
+
data.tar.gz: f0364f56140a6e0b67ef1aa761bac332f500cda2b7d40327b1939820ecec68cd6c4c022f991fc5d67ffb2f60050908f3a96d4d5989765eb54292278aff94c62d
|
data/lib/ak4r/middleware.rb
CHANGED
|
@@ -62,7 +62,8 @@ module Ak4r
|
|
|
62
62
|
raise Ak4r::ApiException.new(403, "API Key invalid") if(api_key_hash != api_key.key_hash)
|
|
63
63
|
|
|
64
64
|
request = Rack::Request.new(env)
|
|
65
|
-
|
|
65
|
+
route = Rails.application.routes.recognize_path(request.path, {method: request.request_method}) || {controller: "route_path_not_recognized #{request.path}"}
|
|
66
|
+
scope = "#{request.request_method}:/#{route[:controller]}"
|
|
66
67
|
raise Ak4r::ApiException.new(403, "API Key not allowed for scope #{scope}") unless(api_key.scopes.include?(scope))
|
|
67
68
|
@app.call(env)
|
|
68
69
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ak4r
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stefano Salvador
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-01-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -45,7 +45,7 @@ homepage: https://github.com/stefanosalvador/ak4r
|
|
|
45
45
|
licenses:
|
|
46
46
|
- MIT
|
|
47
47
|
metadata: {}
|
|
48
|
-
post_install_message:
|
|
48
|
+
post_install_message:
|
|
49
49
|
rdoc_options: []
|
|
50
50
|
require_paths:
|
|
51
51
|
- lib
|
|
@@ -60,8 +60,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
61
|
version: '0'
|
|
62
62
|
requirements: []
|
|
63
|
-
rubygems_version: 3.
|
|
64
|
-
signing_key:
|
|
63
|
+
rubygems_version: 3.4.20
|
|
64
|
+
signing_key:
|
|
65
65
|
specification_version: 4
|
|
66
66
|
summary: API Keys for Ruby on Rails
|
|
67
67
|
test_files: []
|