diff --git a/CHANGELOG.md b/CHANGELOG.md index f1885e00..558abda9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ Notable changes in the upcoming **version 3.0**: **Fixes and enhancements:** +- Return truthy value for `::JWT::ClaimsValidator#validate!` and `::JWT::Verify.verify_claims` [#628](https://github.com/jwt/ruby-jwt/pull/628) ([@anakinj](https://github.com/anakinj)) - Your contribution here ## [v2.9.2](https://github.com/jwt/ruby-jwt/tree/v2.9.2) (2024-10-03) diff --git a/lib/jwt/claims_validator.rb b/lib/jwt/claims_validator.rb index 66a36a5f..fee9d60f 100644 --- a/lib/jwt/claims_validator.rb +++ b/lib/jwt/claims_validator.rb @@ -10,6 +10,7 @@ def initialize(payload) def validate! Claims.verify_payload!(@payload, :numeric) + true end end end diff --git a/lib/jwt/verify.rb b/lib/jwt/verify.rb index f3556cef..d29efa01 100644 --- a/lib/jwt/verify.rb +++ b/lib/jwt/verify.rb @@ -16,6 +16,7 @@ class << self def verify_claims(payload, options) ::JWT::Claims.verify!(payload, options) + true end end diff --git a/spec/jwt/claims_validator_spec.rb b/spec/jwt/claims_validator_spec.rb index be24bc89..6e05f068 100644 --- a/spec/jwt/claims_validator_spec.rb +++ b/spec/jwt/claims_validator_spec.rb @@ -10,6 +10,7 @@ context "when #{claim} payload is an integer" do let(:claims) { { claim => 12_345 } } + it { is_expected.to be_truthy } it 'does not raise error' do expect { subject }.not_to raise_error end diff --git a/spec/jwt/verify_spec.rb b/spec/jwt/verify_spec.rb index cb259c05..faa31636 100644 --- a/spec/jwt/verify_spec.rb +++ b/spec/jwt/verify_spec.rb @@ -310,7 +310,7 @@ def issuer_start_with_ruby?(issuer) %w[verify_aud verify_expiration verify_iat verify_iss verify_jti verify_not_before verify_sub].each do |method| let(:payload) { base_payload.merge(fail_verifications_payload) } it "must skip verification when #{method} option is set to false" do - described_class.verify_claims(payload, options.merge(method => false)) + expect(described_class.verify_claims(payload, options.merge(method => false))).to be_truthy end it "must raise error when #{method} option is set to true" do