Skip to content

Commit

Permalink
Merge pull request #166 from excpt/master
Browse files Browse the repository at this point in the history
Fix missing symbol handling in aud verify code
  • Loading branch information
excpt authored Sep 17, 2016
2 parents 579823b + 729a7e0 commit 5f14f08
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/jwt/verify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ def verify_aud
raise(
JWT::InvalidAudError,
'Invalid audience'
) unless @payload['aud'].include?(aud)
) unless @payload['aud'].include?(aud.to_s)
end
else
raise(
JWT::InvalidAudError,
'Invalid audience'
) unless @payload['aud'].include?(options_aud)
) unless @payload['aud'].include?(options_aud.to_s)
end
else
raise(
Expand Down
2 changes: 1 addition & 1 deletion lib/jwt/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module VERSION
# minor version
MINOR = 5
# tiny version
TINY = 5
TINY = 6
# alpha, beta, etc. tag
PRE = nil

Expand Down
13 changes: 13 additions & 0 deletions spec/jwt/verify_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ module JWT
it 'must allow an array with any value matching the one in the options with a string options key' do
Verify.verify_aud(array_payload, options.merge('aud' => array_aud.first))
end

it 'should allow strings or symbolds in options array' do
options['aud'] = [
'ruby-jwt-aud',
'test-aud',
'ruby-ruby-ruby',
:test
]

array_payload['aud'].push('test')

Verify.verify_aud(array_payload, options)
end
end

context '.verify_expiration(payload, options)' do
Expand Down

0 comments on commit 5f14f08

Please sign in to comment.