jwt 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +7 -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.10') do |p|
5
+ Echoe.new('jwt', '0.1.11') 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.10"
5
+ s.version = "0.1.11"
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 = "2014-01-10"
9
+ s.date = "2014-01-17"
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
@@ -41,7 +41,7 @@ module JWT
41
41
  end
42
42
 
43
43
  def base64url_encode(str)
44
- Base64.encode64(str).tr("-_", "+/").gsub(/[\n=]/, "")
44
+ Base64.encode64(str).tr("+/", "-_").gsub(/[\n=]/, "")
45
45
  end
46
46
 
47
47
  def encode(payload, key, algorithm="HS256", header_fields={})
@@ -159,4 +159,11 @@ PUBKEY
159
159
  )
160
160
  lambda { JWT.decode(jwt, pubkey, true) }.should raise_error(JWT::DecodeError)
161
161
  end
162
+
163
+ describe "urlsafe base64 encoding" do
164
+ it "replaces + and / with - and _" do
165
+ Base64.stub(:encode64) { "string+with/non+url-safe/characters_" }
166
+ JWT.base64url_encode("foo").should == "string-with_non-url-safe_characters_"
167
+ end
168
+ end
162
169
  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.10
4
+ version: 0.1.11
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: 2014-01-10 00:00:00.000000000 Z
12
+ date: 2014-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json