Skip to content

Commit e983342

Browse files
committed
Disable claim validation if no expected values given
1 parent 623e093 commit e983342

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
**Fixes and enhancements:**
1212

13+
- Fix regression in `iss` and `aud` claim validation [#619](https://github.com/jwt/ruby-jwt/pull/619) ([@anakinj](https://github.com/anakinj))
1314
- Your contribution here
1415

1516
## [v2.9.0](https://github.com/jwt/ruby-jwt/tree/v2.9.0) (2024-09-15)

lib/jwt/claims.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ module Claims
1717
VERIFIERS = {
1818
verify_expiration: ->(options) { Claims::Expiration.new(leeway: options[:exp_leeway] || options[:leeway]) },
1919
verify_not_before: ->(options) { Claims::NotBefore.new(leeway: options[:nbf_leeway] || options[:leeway]) },
20-
verify_iss: ->(options) { Claims::Issuer.new(issuers: options[:iss]) },
20+
verify_iss: ->(options) { options[:iss] && Claims::Issuer.new(issuers: options[:iss]) },
2121
verify_iat: ->(*) { Claims::IssuedAt.new },
2222
verify_jti: ->(options) { Claims::JwtId.new(validator: options[:verify_jti]) },
23-
verify_aud: ->(options) { Claims::Audience.new(expected_audience: options[:aud]) },
23+
verify_aud: ->(options) { options[:aud] && Claims::Audience.new(expected_audience: options[:aud]) },
2424
verify_sub: ->(options) { options[:sub] && Claims::Subject.new(expected_subject: options[:sub]) },
2525
required_claims: ->(options) { Claims::Required.new(required_claims: options[:required_claims]) }
2626
}.freeze

0 commit comments

Comments
 (0)