jwt-authenticator 1.0.3 → 1.0.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/.ruby-version +1 -1
- data/Gemfile.lock +12 -12
- data/jwt-authenticator.gemspec +1 -1
- data/lib/jwt-authenticator.rb +2 -0
- data/lib/jwt-authenticator/version.rb +1 -1
- data/test/test-jwt-authenticator.rb +3 -3
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eaa8560f1c1d204b1cf8556ac75896308d0437314df557504b5bd23717baa920
|
4
|
+
data.tar.gz: 7c220c3fd1b755c7944bdd061c2e0abe3c32d67a4d969b88199aa22a02042a02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ded7a7c6e21793017ab1a94ffff357580cfa3233076fca1c51b282065d8d5a09a398166571f1b54861580e5897f1163e3e4c6010fb1fd2baab0493a8ece0e127
|
7
|
+
data.tar.gz: 9215e3daada467a86df5b3012449293916eaa3d82d3425efb445c1e3826bbcbed1e76b003627c9df46a871dbe19da2d09c6fdfd7f31657550cd733d31eb4dcb3
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.1
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jwt-authenticator (1.0.
|
4
|
+
jwt-authenticator (1.0.4)
|
5
5
|
activesupport (>= 4.0, < 6.0)
|
6
6
|
jwt (~> 2.1)
|
7
7
|
method-not-implemented (~> 1.0)
|
@@ -9,33 +9,33 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (5.2.
|
12
|
+
activesupport (5.2.4.4)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 0.7, < 2)
|
15
15
|
minitest (~> 5.1)
|
16
16
|
tzinfo (~> 1.1)
|
17
|
-
concurrent-ruby (1.1.
|
18
|
-
i18n (1.
|
17
|
+
concurrent-ruby (1.1.7)
|
18
|
+
i18n (1.8.5)
|
19
19
|
concurrent-ruby (~> 1.0)
|
20
|
-
jwt (2.2.
|
20
|
+
jwt (2.2.2)
|
21
21
|
method-not-implemented (1.0.1)
|
22
|
-
minitest (5.
|
23
|
-
power_assert (1.
|
24
|
-
rake (12.3.
|
25
|
-
test-unit (3.3.
|
22
|
+
minitest (5.14.2)
|
23
|
+
power_assert (1.2.0)
|
24
|
+
rake (12.3.3)
|
25
|
+
test-unit (3.3.6)
|
26
26
|
power_assert
|
27
27
|
thread_safe (0.3.6)
|
28
|
-
tzinfo (1.2.
|
28
|
+
tzinfo (1.2.7)
|
29
29
|
thread_safe (~> 0.1)
|
30
30
|
|
31
31
|
PLATFORMS
|
32
32
|
ruby
|
33
33
|
|
34
34
|
DEPENDENCIES
|
35
|
-
bundler (
|
35
|
+
bundler (>= 1.7, < 3.0)
|
36
36
|
jwt-authenticator!
|
37
37
|
rake (~> 12.3)
|
38
38
|
test-unit (~> 3.2)
|
39
39
|
|
40
40
|
BUNDLED WITH
|
41
|
-
1.
|
41
|
+
2.1.4
|
data/jwt-authenticator.gemspec
CHANGED
@@ -20,5 +20,5 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_dependency "jwt", "~> 2.1"
|
21
21
|
s.add_dependency "method-not-implemented", "~> 1.0"
|
22
22
|
s.add_dependency "activesupport", ">= 4.0", "< 6.0"
|
23
|
-
s.add_development_dependency "bundler", "
|
23
|
+
s.add_development_dependency "bundler", ">= 1.7", "< 3.0"
|
24
24
|
end
|
data/lib/jwt-authenticator.rb
CHANGED
@@ -23,6 +23,8 @@ class JWT::Authenticator
|
|
23
23
|
error! "Token type is not provided or invalid.", 102 unless token_type == "Bearer"
|
24
24
|
returned = JWT.decode(token_value, nil, true, @verification_options) { |header| public_key(header.deep_symbolize_keys) }
|
25
25
|
returned.map(&:deep_symbolize_keys)
|
26
|
+
rescue JWT::ExpiredSignature => e
|
27
|
+
error!(e.inspect, 104)
|
26
28
|
rescue JWT::DecodeError => e
|
27
29
|
error!(e.inspect, 103)
|
28
30
|
end
|
@@ -33,7 +33,7 @@ class JWTAuthenticatorTest < Test::Unit::TestCase
|
|
33
33
|
end
|
34
34
|
|
35
35
|
modify_environment "MY_API_V1_JWT_ISS", " foo " do
|
36
|
-
assert_equal(default.merge(iss:
|
36
|
+
assert_equal(default.merge(iss: %w[foo], verify_iss: true), my_api_v1_token_verification_options)
|
37
37
|
end
|
38
38
|
|
39
39
|
modify_environment "MY_API_V1_JWT_VERIFY_IAT", "false" do
|
@@ -138,7 +138,7 @@ class JWTAuthenticatorTest < Test::Unit::TestCase
|
|
138
138
|
jwt = my_api_v2_jwt_encode(my_api_v2_jwt_payload.merge(exp: Time.now.to_i - 5))
|
139
139
|
error = assert_raises(JWT::Authenticator::Error) { my_api_v2_jwt_decode(jwt) }
|
140
140
|
assert_match(/\bexpired\b/i, error.message)
|
141
|
-
assert_equal(
|
141
|
+
assert_equal(104, error.code)
|
142
142
|
end
|
143
143
|
|
144
144
|
test "missing jti" do
|
@@ -158,7 +158,7 @@ class JWTAuthenticatorTest < Test::Unit::TestCase
|
|
158
158
|
test "loading token verification options from environment (authenticator nested under multiple modules)" do
|
159
159
|
ENV["MY_API_V3_JWT_ISS"] = "bar"
|
160
160
|
authenticator = MyAPI::V3::JWTAuthenticator.instance
|
161
|
-
assert_equal(ENV["MY_API_V3_JWT_ISS"], authenticator.instance_variable_get(:@verification_options)[:iss])
|
161
|
+
assert_equal([ENV["MY_API_V3_JWT_ISS"]], authenticator.instance_variable_get(:@verification_options)[:iss])
|
162
162
|
end
|
163
163
|
|
164
164
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jwt-authenticator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yaroslav Konoplov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -62,16 +62,22 @@ dependencies:
|
|
62
62
|
name: bundler
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - "
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '1.7'
|
68
|
+
- - "<"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '3.0'
|
68
71
|
type: :development
|
69
72
|
prerelease: false
|
70
73
|
version_requirements: !ruby/object:Gem::Requirement
|
71
74
|
requirements:
|
72
|
-
- - "
|
75
|
+
- - ">="
|
73
76
|
- !ruby/object:Gem::Version
|
74
77
|
version: '1.7'
|
78
|
+
- - "<"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '3.0'
|
75
81
|
description: The gem provides easy & extendable way to perform JSON Web Token authentication.
|
76
82
|
email: eahome00@gmail.com
|
77
83
|
executables: []
|
@@ -109,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
115
|
- !ruby/object:Gem::Version
|
110
116
|
version: '0'
|
111
117
|
requirements: []
|
112
|
-
rubygems_version: 3.
|
118
|
+
rubygems_version: 3.1.2
|
113
119
|
signing_key:
|
114
120
|
specification_version: 4
|
115
121
|
summary: JSON Web Token authentication Ruby service.
|