jwt 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/Rakefile +1 -1
  2. data/jwt.gemspec +2 -2
  3. data/lib/jwt.rb +1 -1
  4. data/spec/jwt_spec.rb +8 -0
  5. metadata +2 -2
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('jwt', '0.1.7') do |p|
5
+ Echoe.new('jwt', '0.1.8') do |p|
6
6
  p.description = "JSON Web Token implementation in Ruby"
7
7
  p.url = "http://github.com/progrium/ruby-jwt"
8
8
  p.author = "Jeff Lindsay"
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "jwt"
5
- s.version = "0.1.7"
5
+ s.version = "0.1.8"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jeff Lindsay"]
9
- s.date = "2013-03-07"
9
+ s.date = "2013-03-14"
10
10
  s.description = "JSON Web Token implementation in Ruby"
11
11
  s.email = "progrium@gmail.com"
12
12
  s.extra_rdoc_files = ["lib/jwt.rb"]
data/lib/jwt.rb CHANGED
@@ -70,7 +70,7 @@ module JWT
70
70
  rescue MultiJson::LoadError => e
71
71
  raise JWT::DecodeError.new("Invalid segment encoding")
72
72
  end
73
- if verify == true
73
+ if verify
74
74
  algo = header['alg']
75
75
 
76
76
  if keyfinder
@@ -66,6 +66,14 @@ describe JWT do
66
66
  decoded_payload.should == @payload
67
67
  end
68
68
 
69
+ it "checks the key when verify is truthy" do
70
+ right_secret = 'foo'
71
+ bad_secret = 'bar'
72
+ jwt = JWT.encode(@payload, right_secret)
73
+ verify = "yes" =~ /^y/i
74
+ lambda { JWT.decode(jwt, bad_secret, verify) }.should raise_error(JWT::DecodeError)
75
+ end
76
+
69
77
  it "raises exception on unsupported crypto algorithm" do
70
78
  lambda { JWT.encode(@payload, "secret", 'HS1024') }.should raise_error(NotImplementedError)
71
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
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: 2013-03-07 00:00:00.000000000 Z
12
+ date: 2013-03-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json