jwt 1.5.6 → 2.0.0.beta1

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.
@@ -10,10 +10,10 @@ describe 'README.md code test' do
10
10
  token = JWT.encode payload, nil, 'none'
11
11
  decoded_token = JWT.decode token, nil, false
12
12
 
13
- expect(token).to eq 'eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJkYXRhIjoidGVzdCJ9.'
13
+ expect(token).to eq 'eyJhbGciOiJub25lIn0.eyJkYXRhIjoidGVzdCJ9.'
14
14
  expect(decoded_token).to eq [
15
15
  { 'data' => 'test' },
16
- { 'typ' => 'JWT', 'alg' => 'none' }
16
+ { 'alg' => 'none' }
17
17
  ]
18
18
  end
19
19
 
@@ -21,10 +21,10 @@ describe 'README.md code test' do
21
21
  token = JWT.encode payload, 'my$ecretK3y', 'HS256'
22
22
  decoded_token = JWT.decode token, 'my$ecretK3y', false
23
23
 
24
- expect(token).to eq 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjoidGVzdCJ9.ZxW8go9hz3ETCSfxFxpwSkYg_602gOPKearsf6DsxgY'
24
+ expect(token).to eq 'eyJhbGciOiJIUzI1NiJ9.eyJkYXRhIjoidGVzdCJ9.pNIWIL34Jo13LViZAJACzK6Yf0qnvT_BuwOxiMCPE-Y'
25
25
  expect(decoded_token).to eq [
26
26
  { 'data' => 'test' },
27
- { 'typ' => 'JWT', 'alg' => 'HS256' }
27
+ { 'alg' => 'HS256' }
28
28
  ]
29
29
  end
30
30
 
@@ -37,7 +37,7 @@ describe 'README.md code test' do
37
37
 
38
38
  expect(decoded_token).to eq [
39
39
  { 'data' => 'test' },
40
- { 'typ' => 'JWT', 'alg' => 'RS256' }
40
+ { 'alg' => 'RS256' }
41
41
  ]
42
42
  end
43
43
 
@@ -52,7 +52,7 @@ describe 'README.md code test' do
52
52
 
53
53
  expect(decoded_token).to eq [
54
54
  { 'data' => 'test' },
55
- { 'typ' => 'JWT', 'alg' => 'ES256' }
55
+ { 'alg' => 'ES256' }
56
56
  ]
57
57
  end
58
58
  end
@@ -176,6 +176,17 @@ describe 'README.md code test' do
176
176
  end
177
177
  end
178
178
 
179
+ context 'custom header fields' do
180
+ it 'with custom field' do
181
+ payload = { data: 'test' }
182
+
183
+ token = JWT.encode payload, nil, 'none', typ: 'JWT'
184
+ _, header = JWT.decode token, nil, false
185
+
186
+ expect(header['typ']).to eq 'JWT'
187
+ end
188
+ end
189
+
179
190
  it 'sub' do
180
191
  sub = 'Subject'
181
192
  sub_payload = { data: 'data', sub: sub }
@@ -8,7 +8,7 @@ module JWT
8
8
  let(:options) { { leeway: 0 } }
9
9
 
10
10
  context '.verify_aud(payload, options)' do
11
- let(:scalar_aud) { 'ruby-jwt-audience' }
11
+ let(:scalar_aud) { 'ruby-jwt-aud' }
12
12
  let(:array_aud) { %w(ruby-jwt-aud test-aud ruby-ruby-ruby) }
13
13
  let(:scalar_payload) { base_payload.merge('aud' => scalar_aud) }
14
14
  let(:array_payload) { base_payload.merge('aud' => array_aud) }
@@ -25,39 +25,20 @@ module JWT
25
25
  end.to raise_error JWT::InvalidAudError
26
26
  end
27
27
 
28
- it 'must raise JWT::InvalidAudError when the singular audience does not match and the options aud key is a string' do
29
- expect do
30
- Verify.verify_aud(scalar_payload, options.merge('aud' => 'no-match'))
31
- end.to raise_error JWT::InvalidAudError
32
- end
33
-
34
28
  it 'must allow a matching singular audience to pass' do
35
29
  Verify.verify_aud(scalar_payload, options.merge(aud: scalar_aud))
36
30
  end
37
31
 
38
- it 'must allow a matching audence to pass when the options key is a string' do
39
- Verify.verify_aud(scalar_payload, options.merge('aud' => scalar_aud))
40
- end
41
-
42
32
  it 'must allow an array with any value matching the one in the options' do
