json-jwt 0.0.4 → 0.0.5

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.

Files changed (4) hide show
  1. data/README.rdoc +6 -2
  2. data/VERSION +1 -1
  3. data/lib/json/jwt.rb +4 -9
  4. metadata +16 -16
data/README.rdoc CHANGED
@@ -1,4 +1,4 @@
1
- = OpenIDConnect
1
+ = JSON::JWT
2
2
 
3
3
  JSON Web Token and its family (JSON Web Signature, JSON Web Encryption and JSON Web Key) in Ruby
4
4
 
@@ -15,6 +15,8 @@ JSON Web Token and its family (JSON Web Signature, JSON Web Encryption and JSON
15
15
 
16
16
  === Encoding
17
17
 
18
+ require 'json/jwt'
19
+
18
20
  claim = {
19
21
  iss: 'nov',
20
22
  exp: 1.week.from_now,
@@ -30,11 +32,13 @@ JSON Web Token and its family (JSON Web Signature, JSON Web Encryption and JSON
30
32
  # With signature & encryption
31
33
  JSON::JWT.new(claim).sign(key, algorithm).encrypt(key, algorithm).to_s
32
34
 
35
+ For details about <code>key</code> and <code>algorithm</code>, see {JWS Spec}[https://github.com/nov/json-jwt/blob/master/spec/json/jws_spec.rb] and {Sign Key Fixture Generator}[https://github.com/nov/json-jwt/blob/master/spec/helpers/sign_key_fixture_helper.rb].
36
+
33
37
  === Decoding
34
38
 
35
39
  jwt_string = "jwt_header.jwt_claims.jwt_signature"
36
40
 
37
- JSON::JWT.decode(jwt_string, public_key)
41
+ JSON::JWT.decode(jwt_string, key)
38
42
 
39
43
  == Note on Patches/Pull Requests
40
44
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
data/lib/json/jwt.rb CHANGED
@@ -35,6 +35,10 @@ module JSON
35
35
  end
36
36
  end
37
37
 
38
+ def [](key)
39
+ super || with_indifferent_access[key]
40
+ end
41
+
38
42
  def to_s
39
43
  [
40
44
  header.to_json,
@@ -45,15 +49,6 @@ module JSON
45
49
  end.join('.')
46
50
  end
47
51
 
48
- def [](key)
49
- if key.respond_to? :to_sym
50
- super key.to_sym or
51
- super key.to_s
52
- else
53
- super
54
- end
55
- end
56
-
57
52
  class << self
58
53
  def decode(jwt_string, public_key_or_secret = nil)
59
54
  raise InvalidFormat.new('Invalid JWT Format. JWT should include 2 dots.') unless jwt_string.count('.') == 2
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
4
+ version: 0.0.5
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: 2011-12-12 00:00:00.000000000Z
12
+ date: 2012-01-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &70225743843840 !ruby/object:Gem::Requirement
16
+ requirement: &70271328934800 !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: *70225743843840
24
+ version_requirements: *70271328934800
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: url_safe_base64
27
- requirement: &70225743735080 !ruby/object:Gem::Requirement
27
+ requirement: &70271328934340 !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: *70225743735080
35
+ version_requirements: *70271328934340
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activesupport
38
- requirement: &70225743717540 !ruby/object:Gem::Requirement
38
+ requirement: &70271328933640 !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: *70225743717540
46
+ version_requirements: *70271328933640
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: i18n
49
- requirement: &70225743696960 !ruby/object:Gem::Requirement
49
+ requirement: &70271328933120 !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: *70225743696960
57
+ version_requirements: *70271328933120
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
- requirement: &70225743690140 !ruby/object:Gem::Requirement
60
+ requirement: &70271328927100 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0.8'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70225743690140
68
+ version_requirements: *70271328927100
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rcov
71
- requirement: &70225743687880 !ruby/object:Gem::Requirement
71
+ requirement: &70271328926600 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0.9'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70225743687880
79
+ version_requirements: *70271328926600
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &70225743683940 !ruby/object:Gem::Requirement
82
+ requirement: &70271328926140 !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: *70225743683940
90
+ version_requirements: *70271328926140
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: