json-jwt 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of json-jwt might be problematic. Click here for more details.

data/.gitignore CHANGED
@@ -14,7 +14,7 @@ tmtags
14
14
  *.swp
15
15
 
16
16
  ## PROJECT::GENERAL
17
- coverage
17
+ coverage*
18
18
  rdoc
19
19
  pkg
20
20
 
data/.travis.yml CHANGED
@@ -1,5 +1,3 @@
1
1
  rvm:
2
- - 1.8.7
3
2
  - 1.9.2
4
3
  - 1.9.3
5
- - jruby
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- json-jwt (0.0.3)
4
+ json-jwt (0.0.5)
5
5
  activesupport (>= 2.3)
6
6
  i18n
7
7
  json (>= 1.4.3)
@@ -10,30 +10,37 @@ PATH
10
10
  GEM
11
11
  remote: http://rubygems.org/
12
12
  specs:
13
- activesupport (3.1.0)
13
+ activesupport (3.2.1)
14
+ i18n (~> 0.6)
14
15
  multi_json (~> 1.0)
16
+ configatron (2.9.0)
17
+ yamler (>= 0.1.0)
18
+ cover_me (1.2.0)
19
+ configatron
20
+ hashie
15
21
  diff-lcs (1.1.3)
22
+ hashie (1.2.0)
16
23
  i18n (0.6.0)
17
- json (1.6.1)
18
- multi_json (1.0.3)
19
- rake (0.9.2)
20
- rcov (0.9.10)
21
- rspec (2.6.0)
22
- rspec-core (~> 2.6.0)
23
- rspec-expectations (~> 2.6.0)
24
- rspec-mocks (~> 2.6.0)
25
- rspec-core (2.6.4)
26
- rspec-expectations (2.6.0)
24
+ json (1.6.5)
25
+ multi_json (1.0.4)
26
+ rake (0.9.2.2)
27
+ rspec (2.8.0)
28
+ rspec-core (~> 2.8.0)
29
+ rspec-expectations (~> 2.8.0)
30
+ rspec-mocks (~> 2.8.0)
31
+ rspec-core (2.8.0)
32
+ rspec-expectations (2.8.0)
27
33
  diff-lcs (~> 1.1.2)
28
- rspec-mocks (2.6.0)
34
+ rspec-mocks (2.8.0)
29
35
  url_safe_base64 (0.2.1)
36
+ yamler (0.1.0)
30
37
 
31
38
  PLATFORMS
32
39
  ruby
33
40
 
34
41
  DEPENDENCIES
42
+ cover_me (>= 1.2.0)
35
43
  jruby-openssl (>= 0.7)
36
44
  json-jwt!
37
45
  rake (>= 0.8)
38
- rcov (>= 0.9)
39
46
  rspec (>= 2)
data/Rakefile CHANGED
@@ -1,11 +1,19 @@
1
- require 'bundler/gem_tasks'
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
2
3
 
3
4
  require 'rspec/core/rake_task'
4
5
  RSpec::Core::RakeTask.new(:spec)
5
6
 
