jwt_signed_request 1.2.0 → 1.2.1
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/README.md +3 -2
- data/lib/jwt_signed_request/middlewares/rack.rb +14 -6
- data/lib/jwt_signed_request/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12f82e6c9a8cf8a78430870a13956801c8d41c52
|
4
|
+
data.tar.gz: '09eaae125e6f453acff68839cb7c17e817871bb5'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1e00ca21e83575c1f8690d7000c35ec0da86b7f481708928d1045d53d50fb5594afb4240a04f44bd8c17132cf94dbabf4f38e98635c97b05216548d6d0b2a71
|
7
|
+
data.tar.gz: b73cf2457388eac51c97d492ac0533a10b754190a842b524155b28326fa0a96def9403665fbefc330e4422065ce2c36c3e34445a547507de7b875106eab30fbe
|
data/README.md
CHANGED
@@ -155,8 +155,9 @@ exDdlmXEjHYaixzYIduluGXd3cjg4H2gjqsY/NCpJ9nM8/AAINSrq+qPuA==
|
|
155
155
|
"""
|
156
156
|
|
157
157
|
class Server < Sinatra::Base
|
158
|
-
use JWTSignedRequest::Middlewares::Rack
|
159
|
-
secret_key: OpenSSL::PKey::EC.new(PUBLIC_KEY)
|
158
|
+
use JWTSignedRequest::Middlewares::Rack,
|
159
|
+
secret_key: OpenSSL::PKey::EC.new(PUBLIC_KEY),
|
160
|
+
exclude_paths: /public|health/ # optional regex
|
160
161
|
end
|
161
162
|
```
|
162
163
|
|
@@ -10,15 +10,18 @@ module JWTSignedRequest
|
|
10
10
|
@app = app
|
11
11
|
@secret_key = options.fetch(:secret_key)
|
12
12
|
@algorithm = options[:algorithm]
|
13
|
+
@exclude_paths = options[:exclude_paths]
|
13
14
|
end
|
14
15
|
|
15
16
|
def call(env)
|
16
17
|
begin
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
unless excluded_path?(env)
|
19
|
+
::JWTSignedRequest.verify(
|
20
|
+
request: ::Rack::Request.new(env),
|
21
|
+
secret_key: secret_key,
|
22
|
+
algorithm: algorithm
|
23
|
+
)
|
24
|
+
end
|
22
25
|
|
23
26
|
app.call(env)
|
24
27
|
rescue ::JWTSignedRequest::UnauthorizedRequestError => e
|
@@ -28,7 +31,12 @@ module JWTSignedRequest
|
|
28
31
|
|
29
32
|
private
|
30
33
|
|
31
|
-
attr_reader :app, :secret_key, :algorithm
|
34
|
+
attr_reader :app, :secret_key, :algorithm, :exclude_paths
|
35
|
+
|
36
|
+
def excluded_path?(env)
|
37
|
+
!exclude_paths.nil? &&
|
38
|
+
env['REQUEST_PATH'].match(exclude_paths)
|
39
|
+
end
|
32
40
|
end
|
33
41
|
end
|
34
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jwt_signed_request
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toan Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
143
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.6.11
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: JWT request signing and verification for Internal APIs
|