Skip to content

Commit

Permalink
Failing tests for verify_aud and verify_iss regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
anakinj committed Sep 23, 2024
1 parent 3f77a61 commit 623e093
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions spec/jwt/jwt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,32 @@
iss_payload = payload.merge(iss: iss)
JWT.encode iss_payload, data[:secret]
end

it 'if verify_iss is set to false (default option) should not raise JWT::InvalidIssuerError' do
expect do
JWT.decode token, data[:secret], true, iss: iss, algorithm: 'HS256'
end.not_to raise_error
end

context 'when verify_iss is set to true and no issues given' do
it 'does not raise' do
expect do
JWT.decode(token, data[:secret], true, verify_iss: true, algorithm: 'HS256')
end.not_to raise_error
end
end
end

context 'audience claim' do
let(:token) { JWT.encode(payload, data[:secret]) }

context 'when verify_aud is set to true and no audience given' do
it 'does not raise' do
expect do
JWT.decode(token, data[:secret], true, verify_aud: true, algorithm: 'HS256')
end.not_to raise_error
end
end
end

context 'claim verification order' do
Expand Down

0 comments on commit 623e093

Please sign in to comment.