43
33
  Verify.verify_aud(array_payload, options.merge(aud: array_aud.first))
44
34
  end
45
35
 
46
- it 'must allow an array with any value matching the one in the options with a string options key' do
47
- Verify.verify_aud(array_payload, options.merge('aud' => array_aud.first))
36
+ it 'must allow an array with any value matching any value in the options array' do
37
+ Verify.verify_aud(array_payload, options.merge(aud: array_aud))
48
38
  end
49
39
 
50
- it 'should allow strings or symbolds in options array' do
51
- options['aud'] = [
52
- 'ruby-jwt-aud',
53
- 'test-aud',
54
- 'ruby-ruby-ruby',
55
- :test
56
- ]
57
-
58
- array_payload['aud'].push('test')
59
-
60
- Verify.verify_aud(array_payload, options)
40
+ it 'must allow a singular audience payload matching any value in the options array' do
41
+ Verify.verify_aud(scalar_payload, options.merge(aud: array_aud))
61
42
  end
62
43
  end
63
44
 
@@ -71,10 +52,14 @@ module JWT
71
52
  end.to raise_error JWT::ExpiredSignature
72
53
  end
73
54
 
74
- it 'must allow some leeway in the expiration when configured' do
55
+ it 'must allow some leeway in the expiration when global leeway is configured' do
75
56
  Verify.verify_expiration(payload, options.merge(leeway: 10))
76
57
  end
77
58
 
59
+ it 'must allow some leeway in the expiration when exp_leeway is configured' do
60
+ Verify.verify_expiration(payload, options.merge(exp_leeway: 10))
61
+ end
62
+
78
63
  it 'must be expired if the exp claim equals the current time' do
79
64
  payload['exp'] = Time.now.to_i
80
65
 
@@ -96,6 +81,10 @@ module JWT
96
81
  Verify.verify_iat(payload.merge('iat' => (iat + 60)), options.merge(leeway: 70))
97
82
  end
98
83
 
84
+ it 'must allow configured iat_leeway' do
85
+ Verify.verify_iat(payload.merge('iat' => (iat + 60)), options.merge(iat_leeway: 70))
86
+ end
87
+
99
88
  it 'must properly handle integer times' do
100
89
  Verify.verify_iat(payload.merge('iat' => Time.now.to_i), options)
101
90
  end
@@ -175,9 +164,13 @@ module JWT
175
164
  end.to raise_error JWT::ImmatureSignature
176
165
  end
177
166
 
178
- it 'must allow some leeway in the token age when configured' do
167
+ it 'must allow some leeway in the token age when global leeway is configured' do
179
168
  Verify.verify_not_before(payload, options.merge(leeway: 10))
180
169
  end
170
+
171
+ it 'must allow some leeway in the token age when nbf_leeway is configured' do
172
+ Verify.verify_not_before(payload, options.merge(nbf_leeway: 10))
173
+ end
181
174
  end
182
175
 
183
176
  context '.verify_sub(payload, options)' do
@@ -1,5 +1,6 @@
1
1
  require 'spec_helper'
2
2
  require 'jwt'
3
+ require 'jwt/encode'
3
4
  require 'jwt/decode'
4
5
 
5
6
  describe JWT do
@@ -18,13 +19,14 @@ describe JWT do
18
19
  'ES384_public' => OpenSSL::PKey.read(File.read(File.join(CERT_PATH, 'ec384-public.pem'))),
19
20
  'ES512_private' => OpenSSL::PKey.read(File.read(File.join(CERT_PATH, 'ec512-private.pem'))),
20
21
  'ES512_public' => OpenSSL::PKey.read(File.read(File.join(CERT_PATH, 'ec512-public.pem'))),
21
- 'NONE' => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJ1c2VyX2lkIjoic29tZUB1c2VyLnRsZCJ9.',
22
- 'HS256' => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic29tZUB1c2VyLnRsZCJ9.tCGvlClld0lbQ3NZaH8y53n5RSBr3zlS4Oy5bXqvzZQ',
23
- 'HS384' => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzM4NCJ9.eyJ1c2VyX2lkIjoic29tZUB1c2VyLnRsZCJ9.sj1gc01SawlJSrPZgmveifJ8CzZRYAWjejWm4FRaGaAISESJ9Ncf12fCz2vHrITm',
24
- 'HS512' => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoic29tZUB1c2VyLnRsZCJ9.isjhsWMZpRQOWw6LKtlY4L6tMDNkLr0qZ3bQe_xRFXWhzVvJlkclTbLVa1J6Dlj2WyZ_I1jEobTaFMDoXPzwWg',
25
- 'RS256' => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1c2VyX2lkIjoic29tZUB1c2VyLnRsZCJ9.u82QrhjZTtwve5akvfWS_4LPywbkb1Yp0nUwZJWtTW0ID7dY9rRiQF5KGj2UDLZotqRlUjyNQg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5qR7NAhtvT7iyLFgOqhZNUQ6Ret5VpQ',
28
+ 'RS384' => 'eyJhbGciOiJSUzM4NCJ9.eyJ1c2VyX2lkIjoic29tZUB1c2VyLnRsZCJ9.Sfgk56moPghtsjaP4so6tOy3I553mgwX-5gByMC6dX8lpeWgsxSeAd_K8IyO7u4lwYOL0DSftnqO1HEOuN1AKyBbDvaTXz3u2xNA2x4NYLdW4AZA6ritbYcKLO5BHTXw5ueMbtA1jjGXP0zI_aK2iJTMBmB8SCF88RYBUH01Tyf4PlLj98pGL-v3prZd6kZkIeRJ3326h04hslcB5HQKmgeBk24QNLIoIC-CD329HPjJ7TtGx01lj-ehTBnwVbBGzYFAyoalV5KgvL_MDOfWPr1OYHnR5s_Fm6_3Vg4u6lBljvHOrmv4Nfx7d8HLgbo8CwH4qn1wm6VQCtuDd-uhRg',
29
+ 'RS512' => 'eyJhbGciOiJSUzUxMiJ9.eyJ1c2VyX2lkIjoic29tZUB1c2VyLnRsZCJ9.LIIAUEuCkGNdpYguOO5LoW4rZ7ED2POJrB0pmEAAchyTdIK4HKh1jcLxc6KyGwZv40njCgub3y72q6vcQTn7oD0zWFCVQRIDW1911Ii2hRNHuigiPUnrnZh1OQ6z65VZRU6GKs8omoBGU9vrClBU0ODqYE16KxYmE_0n4Xw2h3D_L1LF0IAOtDWKBRDa3QHwZRM9sHsHNsBuD5ye9KzDYN1YALXj64LBfA-DoCKfpVAm9NkRPOyzjR2X2C3TomOSJgqWIVHJucudKDDAZyEbO4RA5pI-UFYy1370p9bRajvtDyoBuLDCzoSkMyQ4L2DnLhx5CbWcnD7Cd3GUmnjjTA',
28
30
  'ES256' => '',
29
31
  'ES384' => '',
30
32
  'ES512' => ''
@@ -60,7 +62,7 @@ describe JWT do
60
62
  end
61
63
  end
62
64
 
63
- %w(HS256 HS384 HS512).each do |alg|
65
+ %w(HS256 HS512256 HS384 HS512).each do |alg|
64
66
  context "alg: #{alg}" do
65
67
  it 'should generate a valid token' do
66
68
  token = JWT.encode payload, data[:secret], alg
@@ -69,7 +71,7 @@ describe JWT do
69
71
  end
70
72
 
71
73
  it 'should decode a valid token' do
72
- jwt_payload, header = JWT.decode data[alg], data[:secret]
74
+ jwt_payload, header = JWT.decode data[alg], data[:secret], true, algorithm: alg
73
75
 
74
76
  expect(header['alg']).to eq alg
75
77
  expect(jwt_payload).to eq payload
@@ -77,8 +79,8 @@ describe JWT do
77
79
 
78
80
  it 'wrong secret should raise JWT::DecodeError' do
79
81
  expect do
80
- JWT.decode data[alg], 'wrong_secret'
81
- end.to raise_error JWT::DecodeError
82
+ JWT.decode data[alg], 'wrong_secret', true, algorithm: alg
83
+ end.to raise_error JWT::VerificationError
82
84
  end
83
85
 
84
86
  it 'wrong secret and verify = false should not raise JWT::DecodeError' do
@@ -98,7 +100,7 @@ describe JWT do
98
100
  end
99
101
 
100
102
  it 'should decode a valid token' do
101
- jwt_payload, header = JWT.decode data[alg], data[:rsa_public]
103
+ jwt_payload, header = JWT.decode data[alg], data[:rsa_public], true, algorithm: alg
102
104
 
103
105
  expect(header['alg']).to eq alg