6
- RSpec::Core::RakeTask.new(:rcov) do |spec|
7
- spec.rcov = true
8
- spec.rcov_opts = ['-Ilib -Ispec --exclude spec,gems']
7
+ if RUBY_VERSION >= '1.9'
8
+ require 'cover_me'
9
+ CoverMe.config do |c|
10
+ c.file_pattern = /(#{CoverMe.config.project.root}\/lib\/.+\.rb)/i
11
+ end
12
+ else
13
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
14
+ spec.rcov = true
15
+ spec.rcov_opts = ['-Ilib -Ispec --exclude spec,gems']
16
+ end
9
17
  end
10
18
 
11
19
  task :default => :spec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
data/json-jwt.gemspec CHANGED
@@ -15,6 +15,10 @@ Gem::Specification.new do |s|
15
15
  s.add_runtime_dependency "activesupport", ">= 2.3"
16
16
  s.add_runtime_dependency "i18n"
17
17
  s.add_development_dependency "rake", ">= 0.8"
18
- s.add_development_dependency "rcov", ">= 0.9"
18
+ if RUBY_VERSION >= '1.9'
19
+ s.add_development_dependency "cover_me", ">= 1.2.0"
20
+ else
21
+ s.add_development_dependency "rcov", ">= 0.9"
22
+ end
19
23
  s.add_development_dependency "rspec", ">= 2"
20
24
  end
data/lib/json/jwt.rb CHANGED
@@ -29,6 +29,12 @@ module JSON
29
29
 
30
30
  def verify(signature_base_string, signature = '', public_key_or_secret = nil)
31
31
  if header[:alg].to_s == 'none'
32
+ if public_key_or_secret
33
+ warn [
34
+ 'A public key or secret is given for non-signed JWT.',
35
+ 'The JWT can be valid regardless public key or secret, but something unexpected seems occuring.'
36
+ ].join('\n')
37
+ end
32
38
  signature == '' or raise VerificationFailed
33
39
  else
34
40
  JWS.new(self).verify(signature_base_string, signature, public_key_or_secret)
@@ -39,13 +39,20 @@ describe JSON::JWT do
39
39
 
40
40
  describe '#verify' do
41
41
  context 'when not signed nor encrypted' do
42
- context 'no signature given' do
42
+ context 'when no signature nor public_key_or_secret given' do
43
43
  it do
44
44
  jwt.verify(no_signed).should be_true
45
45
  end
46
46
  end
47
47
 
48
- context 'otherwise' do
48
+ context 'when public_key_or_secret given' do
49
+ it 'should be true but warn' do
50
+ jwt.should_receive(:warn).once
51
+ jwt.verify(no_signed, '', 'public_key_or_secret').should be_true
52
+ end
53
+ end
54
+
55
+ context 'when signature given' do
49
56
  it do
50
57
  expect do
51
58
  jwt.verify(no_signed, 'signature')
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,10 @@
1
+ if RUBY_VERSION >= '1.9'
2
+ require 'cover_me'
3
+ at_exit do
4
+ CoverMe.complete!
5
+ end
6
+ end
7
+
1
8
  require 'rspec'
2
9
  require 'json/jwt'
3
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-17 00:00:00.000000000Z
12
+ date: 2012-02-09 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &70271328934800 !ruby/object:Gem::Requirement
16
+ requirement: &70122623930020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.4.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70271328934800
24
+ version_requirements: *70122623930020
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: url_safe_base64
27
- requirement: &70271328934340 !ruby/object:Gem::Requirement
27
+ requirement: &70122623929180 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70271328934340
35
+ version_requirements: *70122623929180
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activesupport
38
- requirement: &70271328933640 !ruby/object:Gem::Requirement
38
+ requirement: &70122623924960 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '2.3'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70271328933640
46
+ version_requirements: *70122623924960
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: i18n
49
- requirement: &70271328933120 !ruby/object:Gem::Requirement
49
+ requirement: &70122623924540 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70271328933120
57
+ version_requirements: *70122623924540
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
- requirement: &70271328927100 !ruby/object:Gem::Requirement
60
+ requirement: &70122623923960 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,21 +65,21 @@ dependencies:
65
65
  version: '0.8'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70271328927100
68
+ version_requirements: *70122623923960
69
69
  - !ruby/object:Gem::Dependency
70
- name: rcov
71
- requirement: &70271328926600 !ruby/object:Gem::Requirement
70
+ name: cover_me
71
+ requirement: &70122623923220 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
75
75
  - !ruby/object:Gem::Version
76
- version: '0.9'
76
+ version: 1.2.0
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70271328926600
79
+ version_requirements: *70122623923220
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &70271328926140 !ruby/object:Gem::Requirement
82
+ requirement: &70122623922760 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '2'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70271328926140
90
+ version_requirements: *70122623922760
91
91
  description: JSON Web Token and its family (JSON Web Signature, JSON Web Encryption
92
92
  and JSON Web Key) in Ruby
93
93
  email: