Skip to content

Commit

Permalink
Fix compatibility with JWT 2.10+
Browse files Browse the repository at this point in the history
This version made the `JWT::VERSION::{MAJOR,MINOR,TINY,PRE}` constants private,
so we use `JWT.gem_version` instead.
  • Loading branch information
janko committed Dec 26, 2024
1 parent 410ef7c commit 3921088
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rodauth/features/jwt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _jwt_decode_opts
jwt_decode_opts
end

if JWT::VERSION::MAJOR > 2 || (JWT::VERSION::MAJOR == 2 && JWT::VERSION::MINOR >= 4)
if JWT.gem_version >= Gem::Version.new("2.4")
def _jwt_decode_secrets
secrets = [jwt_secret, jwt_old_secret]
secrets.compact!
Expand Down
2 changes: 1 addition & 1 deletion spec/jwt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
old_secret = '1'
res = json_request("/", :method=>'GET')
res.must_equal [200, ['true']]
end if JWT::VERSION::MAJOR > 2 || (JWT::VERSION::MAJOR == 2 && JWT::VERSION::MINOR >= 4)
end if JWT.gem_version >= Gem::Version.new('2.4')

it "should require Accept contain application/json if jwt_check_accept? is true and Accept is present" do
warning = nil
Expand Down

0 comments on commit 3921088

Please sign in to comment.