json-jwt 0.0.7 → 0.1.0
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/Gemfile.lock +13 -13
- data/Rakefile +9 -3
- data/VERSION +1 -1
- data/lib/json/jwt.rb +3 -3
- data/spec/json/jws_spec.rb +1 -6
- data/spec/json/jwt_spec.rb +2 -2
- data/spec/spec_helper.rb +0 -3
- metadata +52 -17
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
json-jwt (0.0.
|
4
|
+
json-jwt (0.0.7)
|
5
5
|
activesupport (>= 2.3)
|
6
6
|
i18n
|
7
7
|
json (>= 1.4.3)
|
@@ -10,10 +10,10 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: http://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (3.2.
|
13
|
+
activesupport (3.2.6)
|
14
14
|
i18n (~> 0.6)
|
15
15
|
multi_json (~> 1.0)
|
16
|
-
configatron (2.9.
|
16
|
+
configatron (2.9.1)
|
17
17
|
yamler (>= 0.1.0)
|
18
18
|
cover_me (1.2.0)
|
19
19
|
configatron
|
@@ -21,17 +21,17 @@ GEM
|
|
21
21
|
diff-lcs (1.1.3)
|
22
22
|
hashie (1.2.0)
|
23
23
|
i18n (0.6.0)
|
24
|
-
json (1.
|
25
|
-
multi_json (1.
|
24
|
+
json (1.7.3)
|
25
|
+
multi_json (1.3.6)
|
26
26
|
rake (0.9.2.2)
|
27
|
-
rspec (2.
|
28
|
-
rspec-core (~> 2.
|
29
|
-
rspec-expectations (~> 2.
|
30
|
-
rspec-mocks (~> 2.
|
31
|
-
rspec-core (2.
|
32
|
-
rspec-expectations (2.
|
33
|
-
diff-lcs (~> 1.1.
|
34
|
-
rspec-mocks (2.
|
27
|
+
rspec (2.10.0)
|
28
|
+
rspec-core (~> 2.10.0)
|
29
|
+
rspec-expectations (~> 2.10.0)
|
30
|
+
rspec-mocks (~> 2.10.0)
|
31
|
+
rspec-core (2.10.1)
|
32
|
+
rspec-expectations (2.10.0)
|
33
|
+
diff-lcs (~> 1.1.3)
|
34
|
+
rspec-mocks (2.10.1)
|
35
35
|
url_safe_base64 (0.2.1)
|
36
36
|
yamler (0.1.0)
|
37
37
|
|
data/Rakefile
CHANGED
@@ -5,9 +5,15 @@ require 'rspec/core/rake_task'
|
|
5
5
|
RSpec::Core::RakeTask.new(:spec)
|
6
6
|
|
7
7
|
if RUBY_VERSION >= '1.9'
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
namespace :cover_me do
|
9
|
+
desc "Generates and opens code coverage report."
|
10
|
+
task :report do
|
11
|
+
require 'cover_me'
|
12
|
+
CoverMe.complete!
|
13
|
+
end
|
14
|
+
end
|
15
|
+
task :spec do
|
16
|
+
Rake::Task['cover_me:report'].invoke
|
11
17
|
end
|
12
18
|
else
|
13
19
|
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/json/jwt.rb
CHANGED
@@ -38,7 +38,7 @@ module JSON
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def [](key)
|
41
|
-
super
|
41
|
+
super
|
42
42
|
end
|
43
43
|
|
44
44
|
def to_s
|
@@ -58,8 +58,8 @@ module JSON
|
|
58
58
|
UrlSafeBase64.decode64 segment.to_s
|
59
59
|
end
|
60
60
|
signature_base_string = jwt_string.split('.')[0, 2].join('.')
|
61
|
-
jwt = new JSON.parse(claims)
|
62
|
-
jwt.header = JSON.parse(header)
|
61
|
+
jwt = new JSON.parse(claims, :symbolize_names => true)
|
62
|
+
jwt.header = JSON.parse(header, :symbolize_names => true)
|
63
63
|
jwt.verify signature_base_string, signature, public_key_or_secret
|
64
64
|
jwt
|
65
65
|
rescue JSON::ParserError
|
data/spec/json/jws_spec.rb
CHANGED
@@ -14,7 +14,7 @@ describe JSON::JWS do
|
|
14
14
|
{
|
15
15
|
:iss => 'joe',
|
16
16
|
:exp => 1300819380,
|
17
|
-
'http://example.com/is_root' => true
|
17
|
+
:'http://example.com/is_root' => true
|
18
18
|
}
|
19
19
|
end
|
20
20
|
let(:expected_signature) {
|
@@ -86,20 +86,15 @@ describe JSON::JWS do
|
|
86
86
|
describe 'header' do
|
87
87
|
let(:header) { decoded.header }
|
88
88
|
it 'should be parsed successfully' do
|
89
|
-
header['typ'].should == 'JWT'
|
90
89
|
header[:typ].should == 'JWT'
|
91
|
-
header['alg'].should == alg.to_s
|
92
90
|
header[:alg].should == alg.to_s
|
93
91
|
end
|
94
92
|
end
|
95
93
|
|
96
94
|
describe 'claims' do
|
97
95
|
it 'should be parsed successfully' do
|
98
|
-
decoded['iss'].should == 'joe'
|
99
96
|
decoded[:iss].should == 'joe'
|
100
|
-
decoded['exp'].should == 1300819380
|
101
97
|
decoded[:exp].should == 1300819380
|
102
|
-
decoded['http://example.com/is_root'] == true
|
103
98
|
decoded[:'http://example.com/is_root'] == true
|
104
99
|
end
|
105
100
|
end
|
data/spec/json/jwt_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe JSON::JWT do
|
|
6
6
|
{
|
7
7
|
:iss => 'joe',
|
8
8
|
:exp => 1300819380,
|
9
|
-
'http://example.com/is_root' => true
|
9
|
+
:'http://example.com/is_root' => true
|
10
10
|
}
|
11
11
|
end
|
12
12
|
let(:no_signed) do
|
@@ -77,7 +77,7 @@ describe JSON::JWT do
|
|
77
77
|
context 'when not signed nor encrypted' do
|
78
78
|
context 'no signature given' do
|
79
79
|
it do
|
80
|
-
JSON::JWT.decode(no_signed).should == jwt
|
80
|
+
JSON::JWT.decode(no_signed).should == jwt
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
data/spec/spec_helper.rb
CHANGED
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
|
4
|
+
version: 0.1.0
|
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-
|
12
|
+
date: 2012-07-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 1.4.3
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.4.3
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: url_safe_base64
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: activesupport
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '2.3'
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.3'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: i18n
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: rake
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: '0.8'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0.8'
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: cover_me
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ! '>='
|
@@ -76,10 +101,15 @@ dependencies:
|
|
76
101
|
version: 1.2.0
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.2.0
|
80
110
|
- !ruby/object:Gem::Dependency
|
81
111
|
name: rspec
|
82
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
114
|
requirements:
|
85
115
|
- - ! '>='
|
@@ -87,7 +117,12 @@ dependencies:
|
|
87
117
|
version: '2'
|
88
118
|
type: :development
|
89
119
|
prerelease: false
|
90
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '2'
|
91
126
|
description: JSON Web Token and its family (JSON Web Signature, JSON Web Encryption
|
92
127
|
and JSON Web Key) in Ruby
|
93
128
|
email:
|
@@ -135,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
170
|
version: '0'
|
136
171
|
requirements: []
|
137
172
|
rubyforge_project:
|
138
|
-
rubygems_version: 1.8.
|
173
|
+
rubygems_version: 1.8.24
|
139
174
|
signing_key:
|
140
175
|
specification_version: 3
|
141
176
|
summary: JSON Web Token and its family (JSON Web Signature, JSON Web Encryption and
|