104
106
  expect(jwt_payload).to eq payload
@@ -108,7 +110,7 @@ describe JWT do
108
110
  key = OpenSSL::PKey.read File.read(File.join(CERT_PATH, 'rsa-2048-wrong-public.pem'))
109
111
 
110
112
  expect do
111
- JWT.decode data[alg], key
113
+ JWT.decode data[alg], key, true, algorithm: alg
112
114
  end.to raise_error JWT::DecodeError
113
115
  end
114
116
 
@@ -131,14 +133,14 @@ describe JWT do
131
133
  let(:wrong_key) { OpenSSL::PKey.read(File.read(File.join(CERT_PATH, 'ec256-wrong-public.pem'))) }
132
134
 
133
135
  it 'should generate a valid token' do
134
- jwt_payload, header = JWT.decode data[alg], data["#{alg}_public"]
136
+ jwt_payload, header = JWT.decode data[alg], data["#{alg}_public"], true, algorithm: alg
135
137
 
136
138
  expect(header['alg']).to eq alg
137
139
  expect(jwt_payload).to eq payload
138
140
  end
139
141
 
140
142
  it 'should decode a valid token' do
141
- jwt_payload, header = JWT.decode data[alg], data["#{alg}_public"]
143
+ jwt_payload, header = JWT.decode data[alg], data["#{alg}_public"], true, algorithm: alg
142
144
 
143
145
  expect(header['alg']).to eq alg
144
146
  expect(jwt_payload).to eq payload
@@ -195,6 +197,14 @@ describe JWT do
195
197
  JWT.decode token, data[:secret], true, algorithm: 'HS512'
196
198
  end.not_to raise_error
197
199
  end
200
+
201
+ it 'should raise JWT::IncorrectAlgorithm if no algorithm is provided' do
202
+ token = JWT.encode payload, data[:rsa_public].to_s, 'HS256'
203
+
204
+ expect do
205
+ JWT.decode token, data[:rsa_public], true
206
+ end.to raise_error JWT::IncorrectAlgorithm
207
+ end
198
208
  end
199
209
 
200
210
  context 'issuer claim' do
@@ -208,7 +218,7 @@ describe JWT do
208
218
 
209
219
  it 'if verify_iss is set to false (default option) should not raise JWT::InvalidIssuerError' do
210
220
  expect do
211
- JWT.decode token, data[:secret], true, iss: iss
221
+ JWT.decode token, data[:secret], true, iss: iss, algorithm: 'HS256'
212
222
  end.not_to raise_error
213
223
  end
214
224
  end
@@ -217,24 +227,7 @@ describe JWT do
217
227
  context 'Base64' do
218
228
  it 'urlsafe replace + / with - _' do
219
229
  allow(Base64).to receive(:encode64) { 'string+with/non+url-safe/characters_' }
220
- expect(JWT.base64url_encode('foo')).to eq('string-with_non-url-safe_characters_')
221
- end
222
- end
223
-
224
- describe 'secure comparison' do
225
- it 'returns true if strings are equal' do
226
- expect(JWT.secure_compare('Foo', 'Foo')).to eq true
227
- end
228
-
229
- it 'returns false if either input is nil or empty' do
230
- [nil, ''].each do |bad|
231
- expect(JWT.secure_compare(bad, 'Foo')).to eq false
232
- expect(JWT.secure_compare('Foo', bad)).to eq false
233
- end
234
- end
235
-
236
- it 'retuns false if the strings are different' do
237
- expect(JWT.secure_compare('Foo', 'Bar')).to eq false
230
+ expect(JWT::Encode.base64url_encode('foo')).to eq('string-with_non-url-safe_characters_')
238
231
  end
239
232
  end
240
233
  end
@@ -2,20 +2,17 @@ require 'rspec'
2
2
  require 'simplecov'
3
3
  require 'simplecov-json'
4
4
  require 'codeclimate-test-reporter'
5
+ require 'codacy-coverage'
6
+
7
+ Codacy::Reporter.start
5
8
 
6
9
  SimpleCov.configure do
7
10
  root File.join(File.dirname(__FILE__), '..')
8
11
  project_name 'Ruby JWT - Ruby JSON Web Token implementation'
9
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
10
- SimpleCov::Formatter::HTMLFormatter,
11
- SimpleCov::Formatter::JSONFormatter
12
- ])
13
-
14
12
  add_filter 'spec'
15
13
  end
16
14
 
