json-jwt 0.4.0 → 0.4.1
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 -12
- data/VERSION +1 -1
- data/lib/json/jwk.rb +9 -9
- data/lib/json/jwk/set.rb +1 -1
- data/lib/json/jwt.rb +3 -3
- metadata +8 -2
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
json-jwt (0.
|
4
|
+
json-jwt (0.4.1)
|
5
5
|
activesupport (>= 2.3)
|
6
6
|
i18n
|
7
7
|
json (>= 1.4.3)
|
@@ -10,7 +10,7 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: http://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (3.2.
|
13
|
+
activesupport (3.2.11)
|
14
14
|
i18n (~> 0.6)
|
15
15
|
multi_json (~> 1.0)
|
16
16
|
configatron (2.9.1)
|
@@ -21,17 +21,18 @@ GEM
|
|
21
21
|
diff-lcs (1.1.3)
|
22
22
|
hashie (1.2.0)
|
23
23
|
i18n (0.6.1)
|
24
|
-
json (1.7.
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
rspec-
|
30
|
-
rspec-
|
31
|
-
|
32
|
-
rspec-
|
24
|
+
json (1.7.6)
|
25
|
+
json (1.7.6-java)
|
26
|
+
multi_json (1.5.0)
|
27
|
+
rake (10.0.2)
|
28
|
+
rspec (2.12.0)
|
29
|
+
rspec-core (~> 2.12.0)
|
30
|
+
rspec-expectations (~> 2.12.0)
|
31
|
+
rspec-mocks (~> 2.12.0)
|
32
|
+
rspec-core (2.12.1)
|
33
|
+
rspec-expectations (2.12.0)
|
33
34
|
diff-lcs (~> 1.1.3)
|
34
|
-
rspec-mocks (2.
|
35
|
+
rspec-mocks (2.12.0)
|
35
36
|
url_safe_base64 (0.2.1)
|
36
37
|
yamler (0.1.0)
|
37
38
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/lib/json/jwk.rb
CHANGED
@@ -29,8 +29,8 @@ module JSON
|
|
29
29
|
hex_x = hex[2, data_len/2]
|
30
30
|
hex_y = hex[2+data_len/2, data_len/2]
|
31
31
|
@ecdsa_coodinates = {
|
32
|
-
x
|
33
|
-
y
|
32
|
+
:x => hex_x,
|
33
|
+
:y => hex_y,
|
34
34
|
}
|
35
35
|
end
|
36
36
|
@ecdsa_coodinates
|
@@ -40,16 +40,16 @@ module JSON
|
|
40
40
|
hash = case public_key
|
41
41
|
when OpenSSL::PKey::RSA
|
42
42
|
{
|
43
|
-
alg
|
44
|
-
e
|
45
|
-
n
|
43
|
+
:alg => :RSA,
|
44
|
+
:e => UrlSafeBase64.encode64(public_key.e.to_s(2)),
|
45
|
+
:n => UrlSafeBase64.encode64(public_key.n.to_s(2)),
|
46
46
|
}
|
47
47
|
when OpenSSL::PKey::EC
|
48
48
|
{
|
49
|
-
alg
|
50
|
-
crv
|
51
|
-
x
|
52
|
-
y
|
49
|
+
:alg => :EC,
|
50
|
+
:crv => ecdsa_curve_name(public_key),
|
51
|
+
:x => UrlSafeBase64.encode64(ecdsa_coodinates(public_key)[:x].to_s),
|
52
|
+
:y => UrlSafeBase64.encode64(ecdsa_coodinates(public_key)[:y].to_s),
|
53
53
|
}
|
54
54
|
else
|
55
55
|
raise UnknownAlgorithm.new('Unknown Algorithm')
|
data/lib/json/jwk/set.rb
CHANGED
data/lib/json/jwt.rb
CHANGED
@@ -14,8 +14,8 @@ module JSON
|
|
14
14
|
|
15
15
|
def initialize(claims)
|
16
16
|
@header = {
|
17
|
-
typ
|
18
|
-
alg
|
17
|
+
:typ => :JWT,
|
18
|
+
:alg => :none
|
19
19
|
}
|
20
20
|
[:exp, :nbf, :iat].each do |key|
|
21
21
|
claims[key] = claims[key].to_i if claims[key]
|
@@ -55,7 +55,7 @@ module JSON
|
|
55
55
|
UrlSafeBase64.decode64 segment.to_s
|
56
56
|
end
|
57
57
|
header, claims = [header, claims].collect do |json|
|
58
|
-
JSON.parse json, symbolize_names
|
58
|
+
JSON.parse json, :symbolize_names => true, :symbolize_keys => true
|
59
59
|
end
|
60
60
|
signature_base_string = jwt_string.split('.')[0, 2].join('.')
|
61
61
|
jwt = new claims
|
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.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -172,12 +172,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
172
|
- - ! '>='
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: '0'
|
175
|
+
segments:
|
176
|
+
- 0
|
177
|
+
hash: 294812964750732279
|
175
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
179
|
none: false
|
177
180
|
requirements:
|
178
181
|
- - ! '>='
|
179
182
|
- !ruby/object:Gem::Version
|
180
183
|
version: '0'
|
184
|
+
segments:
|
185
|
+
- 0
|
186
|
+
hash: 294812964750732279
|
181
187
|
requirements: []
|
182
188
|
rubyforge_project:
|
183
189
|
rubygems_version: 1.8.24
|