17
15
  SimpleCov.start if ENV['COVERAGE']
18
- CodeClimate::TestReporter.start if ENV['CODECLIMATE_REPO_TOKEN']
19
16
 
20
17
  CERT_PATH = File.join(File.dirname(__FILE__), 'fixtures', 'certs')
21
18
 
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.6
4
+ version: 2.0.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
- - Jeff Lindsay
8
7
  - Tim Rudat
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2016-09-19 00:00:00.000000000 Z
11
+ date: 2017-02-27 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
@@ -40,21 +39,21 @@ dependencies:
40
39
  - !ruby/object:Gem::Version
41
40
  version: '0'
42
41
  - !ruby/object:Gem::Dependency
43
- name: json
42
+ name: rspec
44
43
  requirement: !ruby/object:Gem::Requirement
45
44
  requirements:
46
- - - "<"
45
+ - - ">="
47
46
  - !ruby/object:Gem::Version
48
- version: '2.0'
47
+ version: '0'
49
48
  type: :development
50
49
  prerelease: false
51
50
  version_requirements: !ruby/object:Gem::Requirement
52
51
  requirements:
53
- - - "<"
52
+ - - ">="
54
53
  - !ruby/object:Gem::Version
55
- version: '2.0'
54
+ version: '0'
56
55
  - !ruby/object:Gem::Dependency
57
- name: rspec
56
+ name: simplecov
58
57
  requirement: !ruby/object:Gem::Requirement
59
58
  requirements:
60
59
  - - ">="
@@ -68,7 +67,7 @@ dependencies:
68
67
  - !ruby/object:Gem::Version
69
68
  version: '0'
70
69
  - !ruby/object:Gem::Dependency
71
- name: simplecov
70
+ name: simplecov-json
72
71
  requirement: !ruby/object:Gem::Requirement
73
72
  requirements:
74
73
  - - ">="
@@ -82,7 +81,7 @@ dependencies:
82
81
  - !ruby/object:Gem::Version
83
82
  version: '0'
84
83
  - !ruby/object:Gem::Dependency
85
- name: simplecov-json
84
+ name: codeclimate-test-reporter
86
85
  requirement: !ruby/object:Gem::Requirement
87
86
  requirements:
88
87
  - - ">="
@@ -96,7 +95,21 @@ dependencies:
96
95
  - !ruby/object:Gem::Version
97
96
  version: '0'
98
97
  - !ruby/object:Gem::Dependency
99
- name: codeclimate-test-reporter
98
+ name: codacy-coverage
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rbnacl
100
113
  requirement: !ruby/object:Gem::Requirement
101
114
  requirements:
102
115
  - - ">="
@@ -129,8 +142,10 @@ files:
129
142
  - Rakefile
130
143
  - lib/jwt.rb
131
144
  - lib/jwt/decode.rb
145
+ - lib/jwt/default_options.rb
146
+ - lib/jwt/encode.rb
132
147
  - lib/jwt/error.rb
133
- - lib/jwt/json.rb
148
+ - lib/jwt/signature.rb
134
149
  - lib/jwt/verify.rb
135
150
  - lib/jwt/version.rb
136
151
  - ruby-jwt.gemspec
@@ -168,17 +183,17 @@ require_paths:
168
183
  - lib
169
184
  required_ruby_version: !ruby/object:Gem::Requirement
170
185
  requirements:
171
- - - ">="
186
+ - - "~>"
172
187
  - !ruby/object:Gem::Version
173
- version: '0'
188
+ version: '2.1'
174
189
  required_rubygems_version: !ruby/object:Gem::Requirement
175
190
  requirements:
176
- - - ">="
191
+ - - ">"
177
192
  - !ruby/object:Gem::Version
178
- version: '0'
193
+ version: 1.3.1
179
194
  requirements: []
180
195
  rubyforge_project:
181
- rubygems_version: 2.6.6
196
+ rubygems_version: 2.6.8
182
197
  signing_key:
183
198
  specification_version: 4
184
199
  summary: JSON Web Token implementation in Ruby
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'json'
3
-
4
- module JWT
5
- # JSON fallback implementation or ruby 1.8.x
6
- module Json
7
- def decode_json(encoded)
8
- JSON.parse(encoded)
9
- rescue JSON::ParserError
10
- raise JWT::DecodeError, 'Invalid segment encoding'
11
- end
12
-
13
- def encode_json(raw)
14
- JSON.generate(raw)
15
- end
16
- end
17
- end